21 #ifndef __SOLVER_VARIABLE_ECONOMY_ProductionByDispatchablePlant_H__
22 #define __SOLVER_VARIABLE_ECONOMY_ProductionByDispatchablePlant_H__
24 #include "antares/solver/variable/variable.h"
26 namespace Antares::Solver::Variable::Economy
33 return "DTG by plant";
45 return "Energy generated by all the clusters";
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;
87 template<
class NextT = Container::EndOfList>
90 IVariable<ProductionByDispatchablePlant<NextT>, NextT, VCardProductionByDispatchablePlant>
112 template<
int CDataLevel,
int CFile>
127 pminOfTheClusterForYear(nullptr),
134 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
136 delete[] pminOfTheClusterForYear[numSpace];
138 delete[] pminOfTheClusterForYear;
144 NextType::initializeFromStudy(study);
150 pNbYearsParallel = study->maxNbYearsInParallel;
151 pValuesForTheCurrentYear.resize(pNbYearsParallel);
152 pminOfTheClusterForYear =
new double*[pNbYearsParallel];
155 pSize = area->thermal.list.enabledCount();
160 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
162 pValuesForTheCurrentYear[numSpace].resize(pSize);
169 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
171 pminOfTheClusterForYear[numSpace] =
new double[pSize * HOURS_PER_YEAR];
174 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
176 for (
unsigned int i = 0; i != pSize; ++i)
178 pValuesForTheCurrentYear[numSpace][i].initializeFromStudy(*study);
182 for (
unsigned int i = 0; i != pSize; ++i)
190 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
192 pminOfTheClusterForYear[numSpace] =
nullptr;
198 NextType::initializeFromArea(study, area);
201 size_t getMaxNumberColumns()
const
209 NextType::initializeFromAreaLink(study, link);
212 void simulationBegin()
215 NextType::simulationBegin();
220 NextType::simulationEnd();
223 void yearBegin(
unsigned int year,
unsigned int numSpace)
226 for (
unsigned int i = 0; i != pSize; ++i)
228 pValuesForTheCurrentYear[numSpace][i].reset();
230 for (
unsigned int j = 0; j != HOURS_PER_YEAR; ++j)
232 pminOfTheClusterForYear[numSpace][i * HOURS_PER_YEAR + j] = 0;
236 NextType::yearBegin(year, numSpace);
239 void yearEndBuildPrepareDataForEachThermalCluster(
State& state,
241 unsigned int numSpace)
243 for (
unsigned int i = 0; i <= state.study.runtime.rangeLimits.hour[Data::rangeEnd]; ++i)
245 state.thermalClusterProductionForYear[i] += pValuesForTheCurrentYear
247 [state.thermalCluster->enabledIndex]
249 state.thermalClusterPMinOfTheClusterForYear[i] += pminOfTheClusterForYear
250 [numSpace][(state.thermalCluster->enabledIndex * HOURS_PER_YEAR) + i];
254 NextType::yearEndBuildPrepareDataForEachThermalCluster(state, year, numSpace);
257 void yearEndBuild(
State& state,
unsigned int year,
unsigned int numSpace)
260 NextType::yearEndBuild(state, year, numSpace);
263 void yearEnd(
unsigned int year,
unsigned int numSpace)
267 for (
unsigned int i = 0; i < pSize; ++i)
270 pValuesForTheCurrentYear[numSpace][i].computeStatisticsForTheCurrentYear();
274 NextType::yearEnd(year, numSpace);
277 void computeSummary(
unsigned int year,
unsigned int numSpace)
279 for (
unsigned int i = 0; i < pSize; ++i)
286 NextType::computeSummary(year, numSpace);
289 void hourBegin(
unsigned int hourInTheYear)
292 NextType::hourBegin(hourInTheYear);
295 void hourForEachArea(
State& state,
unsigned int numSpace)
297 auto& area = state.area;
298 auto& thermal = state.thermal;
299 for (
auto& cluster: area->thermal.list.each_enabled())
302 pValuesForTheCurrentYear[numSpace][cluster->enabledIndex].hour[state.hourInTheYear]
303 += thermal[area->index].thermalClustersProductions[cluster->enabledIndex];
305 pminOfTheClusterForYear[numSpace]
306 [(cluster->enabledIndex * HOURS_PER_YEAR) + state.hourInTheYear]
307 = thermal[area->index].PMinOfClusters[cluster->enabledIndex];
311 NextType::hourForEachArea(state, numSpace);
314 inline void buildDigest(SurveyResults& results,
int digestLevel,
int dataLevel)
const
317 NextType::buildDigest(results, digestLevel, dataLevel);
320 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
322 unsigned int numSpace)
const
324 return pValuesForTheCurrentYear[numSpace][column].hour;
327 void localBuildAnnualSurveyReport(SurveyResults& results,
330 unsigned int numSpace)
const
333 results.isCurrentVarNA = AncestorType::isNonApplicable;
335 if (AncestorType::isPrinted[0])
337 assert(NULL != results.data.area);
338 const auto& thermal = results.data.area->thermal;
341 for (
auto& cluster: thermal.list.each_enabled())
344 results.variableCaption = cluster->name();
346 pValuesForTheCurrentYear[numSpace][cluster->enabledIndex]
347 .template buildAnnualSurveyReport<VCardType>(results, fileLevel, precision);
354 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
355 double** pminOfTheClusterForYear;
357 unsigned int pNbYearsParallel;
Definition of a link between two areas (Interconnection)
Definition: links.h:58
Definition for a single area.
Definition: area.h:51
Energy generated by all thermal dispatchable clusters.
Definition: productionByDispatchablePlant.h:91
@ count
How many items have we got.
Definition: productionByDispatchablePlant.h:109
NextT NextType
Type of the next static variable.
Definition: productionByDispatchablePlant.h:94
VCardProductionByDispatchablePlant VCardType
VCard.
Definition: productionByDispatchablePlant.h:96
Variable::IVariable< ProductionByDispatchablePlant< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition: productionByDispatchablePlant.h:99
VCardType::ResultsType ResultsType
List of expected results.
Definition: productionByDispatchablePlant.h:102
Interface for any variable.
Definition: variable.h:47
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: variable.h:25
Definition: productionByDispatchablePlant.h:114
Definition: productionByDispatchablePlant.h:29
static std::string Description()
The short description of the variable.
Definition: productionByDispatchablePlant.h:43
static constexpr uint8_t categoryDataLevel
Data Level.
Definition: productionByDispatchablePlant.h:57
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition: productionByDispatchablePlant.h:59
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition: productionByDispatchablePlant.h:76
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition: productionByDispatchablePlant.h:74
static std::string Caption()
Caption.
Definition: productionByDispatchablePlant.h:31
static constexpr uint8_t precision
Precision (views)
Definition: productionByDispatchablePlant.h:62
VCardProductionByDispatchablePlant VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition: productionByDispatchablePlant.h:54
static constexpr uint8_t decimal
Decimal precision.
Definition: productionByDispatchablePlant.h:66
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition: productionByDispatchablePlant.h:70
static constexpr int columnCount
Number of columns used by the variable.
Definition: productionByDispatchablePlant.h:68
static std::string Unit()
Unit.
Definition: productionByDispatchablePlant.h:37
Results< R::AllYears::Average< > > ResultsType
The expecte results.
Definition: productionByDispatchablePlant.h:51
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition: productionByDispatchablePlant.h:64