24 #include "antares/solver/variable/variable.h"
26 namespace Antares::Solver::Variable::Economy
33 return "Profit by plant";
39 return "Profit - Euro";
45 return "Profit for thermal units";
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>
109 template<
int CDataLevel,
int CFile>
131 NextType::initializeFromStudy(study);
137 pNbYearsParallel = study->maxNbYearsInParallel;
138 pValuesForTheCurrentYear.resize(pNbYearsParallel);
141 pNbClustersOfArea = area->thermal.list.enabledCount();
142 if (pNbClustersOfArea)
145 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
147 pValuesForTheCurrentYear[numSpace].resize(pNbClustersOfArea);
150 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
152 for (
unsigned int i = 0; i != pNbClustersOfArea; ++i)
154 pValuesForTheCurrentYear[numSpace][i].initializeFromStudy(*study);
158 for (
unsigned int i = 0; i != pNbClustersOfArea; ++i)
170 NextType::initializeFromArea(study, area);
173 size_t getMaxNumberColumns()
const
181 NextType::initializeFromAreaLink(study, link);
184 void simulationBegin()
187 NextType::simulationBegin();
192 NextType::simulationEnd();
195 void yearBegin(
unsigned int year,
unsigned int numSpace)
198 for (
unsigned int i = 0; i != pNbClustersOfArea; ++i)
200 pValuesForTheCurrentYear[numSpace][i].reset();
204 NextType::yearBegin(year, numSpace);
207 void yearEndBuild(
State& state,
unsigned int year,
unsigned int numSpace)
210 NextType::yearEndBuild(state, year, numSpace);
213 void yearEnd(
unsigned int year,
unsigned int numSpace)
217 for (
unsigned int i = 0; i < pNbClustersOfArea; ++i)
220 pValuesForTheCurrentYear[numSpace][i].computeStatisticsForTheCurrentYear();
224 NextType::yearEnd(year, numSpace);
227 void computeSummary(
unsigned int year,
unsigned int numSpace)
229 for (
unsigned int clusterIndex = 0; clusterIndex < pNbClustersOfArea; ++clusterIndex)
233 .merge(year, pValuesForTheCurrentYear[numSpace][clusterIndex]);
237 NextType::computeSummary(year, numSpace);
240 void hourBegin(
unsigned int hourInTheYear)
243 NextType::hourBegin(hourInTheYear);
246 void hourForEachArea(
State& state,
unsigned int numSpace)
249 auto area = state.area;
250 auto& thermal = state.thermal;
251 const std::vector<double>& areaMarginalCosts = state.hourlyResults->CoutsMarginauxHoraires;
252 uint hourInTheWeek = state.hourInTheWeek;
253 uint hourInTheYear = state.hourInTheYear;
255 for (
auto& cluster: area->thermal.list.each_enabled())
257 double hourlyClusterProduction = thermal[area->index]
258 .thermalClustersProductions[cluster->enabledIndex];
259 uint tsIndex = cluster->series.timeseriesNumbers[state.year];
262 pValuesForTheCurrentYear[numSpace][cluster->enabledIndex].hour[hourInTheYear]
263 = std::max((hourlyClusterProduction - cluster->PthetaInf[hourInTheYear]), 0.)
264 * (-areaMarginalCosts[hourInTheWeek]
265 - cluster->getCostProvider().getMarginalCost(tsIndex, hourInTheYear));
269 NextType::hourForEachArea(state, numSpace);
272 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
274 unsigned int numSpace)
const
276 return pValuesForTheCurrentYear[numSpace][0].hour;
279 void localBuildAnnualSurveyReport(SurveyResults&
results,
282 unsigned int numSpace)
const
285 results.isCurrentVarNA = AncestorType::isNonApplicable;
287 if (AncestorType::isPrinted[0])
289 assert(NULL !=
results.data.area);
290 const auto& thermal =
results.data.area->thermal;
293 for (
auto& cluster: thermal.list.each_enabled())
296 results.variableCaption = cluster->name();
298 pValuesForTheCurrentYear[numSpace][cluster->enabledIndex]
299 .template buildAnnualSurveyReport<VCardType>(
results, fileLevel, precision);
306 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
307 size_t pNbClustersOfArea;
308 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: profitByPlant.h:89
VCardProfitByPlant VCardType
VCard.
Definition: profitByPlant.h:94
VCardType::ResultsType ResultsType
List of expected results.
Definition: profitByPlant.h:99
Variable::IVariable< ProfitByPlant< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition: profitByPlant.h:96
NextT NextType
Type of the next static variable.
Definition: profitByPlant.h:92
@ count
How many items have we got.
Definition: profitByPlant.h:106
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: profitByPlant.h:111
Definition: profitByPlant.h:29
VCardProfitByPlant VCardForSpatialAggregate
The VCard to look for calculating spatial aggregates.
Definition: profitByPlant.h:54
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition: profitByPlant.h:70
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition: profitByPlant.h:64
static constexpr uint8_t decimal
Decimal precision.
Definition: profitByPlant.h:66
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition: profitByPlant.h:74
static std::string Unit()
Unit.
Definition: profitByPlant.h:37
static constexpr uint8_t precision
Precision (views)
Definition: profitByPlant.h:62
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition: profitByPlant.h:59
static constexpr int columnCount
Number of columns used by the variable.
Definition: profitByPlant.h:68
static std::string Description()
The short description of the variable.
Definition: profitByPlant.h:43
Results< R::AllYears::Average< > > ResultsType
The expected results.
Definition: profitByPlant.h:51
static constexpr uint8_t categoryDataLevel
Data Level.
Definition: profitByPlant.h:57
static std::string Caption()
Caption.
Definition: profitByPlant.h:31
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition: profitByPlant.h:76