21 #ifndef __SOLVER_VARIABLE_ECONOMY_BALANCE_H__
22 #define __SOLVER_VARIABLE_ECONOMY_BALANCE_H__
24 #include "antares/solver/variable/variable.h"
26 namespace Antares::Solver::Variable::Economy
45 return "Nodal energy balance, throughout all MC years";
63 & (Category::FileLevel::id
64 | Category::FileLevel::va);
75 static constexpr uint8_t spatialAggregateMode = Category::spatialAggregateEachYear;
76 static constexpr uint8_t spatialAggregatePostProcessing = 0;
83 typedef std::vector<IntermediateValues> IntermediateValuesType;
85 using IntermediateValuesTypeForSpatialAg = std::unique_ptr<IntermediateValuesBaseType[]>;
92 template<
class NextT = Container::EndOfList>
114 template<
int CDataLevel,
int CFile>
132 pNbYearsParallel = study.maxNbYearsInParallel;
136 pValuesForTheCurrentYear.resize(pNbYearsParallel);
137 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
139 pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
143 NextType::initializeFromStudy(study);
149 VariableAccessorType::InitializeAndReset(
results, study);
155 NextType::initializeFromArea(study, area);
161 NextType::initializeFromAreaLink(study, link);
164 void simulationBegin()
167 NextType::simulationBegin();
172 NextType::simulationEnd();
175 void yearBegin(
unsigned int year,
unsigned int numSpace)
178 pValuesForTheCurrentYear[numSpace].reset();
180 NextType::yearBegin(year, numSpace);
183 void yearEndBuild(
State& state,
unsigned int year,
unsigned int numSpace)
186 NextType::yearEndBuild(state, year, numSpace);
189 void yearEnd(
unsigned int year,
unsigned int numSpace)
192 pValuesForTheCurrentYear[numSpace].computeStatisticsForTheCurrentYear();
195 NextType::yearEnd(year, numSpace);
198 void computeSummary(
unsigned int year,
unsigned int numSpace)
204 NextType::computeSummary(year, numSpace);
207 void hourBegin(
unsigned int hourInTheYear)
210 NextType::hourBegin(hourInTheYear);
213 void hourForEachArea(
State& state,
unsigned int numSpace)
215 double bilanPays = 0.;
216 int Interco = state.problemeHebdo->IndexDebutIntercoOrigine[state.area->index];
219 bilanPays += state.ntc.ValeurDuFlux[
static_cast<std::size_t
>(Interco)];
220 Interco = state.problemeHebdo
221 ->IndexSuivantIntercoOrigine[
static_cast<std::size_t
>(Interco)];
223 Interco = state.problemeHebdo->IndexDebutIntercoExtremite[state.area->index];
226 bilanPays -= state.ntc.ValeurDuFlux[
static_cast<std::size_t
>(Interco)];
227 Interco = state.problemeHebdo
228 ->IndexSuivantIntercoExtremite[
static_cast<std::size_t
>(Interco)];
231 pValuesForTheCurrentYear[numSpace][state.hourInTheYear] = bilanPays;
233 NextType::hourForEachArea(state, numSpace);
236 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
238 unsigned int numSpace)
const
240 return pValuesForTheCurrentYear[numSpace].hour;
243 void localBuildAnnualSurveyReport(SurveyResults&
results,
246 unsigned int numSpace)
const
249 results.isCurrentVarNA = AncestorType::isNonApplicable;
251 if (AncestorType::isPrinted[0])
256 pValuesForTheCurrentYear[numSpace]
257 .template buildAnnualSurveyReport<VCardType>(
results, fileLevel, precision);
263 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
264 unsigned int pNbYearsParallel;
Definition of a link between two areas (Interconnection)
Definition: links.h:58
Definition for a single area.
Definition: area.h:51
Marginal Balance.
Definition: balance.h:94
VCardType::ResultsType ResultsType
List of expected results.
Definition: balance.h:104
@ count
How many items have we got.
Definition: balance.h:111
Variable::IVariable< Balance< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition: balance.h:101
NextT NextType
Type of the next static variable.
Definition: balance.h:97
VCardBalance VCardType
VCard.
Definition: balance.h:99
Interface for any variable.
Definition: variable.h:47
const StoredResultType & results() const
The results.
Definition: variable.hxx:544
StoredResultType pResults
All the results about this variable.
Definition: variable.h:323
@ count
The count if item in the list.
Definition: results.h:52
Definition: cbuilder.h:120
Definition: balance.h:116
static constexpr int columnCount
Number of columns used by the variable (One ResultsType per column)
Definition: balance.h:72
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition: balance.h:62
static std::string Description()
The short description of the variable.
Definition: balance.h:43
static constexpr uint8_t categoryDataLevel
Data Level.
Definition: balance.h:60
VCardBalance VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition: balance.h:57
static std::string Unit()
Unit.
Definition: balance.h:37
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition: balance.h:74
Results< R::AllYears::Average< R::AllYears::StdDeviation< R::AllYears::Min< R::AllYears::Max< > > > > > ResultsType
The expecte results.
Definition: balance.h:54
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition: balance.h:68
static std::string Caption()
Caption.
Definition: balance.h:31
static constexpr uint8_t decimal
Decimal precision.
Definition: balance.h:70
static constexpr uint8_t precision
Precision (views)
Definition: balance.h:66
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition: balance.h:78
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition: balance.h:80
Definition: stdDeviation.h:33