21 #ifndef __SOLVER_VARIABLE_ECONOMY_DispatchableGenMargin_H__
22 #define __SOLVER_VARIABLE_ECONOMY_DispatchableGenMargin_H__
24 #include <antares/study/area/scratchpad.h>
25 #include "antares/solver/variable/variable.h"
27 namespace Antares::Solver::Variable::Economy
46 return "Dispatchable Generation Margin";
64 & (Category::FileLevel::id
65 | Category::FileLevel::va);
76 static constexpr uint8_t spatialAggregateMode = Category::spatialAggregateEachYear;
77 static constexpr uint8_t spatialAggregatePostProcessing = 0;
84 typedef std::vector<IntermediateValues> IntermediateValuesType;
86 using IntermediateValuesTypeForSpatialAg = std::unique_ptr<IntermediateValuesBaseType[]>;
93 template<
class NextT = Container::EndOfList>
95 :
public Variable::IVariable<DispatchableGenMargin<NextT>, NextT, VCardDispatchableGenMargin>
116 template<
int CDataLevel,
int CFile>
132 pNbYearsParallel = study.maxNbYearsInParallel;
138 pValuesForTheCurrentYear.resize(pNbYearsParallel);
139 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
141 pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
145 NextType::initializeFromStudy(study);
151 VariableAccessorType::InitializeAndReset(
results, study);
158 NextType::initializeFromArea(study, area);
164 NextType::initializeFromAreaLink(study, link);
167 void simulationBegin()
169 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
171 pValuesForTheCurrentYear[numSpace].reset();
175 NextType::simulationBegin();
180 NextType::simulationEnd();
183 void yearBegin(
unsigned int year,
unsigned int numSpace)
185 pValuesForTheCurrentYear[numSpace].reset();
188 NextType::yearBegin(year, numSpace);
191 void yearEndBuild(
State& state,
unsigned int year,
unsigned int numSpace)
194 NextType::yearEndBuild(state, year, numSpace);
197 void yearEnd(
unsigned int year,
unsigned int numSpace)
200 pValuesForTheCurrentYear[numSpace].computeStatisticsForTheCurrentYear();
203 NextType::yearEnd(year, numSpace);
206 void computeSummary(
unsigned int year,
unsigned int numSpace)
212 NextType::computeSummary(year, numSpace);
215 void hourBegin(
unsigned int hourInTheYear)
218 NextType::hourBegin(hourInTheYear);
221 void hourForEachArea(
State& state,
unsigned int numSpace)
223 pValuesForTheCurrentYear[numSpace][state.hourInTheYear] += state.scratchpad
224 ->dispatchableGenerationMargin
225 [state.hourInTheWeek];
227 NextType::hourForEachArea(state, numSpace);
230 template<
class VCardToFindT>
231 inline const double* retrieveHourlyResultsForCurrentYear(
unsigned int numSpace)
const
233 typedef RetrieveResultsAssignment<
234 Yuni::Static::Type::StrictlyEqual<VCardType, VCardToFindT>::Yes>
236 return (AssignT::Yes)
237 ? Memory::RawPointer(pValuesForTheCurrentYear[numSpace].hour)
238 :
NextType::template retrieveHourlyResultsForCurrentYear<VCardToFindT>(numSpace);
241 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
243 unsigned int numSpace)
const
245 return pValuesForTheCurrentYear[numSpace].hour;
248 void localBuildAnnualSurveyReport(SurveyResults&
results,
251 unsigned int numSpace)
const
254 results.isCurrentVarNA = AncestorType::isNonApplicable;
256 if (AncestorType::isPrinted[0])
261 pValuesForTheCurrentYear[numSpace]
262 .template buildAnnualSurveyReport<VCardType>(
results, fileLevel, precision);
268 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
270 unsigned int pNbYearsParallel;
Definition of a link between two areas (Interconnection)
Definition: links.h:58
Definition for a single area.
Definition: area.h:51
Marginal DispatchableGenMargin.
Definition: dispatchable-generation-margin.h:96
NextT NextType
Type of the next static variable.
Definition: dispatchable-generation-margin.h:99
@ count
How many items have we got.
Definition: dispatchable-generation-margin.h:113
Variable::IVariable< DispatchableGenMargin< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition: dispatchable-generation-margin.h:103
VCardDispatchableGenMargin VCardType
VCard.
Definition: dispatchable-generation-margin.h:101
VCardType::ResultsType ResultsType
List of expected results.
Definition: dispatchable-generation-margin.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: dispatchable-generation-margin.h:118
Definition: dispatchable-generation-margin.h:30
static constexpr int columnCount
Number of columns used by the variable (One ResultsType per column)
Definition: dispatchable-generation-margin.h:73
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition: dispatchable-generation-margin.h:75
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition: dispatchable-generation-margin.h:63
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition: dispatchable-generation-margin.h:79
static std::string Caption()
Caption.
Definition: dispatchable-generation-margin.h:32
static constexpr uint8_t decimal
Decimal precision.
Definition: dispatchable-generation-margin.h:71
static std::string Unit()
Unit.
Definition: dispatchable-generation-margin.h:38
static std::string Description()
The short description of the variable.
Definition: dispatchable-generation-margin.h:44
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition: dispatchable-generation-margin.h:69
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition: dispatchable-generation-margin.h:81
static constexpr uint8_t categoryDataLevel
Data Level.
Definition: dispatchable-generation-margin.h:61
VCardDispatchableGenMargin VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition: dispatchable-generation-margin.h:58
Results< R::AllYears::Average< R::AllYears::StdDeviation< R::AllYears::Min< R::AllYears::Max< > > > > > ResultsType
The expecte results.
Definition: dispatchable-generation-margin.h:55
static constexpr uint8_t precision
Precision (views)
Definition: dispatchable-generation-margin.h:67
Definition: stdDeviation.h:33