Antares Simulator
Power System Simulator
area.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 #ifndef __SOLVER_VARIABLE_AREA_H__
22 #define __SOLVER_VARIABLE_AREA_H__
23 
24 #include "state.h"
25 
26 namespace Antares::Solver::Variable
27 {
29 {
31  static std::string Caption()
32  {
33  return "Areas";
34  }
35 
37  static std::string Unit()
38  {
39  return "";
40  }
41 
43  static std::string Description()
44  {
45  return "";
46  }
47 
50 
52  static constexpr uint8_t categoryDataLevel = Category::DataLevel::area;
54  static constexpr uint8_t categoryFileLevel = ResultsType::categoryFile
55  & Category::FileLevel::de;
57  static constexpr uint8_t nodeDepthForGUI = +1;
59  static constexpr int columnCount = 0;
61  static constexpr uint8_t spatialAggregate = Category::noSpatialAggregate;
63  static constexpr uint8_t hasIntermediateValues = 0;
64 
65 }; // class VCard
66 
67 template<class NextT = Container::EndOfList>
68 class Areas //: public Variable::IVariable<Areas<NextT>, NextT, VCardAllAreas>
69 {
70 public:
72  typedef NextT NextType;
76  // typedef Variable::IVariable<Areas<NextT>, NextT, VCardType> AncestorType;
77 
80 
81  enum
82  {
84  count = NextT::count,
85  };
86 
87  template<int CDataLevel, int CFile>
88  struct Statistics
89  {
90  enum
91  {
92  count = NextType::template Statistics < CDataLevel,
93  CFile > ::count
94  };
95  };
96 
97 public:
103  template<class PredicateT>
104  static void RetrieveVariableList(PredicateT& predicate);
105 
106 public:
108 
109 
112  Areas();
114  ~Areas();
116 
117  void initializeFromStudy(Data::Study& study);
118  void initializeFromArea(Data::Study*, Data::Area*);
119  void initializeFromThermalCluster(Data::Study*, Data::Area*, Data::ThermalCluster*);
120  void initializeFromAreaLink(Data::Study*, Data::AreaLink*);
121 
122  void simulationBegin();
123  void simulationEnd();
124 
125  void yearBegin(uint year, uint numSpace);
126  // void yearEndBuildPrepareDataForEachThermalCluster(State& state, uint year);
127  // void yearEndBuildForEachThermalCluster(State& state, uint year);
128 
129  void yearEndBuild(State& state, uint year, uint numSpace);
130 
131  void yearEnd(uint year, uint numSpace);
132 
133  void computeSummary(unsigned int year, unsigned int numSpace);
134 
135  void hourBegin(uint hourInTheYear);
136 
137  void hourForEachArea(State& state, uint numSpace);
138  void hourForEachLink(State& state, uint numSpace);
139 
140  void hourEnd(State& state, uint hourInTheYear);
141 
142  void weekBegin(State& state);
143  void weekForEachArea(State& state, uint numSpace);
144  void weekEnd(State& state);
145 
146  void buildSurveyReport(SurveyResults& results,
147  int dataLevel,
148  int fileLevel,
149  int precision) const;
150 
151  void buildAnnualSurveyReport(SurveyResults& results,
152  int dataLevel,
153  int fileLevel,
154  int precision,
155  uint numSpace) const;
156 
157  void buildDigest(SurveyResults&, int digestLevel, int dataLevel) const;
158 
159  void beforeYearByYearExport(uint year, uint numSpace);
160 
161  template<class I>
162  static void provideInformations(I& infos);
163 
164  template<class V>
165  void yearEndSpatialAggregates(V&, uint, uint)
166  {
167  // do nothing
168  }
169 
170  template<class V>
171  void computeSpatialAggregatesSummary(V&, unsigned int, unsigned int)
172  {
173  // do nothing
174  }
175 
176  template<class V>
177  void simulationEndSpatialAggregates(V&)
178  {
179  // do nothing
180  }
181 
182  template<class VCardSearchT, class O>
183  void computeSpatialAggregateWith(O& out);
184 
185  template<class VCardSearchT, class O>
186  void computeSpatialAggregateWith(O& out, const Data::Area* area, uint numSpace);
187 
188  template<class VCardToFindT>
189  const double* retrieveHourlyResultsForCurrentYear() const;
190 
191  template<class VCardToFindT>
192  void retrieveResultsForArea(typename Storage<VCardToFindT>::ResultsType** result,
193  const Data::Area* area);
194 
195  template<class VCardToFindT>
196  void retrieveResultsForThermalCluster(typename Storage<VCardToFindT>::ResultsType** result,
197  const Data::ThermalCluster* cluster);
198 
199  template<class VCardToFindT>
200  void retrieveResultsForLink(typename Storage<VCardToFindT>::ResultsType** result,
201  const Data::AreaLink* link);
202 
203 private:
205  NextType* pAreas;
207  uint pAreaCount;
208 
209 }; // class Areas
210 
211 } // namespace Antares::Solver::Variable
212 
213 #include "area.hxx"
214 
215 #endif // __SOLVER_VARIABLE_AREA_H__
Definition for a single area.
Definition: area.h:51
Definition: study.h:57
A single thermal cluster.
Definition: cluster.h:76
NextT NextType
Type of the next static variable.
Definition: area.h:72
Areas()
Default Constructor.
Definition: area.hxx:30
VCardAllAreas VCardType
VCard.
Definition: area.h:74
static void RetrieveVariableList(PredicateT &predicate)
Retrieve the list of all individual variables.
Definition: area.hxx:216
~Areas()
Destructor.
Definition: area.hxx:294
@ count
How many items have we got.
Definition: area.h:84
VCardType::ResultsType ResultsType
Ancestor.
Definition: area.h:79
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 std::string Description()
The short description of the variable.
Definition: area.h:43
static constexpr int columnCount
Number of columns used by the variable (One ResultsType per column)
Definition: area.h:59
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition: area.h:54
static constexpr uint8_t categoryDataLevel
Data Level.
Definition: area.h:52
static std::string Caption()
Caption.
Definition: area.h:31
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition: area.h:63
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition: area.h:57
Results ResultsType
The expecte results.
Definition: area.h:49
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition: area.h:61
static std::string Unit()
Unit.
Definition: area.h:37