Antares Simulator
Power System Simulator
bindConstraints.h
1 /*
2  * Copyright 2007-2025, RTE (https://www.rte-france.com)
3  * See AUTHORS.txt
4  * SPDX-License-Identifier: MPL-2.0
5  * This file is part of Antares-Simulator,
6  * Adequacy and Performance assessment for interconnected energy networks.
7  *
8  * Antares_Simulator is free software: you can redistribute it and/or modify
9  * it under the terms of the Mozilla Public Licence 2.0 as published by
10  * the Mozilla Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * Antares_Simulator is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * Mozilla Public Licence 2.0 for more details.
17  *
18  * You should have received a copy of the Mozilla Public Licence 2.0
19  * along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20  */
21 #pragma once
22 
23 #include "state.h"
24 
25 namespace Antares::Solver::Variable
26 {
28 {
30  static std::string Caption()
31  {
32  return "Binding constraints";
33  }
34 
36  static std::string Unit()
37  {
38  return "";
39  }
40 
42  static std::string Description()
43  {
44  return "";
45  }
46 
49 
51  static constexpr uint8_t categoryDataLevel = Category::DataLevel::bindingConstraint;
53  static constexpr uint8_t categoryFileLevel = ResultsType::categoryFile
54  & Category::FileLevel::bc;
56  static constexpr uint8_t nodeDepthForGUI = +1;
58  static constexpr int columnCount = 0;
60  static constexpr uint8_t spatialAggregate = Category::noSpatialAggregate;
62  static constexpr uint8_t hasIntermediateValues = 0;
63 
64 }; // class VCardAllBindingConstraints
65 
66 template<class NextT = Container::EndOfList>
68 {
69 public:
71  typedef NextT NextType;
74 
77 
78  enum
79  {
81  count = NextT::count,
82  };
83 
84  template<int CDataLevel, int CFile>
85  struct Statistics
86  {
87  enum
88  {
89  count = NextType::template Statistics < CDataLevel,
90  CFile > ::count
91  };
92  };
93 
94 public:
100  template<class PredicateT>
101  static void RetrieveVariableList(PredicateT& predicate);
102 
103 public:
105 
106 
109  BindingConstraints() = default;
110 
111  BindingConstraints(BindingConstraints& other) = delete;
112  BindingConstraints(BindingConstraints&& other) = delete;
113  const BindingConstraints& operator=(BindingConstraints&& other) = delete;
114 
116  ~BindingConstraints() = default;
118 
119  void initializeFromStudy(Data::Study& study);
120 
121  void computeSummary(unsigned int year, unsigned int numSpace);
122 
123  void simulationBegin();
124  void simulationEnd();
125 
126  void yearBegin(uint year, uint numSpace);
127  void yearEnd(uint year, uint numSpace);
128 
129  void yearEndBuild(State& state, uint year, uint numSpace);
130 
131  void weekBegin(State& state);
132  void weekEnd(State& state);
133  void weekForEachArea(State&, unsigned int numSpace);
134  void hourForEachArea(State&, unsigned int numSpace);
135 
136  void hourBegin(uint hourInTheYear);
137  void hourEnd(State& state, uint hourInTheYear);
138 
139  void buildSurveyReport(SurveyResults& results,
140  int dataLevel,
141  int fileLevel,
142  int precision) const;
143 
144  void buildAnnualSurveyReport(SurveyResults& results,
145  int dataLevel,
146  int fileLevel,
147  int precision,
148  uint numSpace) const;
149 
150  template<class V>
151  void yearEndSpatialAggregates(V&, uint, uint)
152  {
153  // do nothing
154  }
155 
156  template<class I>
157  static void provideInformations(I& infos);
158 
159  template<class VCardToFindT>
160  void retrieveResultsForArea(typename Storage<VCardToFindT>::ResultsType** result,
161  const Data::Area* area);
162  void buildDigest(SurveyResults&, int digestLevel, int dataLevel) const;
163 
164  template<class V>
165  void simulationEndSpatialAggregates(V& allVars);
166 
167  template<class VCardToFindT>
168  void retrieveResultsForLink(typename Storage<VCardToFindT>::ResultsType** result,
169  const Data::AreaLink* link);
170 
171  template<class VCardToFindT>
172  void retrieveResultsForThermalCluster(typename Storage<VCardToFindT>::ResultsType** result,
173  const Data::ThermalCluster* cluster);
174  template<class VCardSearchT, class O>
175  void computeSpatialAggregateWith(O& out, const Data::Area* area, uint numSpace);
176  template<class V>
177  void computeSpatialAggregatesSummary(V& allVars, unsigned int year, unsigned int numSpace);
178 
179  void beforeYearByYearExport(uint year, uint numSpace);
180 
181 private:
182  // For each binding constraint, output variable static list associated.
183  std::vector<NextType> pBindConstraints;
184  // The number of counted binding constraints
185  uint pBCcount;
186 
187 }; // class Areas
188 
189 } // namespace Antares::Solver::Variable
190 
191 #include "bindConstraints.hxx"
Definition for a single area.
Definition: area.h:51
Definition: study.h:57
A single thermal cluster.
Definition: cluster.h:76
Definition: bindConstraints.h:68
static void RetrieveVariableList(PredicateT &predicate)
Retrieve the list of all individual variables.
Definition: bindConstraints.hxx:74
NextT NextType
Type of the next static variable.
Definition: bindConstraints.h:71
@ count
How many items have we got.
Definition: bindConstraints.h:81
BindingConstraints()=default
Default Constructor.
VCardAllBindingConstraints VCardType
VCard.
Definition: bindConstraints.h:73
VCardType::ResultsType ResultsType
List of expected results.
Definition: bindConstraints.h:76
Definition: results.h:44
Definition: state.h:71
Class utility for building CSV results files.
Definition: surveyresults.h:41
VariableAccessor< typename VCardT::ResultsType, VCardT::columnCount >::Type ResultsType
The true type used for the results.
Definition: info.h:760
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition: bindConstraints.h:60
static constexpr int columnCount
Number of columns used by the variable (One ResultsType per column)
Definition: bindConstraints.h:58
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition: bindConstraints.h:62
Results ResultsType
The expecte results.
Definition: bindConstraints.h:48
static std::string Unit()
Unit.
Definition: bindConstraints.h:36
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition: bindConstraints.h:53
static std::string Caption()
Caption.
Definition: bindConstraints.h:30
static std::string Description()
The short description of the variable.
Definition: bindConstraints.h:42
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition: bindConstraints.h:56
static constexpr uint8_t categoryDataLevel
Data Level.
Definition: bindConstraints.h:51