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