Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
join.h
1/*
2** Copyright 2007-2024, 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_ECONOMY_Join_H__
22#define __SOLVER_VARIABLE_ECONOMY_Join_H__
23
24#include "antares/solver/variable/variable.h"
25
26namespace Antares
27{
28namespace Solver
29{
30namespace Variable
31{
33{
35 static std::string Caption()
36 {
37 return "";
38 }
39
41 static std::string Unit()
42 {
43 return "";
44 }
45
47 static std::string Description()
48 {
49 return "";
50 }
51
53 typedef Results<R::AllYears::Average< // The average values throughout all years
54 R::AllYears::StdDeviation< // The standard deviation values throughout all years
55 R::AllYears::Min< // The minimum values throughout all years
56 R::AllYears::Max< // The maximum values throughout all years
57 >>>>>
59
61 static constexpr uint8_t categoryDataLevel = Category::DataLevel::area;
63 static constexpr uint8_t categoryFileLevel = ResultsType::categoryFile
64 & (Category::FileLevel::id
65 | Category::FileLevel::va);
67 static constexpr uint8_t precision = Category::all;
69 static constexpr uint8_t nodeDepthForGUI = +0;
71 static constexpr uint8_t decimal = 0;
73 static constexpr int columnCount = 0;
75 static constexpr uint8_t spatialAggregate = Category::noSpatialAggregate;
76 static constexpr uint8_t spatialAggregateMode = Category::spatialAggregateEachYear;
77 static constexpr uint8_t spatialAggregatePostProcessing = 0;
79 static constexpr uint8_t hasIntermediateValues = 0;
80
81}; // class VCard
82
86template<class LeftT, class RightT>
87class Join: public Variable::IVariable<Join<LeftT, RightT>, Yuni::Default, VCardJoin>,
88 public LeftT,
89 public RightT
90{
91public:
92 typedef LeftT LeftType;
93 typedef RightT RightType;
94
99
102
104
105 enum
106 {
108 count = 1 + RightT::count,
109 };
110
111 template<int CDataLevel, int CFile>
113 {
114 enum
115 {
116 count = (int)LeftType::template Statistics < CDataLevel,
117 CFile > ::count + (int)RightType::template Statistics < CDataLevel,
118 CFile > ::count,
119 };
120 };
121
122public:
128 template<class PredicateT>
129 static void RetrieveVariableList(PredicateT& predicate)
130 {
131 LeftType::RetrieveVariableList(predicate);
132 RightType::RetrieveVariableList(predicate);
133 }
134
135public:
136 void initializeFromStudy(Data::Study& study)
137 {
138 LeftType::initializeFromStudy(study);
139 RightType::initializeFromStudy(study);
140 }
141
142 void initializeFromArea(Data::Study* study, Data::Area* area)
143 {
144 LeftType::initializeFromArea(study, area);
145 RightType::initializeFromArea(study, area);
146 }
147
148 void initializeFromLink(Data::Study* study, Data::AreaLink* link)
149 {
150 LeftType::initializeFromAreaLink(study, link);
151 RightType::initializeFromAreaLink(study, link);
152 }
153
154 void initializeFromThermalCluster(Data::Study* study,
155 Data::Area* area,
156 Data::ThermalCluster* cluster)
157 {
158 LeftType::initializeFromThermalCluster(study, area, cluster);
159 RightType::initializeFromThermalCluster(study, area, cluster);
160 }
161
162 void simulationBegin()
163 {
164 LeftType::simulationBegin();
165 RightType::simulationBegin();
166 }
167
168 void simulationEnd()
169 {
170 LeftType::simulationEnd();
171 RightType::simulationEnd();
172 }
173
174 void yearBegin(unsigned int year, unsigned int numSpace)
175 {
176 LeftType::yearBegin(year, numSpace);
177 RightType::yearBegin(year, numSpace);
178 }
179
180 void yearEndBuildPrepareDataForEachThermalCluster(State& state, uint year)
181 {
182 // Next variable
183 LeftType::yearEndBuildPrepareDataForEachThermalCluster(state, year);
184 RightType::yearEndBuildPrepareDataForEachThermalCluster(state, year);
185 }
186
187 void yearEndBuildForEachThermalCluster(State& state, uint year)
188 {
189 // Next variable
190 LeftType::yearEndBuildForEachThermalCluster(state, year);
191 RightType::yearEndBuildForEachThermalCluster(state, year);
192 }
193
194 void yearEndBuild(State& state, unsigned int year, unsigned int numSpace)
195 {
196 LeftType::yearEndBuild(state, year, numSpace);
197 RightType::yearEndBuild(state, year, numSpace);
198 }
199
200 void yearEnd(unsigned int year, unsigned int numSpace)
201 {
202 LeftType::yearEnd(year, numSpace);
203 RightType::yearEnd(year, numSpace);
204 }
205
206 void computeSummary(std::map<unsigned int, unsigned int>& numSpaceToYear,
207 unsigned int nbYearsForCurrentSummary)
208 {
209 LeftType::computeSummary(numSpaceToYear, nbYearsForCurrentSummary);
210 RightType::computeSummary(numSpaceToYear, nbYearsForCurrentSummary);
211 }
212
213 void weekBegin(State& state)
214 {
215 LeftType::weekBegin(state);
216 RightType::weekBegin(state);
217 }
218
219 void weekForEachArea(State& state, unsigned int numSpace)
220 {
221 LeftType::weekForEachArea(state, numSpace);
222 RightType::weekForEachArea(state, numSpace);
223 }
224
225 void weekEnd(State& state)
226 {
227 LeftType::weekEnd(state);
228 RightType::weekEnd(state);
229 }
230
231 void hourBegin(unsigned int hourInTheYear)
232 {
233 LeftType::hourBegin(hourInTheYear);
234 RightType::hourBegin(hourInTheYear);
235 }
236
237 void hourForEachArea(State& state, unsigned int numSpace)
238 {
239 LeftType::hourForEachArea(state, numSpace);
240 RightType::hourForEachArea(state, numSpace);
241 }
242
243 void hourForEachLink(State& state)
244 {
245 LeftType::hourForEachLink(state);
246 RightType::hourForEachLink(state);
247 }
248
249 void hourEnd(State& state, unsigned int hourInTheYear)
250 {
251 LeftType::hourEnd(state, hourInTheYear);
252 RightType::hourEnd(state, hourInTheYear);
253 }
254
255 void buildSurveyReport(SurveyResults& results,
256 int dataLevel,
257 int fileLevel,
258 int precision) const
259 {
260 LeftType::buildSurveyReport(results, dataLevel, fileLevel, precision);
261 RightType::buildSurveyReport(results, dataLevel, fileLevel, precision);
262 }
263
264 void buildAnnualSurveyReport(SurveyResults& results,
265 int dataLevel,
266 int fileLevel,
267 int precision,
268 uint numSpace) const
269 {
270 LeftType::buildAnnualSurveyReport(results, dataLevel, fileLevel, precision, numSpace);
271 RightType::buildAnnualSurveyReport(results, dataLevel, fileLevel, precision, numSpace);
272 }
273
274 void buildDigest(SurveyResults& results, int digestLevel, int dataLevel) const
275 {
276 // Building the digest
277 LeftType ::buildDigest(results, digestLevel, dataLevel);
278 RightType::buildDigest(results, digestLevel, dataLevel);
279 }
280
281 void beforeYearByYearExport(uint year, uint numSpace)
282 {
283 // Building the digest
284 LeftType ::beforeYearByYearExport(year, numSpace);
285 RightType::beforeYearByYearExport(year, numSpace);
286 }
287
288 template<class SearchVCardT, class O>
289 void computeSpatialAggregateWith(O& out)
290 {
291 LeftType ::template computeSpatialAggregateWith<SearchVCardT, O>(out);
292 RightType::template computeSpatialAggregateWith<SearchVCardT, O>(out);
293 }
294
295 template<class SearchVCardT, class O>
296 void computeSpatialAggregateWith(O& out, const Data::Area* area, uint numSpace)
297 {
298 LeftType ::template computeSpatialAggregateWith<SearchVCardT, O>(out, area, numSpace);
299 RightType::template computeSpatialAggregateWith<SearchVCardT, O>(out, area, numSpace);
300 }
301
302 template<class V>
303 void yearEndSpatialAggregates(V& allVars, unsigned int year, unsigned int numSpace)
304 {
305 LeftType::yearEndSpatialAggregates(allVars, year, numSpace);
306 RightType::yearEndSpatialAggregates(allVars, year, numSpace);
307 }
308
309 template<class V>
310 void computeSpatialAggregatesSummary(V& allVars,
311 std::map<unsigned int, unsigned int>& numSpaceToYear,
312 unsigned int nbYearsForCurrentSummary)
313 {
314 LeftType::computeSpatialAggregatesSummary(allVars,
315 numSpaceToYear,
316 nbYearsForCurrentSummary);
317 RightType::computeSpatialAggregatesSummary(allVars,
318 numSpaceToYear,
319 nbYearsForCurrentSummary);
320 }
321
322 template<class V>
323 void simulationEndSpatialAggregates(V& allVars)
324 {
325 LeftType::simulationEndSpatialAggregates(allVars);
326 RightType::simulationEndSpatialAggregates(allVars);
327 }
328
329 template<class I>
330 static void provideInformations(I& infos)
331 {
332 LeftType ::provideInformations(infos);
333 RightType::provideInformations(infos);
334 }
335
336 template<class VCardToFindT>
337 const double* retrieveHourlyResultsForCurrentYear() const
338 {
339 // Is this function ever called ?
340 auto* result = LeftType::template retrieveHourlyResultsForCurrentYear<VCardToFindT>();
341 return (!result) ? RightType::template retrieveHourlyResultsForCurrentYear<VCardToFindT>()
342 : result;
343 }
344
345 template<class VCardToFindT>
346 void retrieveResultsForArea(typename Variable::Storage<VCardToFindT>::ResultsType** result,
347 const Data::Area* area)
348 {
349 LeftType::template retrieveResultsForArea<VCardToFindT>(result, area);
350 RightType::template retrieveResultsForArea<VCardToFindT>(result, area);
351 }
352
353 template<class VCardToFindT>
354 void retrieveResultsForThermalCluster(
356 const Data::ThermalCluster* cluster)
357 {
358 LeftType::template retrieveResultsForThermalCluster<VCardToFindT>(result, cluster);
359 RightType::template retrieveResultsForThermalCluster<VCardToFindT>(result, cluster);
360 }
361
362 template<class VCardToFindT>
363 void retrieveResultsForLink(typename Variable::Storage<VCardToFindT>::ResultsType** result,
364 const Data::AreaLink* link)
365 {
366 LeftType::template retrieveResultsForLink<VCardToFindT>(result, link);
367 RightType::template retrieveResultsForLink<VCardToFindT>(result, link);
368 }
369
370 void localBuildAnnualSurveyReport(SurveyResults& results, int fileLevel, int precision) const
371 {
372 LeftType::localBuildAnnualSurveyReport(results, fileLevel, precision);
373 RightType::localBuildAnnualSurveyReport(results, fileLevel, precision);
374 }
375
376}; // class Join
377
378} // namespace Variable
379} // namespace Solver
380} // namespace Antares
381
382#endif // __SOLVER_VARIABLE_ECONOMY_Join_H__
Definition for a single area.
Definition area.h:52
Definition study.h:61
A single thermal cluster.
Definition cluster.h:78
Interface for any variable.
Definition variable.h:51
const StoredResultType & results() const
Definition variable.hxx:544
Join.
Definition join.h:90
VCardType::ResultsType ResultsType
List of expected results.
Definition join.h:101
VCardJoin VCardType
VCard.
Definition join.h:96
Variable::IVariable< Join< LeftT, RightT >, Yuni::Default, VCardType > AncestorType
Ancestor.
Definition join.h:98
static void RetrieveVariableList(PredicateT &predicate)
Retrieve the list of all individual variables.
Definition join.h:129
@ count
How many items have we got.
Definition join.h:108
Definition results.h:48
Definition cbuilder.h:120
Definition variable.h:25
VariableAccessor< typenameVCardT::ResultsType, VCardT::columnCount >::Type ResultsType
The true type used for the results.
Definition info.h:764
static std::string Description()
The short description of the variable.
Definition join.h:47
static constexpr uint8_t precision
Precision (views)
Definition join.h:67
static constexpr uint8_t categoryDataLevel
Data Level.
Definition join.h:61
Results< R::AllYears::Average< R::AllYears::StdDeviation< R::AllYears::Min< R::AllYears::Max< > > > > > ResultsType
The expecte results.
Definition join.h:58
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition join.h:63
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition join.h:79
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition join.h:69
static std::string Unit()
Unit.
Definition join.h:41
static std::string Caption()
Caption.
Definition join.h:35
static constexpr int columnCount
Number of columns used by the variable (One ResultsType per column)
Definition join.h:73
static constexpr uint8_t decimal
Decimal precision.
Definition join.h:71
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition join.h:75