21 #ifndef __SOLVER_VARIABLE_ECONOMY_OverallCost_H__
22 #define __SOLVER_VARIABLE_ECONOMY_OverallCost_H__
24 #include "antares/solver/variable/variable.h"
26 namespace Antares::Solver::Variable::Economy
45 return "Overall Cost throughout all MC years";
62 & (Category::FileLevel::id
63 | Category::FileLevel::va);
74 static constexpr uint8_t spatialAggregateMode = Category::spatialAggregateEachYear;
75 static constexpr uint8_t spatialAggregatePostProcessing = 0;
82 typedef std::vector<IntermediateValues> IntermediateValuesType;
84 using IntermediateValuesTypeForSpatialAg = std::unique_ptr<IntermediateValuesBaseType[]>;
92 template<
class NextT = Container::EndOfList>
114 template<
int CDataLevel,
int CFile>
130 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 yearEndBuildForEachThermalCluster(
State& state, uint year,
unsigned int numSpace)
186 for (
unsigned int i = state.study.runtime.rangeLimits.hour[Data::rangeBegin];
187 i <= state.study.runtime.rangeLimits.hour[Data::rangeEnd];
190 pValuesForTheCurrentYear[numSpace][i] += state.thermalClusterOperatingCostForYear[i];
192 state.annualSystemCost += state.thermalClusterOperatingCostForYear[i];
196 NextType::yearEndBuildForEachThermalCluster(state, year, numSpace);
199 void yearEndBuild(
State& state,
unsigned int year,
unsigned int numSpace)
202 NextType::yearEndBuild(state, year, numSpace);
205 void yearEnd(
unsigned int year,
unsigned int numSpace)
208 pValuesForTheCurrentYear[numSpace].computeStatisticsForTheCurrentYear();
211 NextType::yearEnd(year, numSpace);
214 void computeSummary(
unsigned int year,
unsigned int numSpace)
220 NextType::computeSummary(year, numSpace);
223 void hourBegin(
unsigned int hourInTheYear)
226 NextType::hourBegin(hourInTheYear);
229 void hourForEachArea(
State& state,
unsigned int numSpace)
231 const double costForSpilledOrUnsuppliedEnergy =
233 (state.hourlyResults->ValeursHorairesDeDefaillancePositive[state.hourInTheWeek]
234 * state.area->thermal.unsuppliedEnergyCost)
235 + (state.hourlyResults->ValeursHorairesDeDefaillanceNegative[state.hourInTheWeek]
236 * state.area->thermal.spilledEnergyCost);
238 pValuesForTheCurrentYear[numSpace][state.hourInTheYear] += costForSpilledOrUnsuppliedEnergy;
241 state.annualSystemCost += costForSpilledOrUnsuppliedEnergy;
244 NextType::hourForEachArea(state, numSpace);
247 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
249 unsigned int numSpace)
const
251 return pValuesForTheCurrentYear[numSpace].hour;
254 void localBuildAnnualSurveyReport(SurveyResults&
results,
257 unsigned int numSpace)
const
260 results.isCurrentVarNA = AncestorType::isNonApplicable;
262 if (AncestorType::isPrinted[0])
267 pValuesForTheCurrentYear[numSpace]
268 .template buildAnnualSurveyReport<VCardType>(
results, fileLevel, precision);
274 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
275 unsigned int pNbYearsParallel;
Definition of a link between two areas (Interconnection)
Definition: links.h:58
Definition for a single area.
Definition: area.h:51
C02 Average value of the overrall OverallCost emissions expected from all the thermal dispatchable cl...
Definition: overallCost.h:94
@ count
How many items have we got.
Definition: overallCost.h:111
VCardType::ResultsType ResultsType
List of expected results.
Definition: overallCost.h:104
VCardOverallCost VCardType
VCard.
Definition: overallCost.h:99
Variable::IVariable< OverallCost< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition: overallCost.h:101
NextT NextType
Type of the next static variable.
Definition: overallCost.h:97
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: overallCost.h:116
Definition: overallCost.h:29
static constexpr uint8_t precision
Precision (views)
Definition: overallCost.h:65
static constexpr uint8_t decimal
Decimal precision.
Definition: overallCost.h:69
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition: overallCost.h:73
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition: overallCost.h:77
VCardOverallCost VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition: overallCost.h:56
static std::string Description()
The short description of the variable.
Definition: overallCost.h:43
static constexpr uint8_t categoryDataLevel
Data Level.
Definition: overallCost.h:59
static std::string Caption()
Caption.
Definition: overallCost.h:31
static constexpr int columnCount
Number of columns used by the variable (One ResultsType per column)
Definition: overallCost.h:71
Results< R::AllYears::Average< >, R::AllYears::Average > ResultsType
The expecte results.
Definition: overallCost.h:53
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition: overallCost.h:67
static std::string Unit()
Unit.
Definition: overallCost.h:37
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition: overallCost.h:61
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition: overallCost.h:79