21 #ifndef __SOLVER_VARIABLE_ADEQUACY_OverallCost_H__
22 #define __SOLVER_VARIABLE_ADEQUACY_OverallCost_H__
24 #include "antares/solver/variable/variable.h"
26 namespace Antares::Solver::Variable::Adequacy
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 = 0; i < state.study.runtime.rangeLimits.hour[Data::rangeCount]; ++i)
188 pValuesForTheCurrentYear[numSpace][i] += state.thermalClusterOperatingCostForYear[i];
192 NextType::yearEndBuildForEachThermalCluster(state, year, numSpace);
195 void yearEndBuild(
State& state,
unsigned int year,
unsigned int numSpace)
198 NextType::yearEndBuild(state, year, numSpace);
201 void yearEnd(
unsigned int year,
unsigned int numSpace)
204 pValuesForTheCurrentYear[numSpace].computeStatisticsForTheCurrentYear();
207 NextType::yearEnd(year, numSpace);
210 void computeSummary(
unsigned int year,
unsigned int numSpace)
216 NextType::computeSummary(year, numSpace);
219 void hourBegin(
unsigned int hourInTheYear)
222 NextType::hourBegin(hourInTheYear);
225 void hourForEachArea(
State& state,
unsigned int numSpace)
227 auto area = state.area;
228 auto& thermal = state.thermal;
230 pValuesForTheCurrentYear[numSpace][state.hourInTheYear] +=
232 (state.hourlyResults->ValeursHorairesDeDefaillancePositive[state.hourInTheWeek]
233 * area->thermal.unsuppliedEnergyCost)
234 + ((state.hourlyResults->ValeursHorairesDeDefaillanceNegative[state.hourInTheWeek]
235 + state.resSpilled.entry[area->index][state.hourInTheWeek])
236 * area->thermal.spilledEnergyCost);
239 pValuesForTheCurrentYear[numSpace].hour[state.hourInTheYear]
240 += state.problemeHebdo->CaracteristiquesHydrauliques[state.area->index]
241 .WeeklyWaterValueStateRegular
242 * (state.hourlyResults->TurbinageHoraire[state.hourInTheWeek]
243 - area->hydro.pumpingEfficiency
244 * state.hourlyResults->PompageHoraire[state.hourInTheWeek]);
247 for (
auto& cluster: area->thermal.list.each_enabled())
249 pValuesForTheCurrentYear[numSpace][state.hourInTheYear]
250 += thermal[area->index].thermalClustersOperatingCost[cluster->enabledIndex];
254 NextType::hourForEachArea(state, numSpace);
257 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
259 unsigned int numSpace)
const
261 return pValuesForTheCurrentYear[numSpace].hour;
264 void localBuildAnnualSurveyReport(SurveyResults&
results,
267 unsigned int numSpace)
const
270 results.isCurrentVarNA = AncestorType::isNonApplicable;
272 if (AncestorType::isPrinted[0])
278 pValuesForTheCurrentYear[numSpace]
279 .template buildAnnualSurveyReport<VCardType>(
results, fileLevel, precision);
285 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
286 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
Variable::IVariable< OverallCost< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition: overallCost.h:101
VCardOverallCost VCardType
VCard.
Definition: overallCost.h:99
VCardType::ResultsType ResultsType
List of expected results.
Definition: overallCost.h:104
NextT NextType
Type of the next static variable.
Definition: overallCost.h:97
@ count
How many items have we got.
Definition: overallCost.h:111
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 std::string Caption()
Caption.
Definition: overallCost.h:31
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition: overallCost.h:79
static std::string Unit()
Unit.
Definition: overallCost.h:37
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition: overallCost.h:73
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition: overallCost.h:67
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition: overallCost.h:77
Results< R::AllYears::Average< >, R::AllYears::Average > ResultsType
The expecte results.
Definition: overallCost.h:53
static constexpr int columnCount
Number of columns used by the variable (One ResultsType per column)
Definition: overallCost.h:71
VCardOverallCost VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition: overallCost.h:56
static constexpr uint8_t precision
Precision (views)
Definition: overallCost.h:65
static std::string Description()
The short description of the variable.
Definition: overallCost.h:43
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition: overallCost.h:61
static constexpr uint8_t categoryDataLevel
Data Level.
Definition: overallCost.h:59
static constexpr uint8_t decimal
Decimal precision.
Definition: overallCost.h:69