23 #include "antares/solver/variable/variable.h"
25 namespace Antares::Solver::Variable::Economy
32 return "STS Cashflow By Cluster";
38 return "CashFlow - Euro";
44 return "Cash Flow by short term storage";
59 & Category::FileLevel::de_sts;
70 static constexpr uint8_t spatialAggregateMode = Category::spatialAggregateEachYear;
71 static constexpr uint8_t spatialAggregatePostProcessing = 0;
78 typedef std::vector<IntermediateValues> IntermediateValuesBaseType;
79 typedef std::vector<IntermediateValuesBaseType> IntermediateValuesType;
86 template<
class NextT = Container::EndOfList>
89 VCardSTstorageCashFlowByCluster>
104 static constexpr
int count = 1 + NextT::count;
106 template<
int CDataLevel,
int CFile>
125 pNbYearsParallel = study->maxNbYearsInParallel;
126 pValuesForTheCurrentYear.resize(pNbYearsParallel);
129 nbClusters_ = area->shortTermStorage.count();
134 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
136 pValuesForTheCurrentYear[numSpace].resize(nbClusters_);
139 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
141 for (
unsigned int i = 0; i != nbClusters_; ++i)
143 pValuesForTheCurrentYear[numSpace][i].initializeFromStudy(*study);
147 for (
unsigned int i = 0; i != nbClusters_; ++i)
158 NextType::initializeFromArea(study, area);
161 size_t getMaxNumberColumns()
const
166 void yearBegin(
unsigned int year,
unsigned int numSpace)
169 for (
unsigned int clusterIndex = 0; clusterIndex != nbClusters_; ++clusterIndex)
171 pValuesForTheCurrentYear[numSpace][clusterIndex].reset();
174 NextType::yearBegin(year, numSpace);
177 void yearEnd(
unsigned int year,
unsigned int numSpace)
179 for (
unsigned int clusterIndex = 0; clusterIndex < nbClusters_; ++clusterIndex)
183 pValuesForTheCurrentYear[numSpace][clusterIndex].computeStatisticsForTheCurrentYear();
186 NextType::yearEnd(year, numSpace);
189 void computeSummary(
unsigned int year,
unsigned int numSpace)
191 for (
unsigned int clusterIndex = 0; clusterIndex < nbClusters_; ++clusterIndex)
195 .merge(year, pValuesForTheCurrentYear[numSpace][clusterIndex]);
199 NextType::computeSummary(year, numSpace);
202 void hourBegin(
unsigned int hourInTheYear)
205 NextType::hourBegin(hourInTheYear);
208 void hourForEachArea(
State& state,
unsigned int numSpace)
210 unsigned int hourInYear = state.hourInTheYear;
211 for (uint clusterIndex = 0; clusterIndex != state.area->shortTermStorage.count();
214 const auto& stsHourlyResults = state.hourlyResults->ShortTermStorage[clusterIndex];
217 pValuesForTheCurrentYear[numSpace][clusterIndex].hour[hourInYear]
218 = (stsHourlyResults.withdrawal[state.hourInTheWeek]
219 - stsHourlyResults.injection[state.hourInTheWeek])
220 * (-state.hourlyResults->CoutsMarginauxHoraires[state.hourInTheWeek]);
225 NextType::hourForEachArea(state, numSpace);
228 inline void buildDigest(SurveyResults&
results,
int digestLevel,
int dataLevel)
const
231 NextType::buildDigest(
results, digestLevel, dataLevel);
234 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
236 unsigned int numSpace)
const
238 return pValuesForTheCurrentYear[numSpace][column].hour;
241 void localBuildAnnualSurveyReport(SurveyResults&
results,
244 unsigned int numSpace)
const
247 results.isCurrentVarNA = AncestorType::isNonApplicable;
249 if (AncestorType::isPrinted[0])
251 assert(NULL !=
results.data.area);
252 const auto& shortTermStorage =
results.data.area->shortTermStorage;
255 uint clusterIndex = 0;
256 for (
const auto& sts: shortTermStorage.storagesByIndex)
259 results.variableCaption = sts.properties.name;
261 pValuesForTheCurrentYear[numSpace][clusterIndex]
262 .template buildAnnualSurveyReport<VCardType>(
results, fileLevel, precision);
271 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
272 size_t nbClusters_ = 0;
273 unsigned int pNbYearsParallel = 0;
Definition for a single area.
Definition: area.h:51
Energy generated by short term storage clusters.
Definition: STStorageCashFlowByCluster.h:90
VCardType::ResultsType ResultsType
List of expected results.
Definition: STStorageCashFlowByCluster.h:100
VCardSTstorageCashFlowByCluster VCardType
VCard.
Definition: STStorageCashFlowByCluster.h:95
NextT NextType
Type of the next static variable.
Definition: STStorageCashFlowByCluster.h:93
Variable::IVariable< STstorageCashFlowByCluster< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition: STStorageCashFlowByCluster.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: STStorageCashFlowByCluster.h:108
Definition: STStorageCashFlowByCluster.h:28
static constexpr int columnCount
Number of columns used by the variable.
Definition: STStorageCashFlowByCluster.h:67
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition: STStorageCashFlowByCluster.h:69
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition: STStorageCashFlowByCluster.h:73
static constexpr uint8_t decimal
Decimal precision.
Definition: STStorageCashFlowByCluster.h:65
VCardSTstorageCashFlowByCluster VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition: STStorageCashFlowByCluster.h:53
static constexpr uint8_t categoryDataLevel
Data Level.
Definition: STStorageCashFlowByCluster.h:56
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition: STStorageCashFlowByCluster.h:75
static std::string Unit()
Unit.
Definition: STStorageCashFlowByCluster.h:36
static std::string Caption()
Caption.
Definition: STStorageCashFlowByCluster.h:30
static std::string Description()
The short description of the variable.
Definition: STStorageCashFlowByCluster.h:42
static constexpr uint8_t precision
Precision (views)
Definition: STStorageCashFlowByCluster.h:61
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition: STStorageCashFlowByCluster.h:63
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition: STStorageCashFlowByCluster.h:58
Results< R::AllYears::Average< > > ResultsType
The expecte results.
Definition: STStorageCashFlowByCluster.h:50