Antares Simulator
Power System Simulator
container.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_LIST_H__
22 #define __SOLVER_VARIABLE_LIST_H__
23 
24 #include <yuni/yuni.h>
25 #include <yuni/core/static/types.h>
26 #include <yuni/core/string.h>
27 
28 #include <antares/logs/logs.h>
29 
30 #include "categories.h"
31 #include "endoflist.h"
32 #include "info.h"
33 #include "surveyresults.h"
34 
35 namespace Antares::Solver::Variable::Container
36 {
42 template<class NextT = Container::EndOfList>
43 class List: public NextT
44 {
45 public:
47  using NextType = NextT;
50 
51  enum
52  {
54  count = NextT::count,
55  };
56 
57 public:
59 
60 
63  void initializeFromStudy(Data::Study& study);
64 
68  void initializeFromArea(Data::Study* study, Data::Area* area);
69 
73  void initializeFromLink(Data::Study* study, Data::AreaLink* link);
74 
79  Data::Area* area,
80  Data::ThermalCluster* cluster);
82 
84 
85 
88  void simulationBegin();
89 
93  void simulationEnd();
95 
97 
98 
103  void yearBegin(unsigned int year, unsigned int numSpace);
104 
112  void yearEnd(unsigned int year, unsigned int numSpace);
113 
114  void computeSummary(unsigned int year, unsigned int numSpace);
115 
116  template<class V>
117  void yearEndSpatialAggregates(V& allVars, unsigned int year, unsigned int numSpace);
118 
119  template<class V, class SetT>
120  void yearEndSpatialAggregates(V& allVars, unsigned int year, const SetT& set);
121 
122  template<class V>
123  void computeSpatialAggregatesSummary(V& allVars, unsigned int year, unsigned int numSpace);
124 
125  template<class V>
126  void simulationEndSpatialAggregates(V& allVars);
127 
128  template<class V, class SetT>
129  void simulationEndSpatialAggregates(V& allVars, const SetT& set);
131 
133 
134 
137  void hourBegin(unsigned int hourInTheYear);
138 
139  void hourForEachArea(State& state, unsigned int numSpace);
140 
141  void hourForEachLink(State& state);
142 
143  void hourEnd(State& state, unsigned int hourInTheYear);
145 
147 
148  void weekBegin(State& state);
149 
150  void weekEnd(State& state);
152 
154 
155  template<class SearchVCardT, class O>
156  void computeSpatialAggregateWith(O& out);
157 
158  template<class SearchVCardT, class O>
159  void computeSpatialAggregateWith(O& out, const Data::Area* area, unsigned int numSpace);
160 
161  template<class VCardToFindT>
162  void retrieveResultsForArea(typename Variable::Storage<VCardToFindT>::ResultsType** result,
163  const Data::Area* area);
164 
165  template<class VCardToFindT>
166  void retrieveResultsForThermalCluster(
168  const Data::ThermalCluster* cluster);
169 
170  template<class VCardToFindT>
171  void retrieveResultsForLink(typename Variable::Storage<VCardToFindT>::ResultsType** result,
172  const Data::AreaLink* link);
174 
176 
177 
180  void buildSurveyReport(SurveyResults& results,
181  int dataLevel,
182  int fileLevel,
183  int precision) const;
184 
185  void buildAnnualSurveyReport(SurveyResults& results,
186  int dataLevel,
187  int fileLevel,
188  int precision,
189  unsigned int numSpace) const;
190 
197  void exportSurveyResults(bool global,
198  const Yuni::String& output,
199  unsigned int numSpace,
200  IResultWriter& writer);
201 
205  void buildDigest(SurveyResults& results, int digestLevel, int dataLevel) const;
207 
208 private:
210  Data::Study* pStudy;
211 
212 }; // class List
213 
214 } // namespace Antares::Solver::Variable::Container
215 
216 #include "container.hxx"
217 #include "surveyresults/reportbuilder.hxx"
218 
219 #endif // __SOLVER_VARIABLE_LIST_H__
Definition for a single area.
Definition: area.h:51
Definition: study.h:57
A single thermal cluster.
Definition: cluster.h:76
Definition: i_writer.h:32
Static list for all output variables.
Definition: container.h:44
void simulationEnd()
Notify to all variables that the simulation has finished.
Definition: container.hxx:69
void simulationBegin()
Notify to all variables that the simulation is about to begin.
Definition: container.hxx:63
void yearBegin(unsigned int year, unsigned int numSpace)
Notify to all variables that a new year is about to start.
Definition: container.hxx:75
void yearEnd(unsigned int year, unsigned int numSpace)
Notify to all variables that the year is now over.
Definition: container.hxx:81
void initializeFromStudy(Data::Study &study)
Initialize all output variables.
Definition: container.hxx:31
void initializeFromLink(Data::Study *study, Data::AreaLink *link)
Initialize all output variables according a given link.
Definition: container.hxx:47
@ count
How many items have we got.
Definition: container.h:54
NextT NextType
Type of the next static variable.
Definition: container.h:47
void initializeFromArea(Data::Study *study, Data::Area *area)
Initialize all output variables according a given area.
Definition: container.hxx:40
void buildDigest(SurveyResults &results, int digestLevel, int dataLevel) const
Ask to all variables to fullfil the digest.
Definition: container.hxx:275
void initializeFromThermalCluster(Data::Study *study, Data::Area *area, Data::ThermalCluster *cluster)
Initialize all output variables according a given thermal cluster.
Definition: container.hxx:54
void hourBegin(unsigned int hourInTheYear)
Notify to all variables that a new hour is about to begin.
Definition: container.hxx:137
void buildSurveyReport(SurveyResults &results, int dataLevel, int fileLevel, int precision) const
Ask to all variables to fullfil the report.
Definition: container.hxx:216
void exportSurveyResults(bool global, const Yuni::String &output, unsigned int numSpace, IResultWriter &writer)
Ask to all variables to fullfil additional reports (like the digest for example)
Definition: container.hxx:289
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