21 #ifndef __SOLVER_VARIABLE_ECONOMY_NbOfDispatchedUnitsByPlant_H__
22 #define __SOLVER_VARIABLE_ECONOMY_NbOfDispatchedUnitsByPlant_H__
24 #include "antares/solver/variable/variable.h"
26 namespace Antares::Solver::Variable::Economy
33 return "NODU by plant";
45 return "Number of Dispatchable Units by plant";
60 & (Category::FileLevel::de);
71 static constexpr uint8_t spatialAggregateMode = Category::spatialAggregateEachYear;
72 static constexpr uint8_t spatialAggregatePostProcessing = 0;
79 typedef std::vector<IntermediateValues> IntermediateValuesBaseType;
80 typedef std::vector<IntermediateValuesBaseType> IntermediateValuesType;
88 template<
class NextT = Container::EndOfList>
91 VCardNbOfDispatchedUnitsByPlant>
112 template<
int CDataLevel,
int CFile>
134 NextType::initializeFromStudy(study);
139 pNbYearsParallel = study->maxNbYearsInParallel;
140 pValuesForTheCurrentYear.resize(pNbYearsParallel);
143 pSize = area->thermal.list.enabledCount();
147 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
149 pValuesForTheCurrentYear[numSpace].resize(pSize);
152 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
154 for (
unsigned int i = 0; i != pSize; ++i)
156 pValuesForTheCurrentYear[numSpace][i].initializeFromStudy(*study);
160 for (
unsigned int i = 0; i != pSize; ++i)
172 NextType::initializeFromArea(study, area);
175 size_t getMaxNumberColumns()
const
183 NextType::initializeFromAreaLink(study, link);
186 void simulationBegin()
189 NextType::simulationBegin();
194 NextType::simulationEnd();
197 void yearBegin(
unsigned int year,
unsigned int numSpace)
200 for (
unsigned int i = 0; i != pSize; ++i)
202 pValuesForTheCurrentYear[numSpace][i].reset();
206 NextType::yearBegin(year, numSpace);
209 void yearEndBuildPrepareDataForEachThermalCluster(
State& state,
211 unsigned int numSpace)
213 for (
unsigned int i = 0; i <= state.study.runtime.rangeLimits.hour[Data::rangeEnd]; ++i)
215 state.thermalClusterDispatchedUnitsCountForYear[i] +=
static_cast<uint
>(
216 pValuesForTheCurrentYear[numSpace][state.thermalCluster->enabledIndex].hour[i]);
220 NextType::yearEndBuildPrepareDataForEachThermalCluster(state, year, numSpace);
223 void yearEndBuildForEachThermalCluster(
State& state, uint year,
unsigned int numSpace)
226 for (
unsigned int i = state.study.runtime.rangeLimits.hour[Data::rangeBegin];
227 i <= state.study.runtime.rangeLimits.hour[Data::rangeEnd];
230 pValuesForTheCurrentYear[numSpace][state.thermalCluster->enabledIndex].hour[i]
231 = state.thermalClusterDispatchedUnitsCountForYear[i];
235 NextType::yearEndBuildForEachThermalCluster(state, year, numSpace);
238 void yearEndBuild(
State& state,
unsigned int year,
unsigned int numSpace)
241 NextType::yearEndBuild(state, year, numSpace);
244 void yearEnd(
unsigned int year,
unsigned int numSpace)
248 for (
unsigned int i = 0; i < pSize; ++i)
251 pValuesForTheCurrentYear[numSpace][i].computeStatisticsForTheCurrentYear();
255 NextType::yearEnd(year, numSpace);
258 void computeSummary(
unsigned int year,
unsigned int numSpace)
260 for (
unsigned int i = 0; i < pSize; ++i)
267 NextType::computeSummary(year, numSpace);
270 void hourBegin(
unsigned int hourInTheYear)
273 NextType::hourBegin(hourInTheYear);
276 void hourForEachArea(
State& state,
unsigned int numSpace)
278 auto area = state.area;
279 auto& thermal = state.thermal;
280 for (
auto& cluster: area->thermal.list.each_enabled())
282 pValuesForTheCurrentYear[numSpace][cluster->enabledIndex].hour[state.hourInTheYear]
283 = thermal[area->index].numberOfUnitsONbyCluster[cluster->enabledIndex];
287 NextType::hourForEachArea(state, numSpace);
290 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
292 unsigned int numSpace)
const
294 return pValuesForTheCurrentYear[numSpace][0].hour;
297 void localBuildAnnualSurveyReport(SurveyResults&
results,
300 unsigned int numSpace)
const
303 results.isCurrentVarNA = AncestorType::isNonApplicable;
305 if (AncestorType::isPrinted[0])
307 assert(NULL !=
results.data.area);
308 const auto& thermal =
results.data.area->thermal;
311 for (
auto& cluster: thermal.list.each_enabled())
314 results.variableCaption = cluster->name();
316 pValuesForTheCurrentYear[numSpace][cluster->enabledIndex]
317 .template buildAnnualSurveyReport<VCardType>(
results, fileLevel, precision);
324 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
326 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 OperatingCost emissions expected from all the thermal dispatchable ...
Definition: nbOfDispatchedUnitsByPlant.h:92
NextT NextType
Type of the next static variable.
Definition: nbOfDispatchedUnitsByPlant.h:95
Variable::IVariable< NbOfDispatchedUnitsByPlant< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition: nbOfDispatchedUnitsByPlant.h:99
@ count
How many items have we got.
Definition: nbOfDispatchedUnitsByPlant.h:109
VCardType::ResultsType ResultsType
List of expected results.
Definition: nbOfDispatchedUnitsByPlant.h:102
VCardNbOfDispatchedUnitsByPlant VCardType
VCard.
Definition: nbOfDispatchedUnitsByPlant.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: nbOfDispatchedUnitsByPlant.h:114
Definition: nbOfDispatchedUnitsByPlant.h:29
static std::string Caption()
Caption.
Definition: nbOfDispatchedUnitsByPlant.h:31
static constexpr int columnCount
Number of columns used by the variable.
Definition: nbOfDispatchedUnitsByPlant.h:68
static std::string Unit()
Unit.
Definition: nbOfDispatchedUnitsByPlant.h:37
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition: nbOfDispatchedUnitsByPlant.h:70
VCardNbOfDispatchedUnitsByPlant VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition: nbOfDispatchedUnitsByPlant.h:54
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition: nbOfDispatchedUnitsByPlant.h:74
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition: nbOfDispatchedUnitsByPlant.h:59
static std::string Description()
The short description of the variable.
Definition: nbOfDispatchedUnitsByPlant.h:43
Results< R::AllYears::Average< > > ResultsType
The expected results.
Definition: nbOfDispatchedUnitsByPlant.h:51
static constexpr uint8_t precision
Precision (views)
Definition: nbOfDispatchedUnitsByPlant.h:62
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition: nbOfDispatchedUnitsByPlant.h:64
static constexpr uint8_t categoryDataLevel
Data Level.
Definition: nbOfDispatchedUnitsByPlant.h:57
static constexpr uint8_t decimal
Decimal precision.
Definition: nbOfDispatchedUnitsByPlant.h:66
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition: nbOfDispatchedUnitsByPlant.h:76