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"
52 return "Dispatchable Generation Margin";
70 & (Category::FileLevel::id
71 | Category::FileLevel::va);
82 static constexpr uint8_t spatialAggregateMode = Category::spatialAggregateEachYear;
83 static constexpr uint8_t spatialAggregatePostProcessing = 0;
90 typedef std::vector<IntermediateValues> IntermediateValuesType;
99template<
class NextT = Container::EndOfList>
101 :
public Variable::IVariable<DispatchableGenMargin<NextT>, NextT, VCardDispatchableGenMargin>
122 template<
int CDataLevel,
int CFile>
138 pNbYearsParallel = study.maxNbYearsInParallel;
144 pValuesForTheCurrentYear.resize(pNbYearsParallel);
145 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
147 pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
151 NextType::initializeFromStudy(study);
157 VariableAccessorType::InitializeAndReset(
results, study);
164 NextType::initializeFromArea(study, area);
170 NextType::initializeFromAreaLink(study, link);
173 void simulationBegin()
175 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
177 pValuesForTheCurrentYear[numSpace].reset();
181 NextType::simulationBegin();
186 NextType::simulationEnd();
189 void yearBegin(
unsigned int year,
unsigned int numSpace)
191 pValuesForTheCurrentYear[numSpace].reset();
194 NextType::yearBegin(year, numSpace);
197 void yearEndBuild(
State& state,
unsigned int year,
unsigned int numSpace)
200 NextType::yearEndBuild(state, year, numSpace);
203 void yearEnd(
unsigned int year,
unsigned int numSpace)
206 pValuesForTheCurrentYear[numSpace].computeStatisticsForTheCurrentYear();
209 NextType::yearEnd(year, numSpace);
212 void computeSummary(std::map<unsigned int, unsigned int>& numSpaceToYear,
213 unsigned int nbYearsForCurrentSummary)
215 for (
unsigned int numSpace = 0; numSpace < nbYearsForCurrentSummary; ++numSpace)
219 pValuesForTheCurrentYear[numSpace]);
223 NextType::computeSummary(numSpaceToYear, nbYearsForCurrentSummary);
226 void hourBegin(
unsigned int hourInTheYear)
229 NextType::hourBegin(hourInTheYear);
232 void hourForEachArea(
State& state,
unsigned int numSpace)
234 pValuesForTheCurrentYear[numSpace][state.hourInTheYear] += state.scratchpad
235 ->dispatchableGenerationMargin
236 [state.hourInTheWeek];
238 NextType::hourForEachArea(state, numSpace);
241 template<
class VCardToFindT>
242 inline const double* retrieveHourlyResultsForCurrentYear(
unsigned int numSpace)
const
244 typedef RetrieveResultsAssignment<
245 Yuni::Static::Type::StrictlyEqual<VCardType, VCardToFindT>::Yes>
247 return (AssignT::Yes)
248 ? Memory::RawPointer(pValuesForTheCurrentYear[numSpace].hour)
249 :
NextType::template retrieveHourlyResultsForCurrentYear<VCardToFindT>(numSpace);
252 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
254 unsigned int numSpace)
const
256 return pValuesForTheCurrentYear[numSpace].hour;
259 void localBuildAnnualSurveyReport(SurveyResults&
results,
262 unsigned int numSpace)
const
265 results.isCurrentVarNA = AncestorType::isNonApplicable;
267 if (AncestorType::isPrinted[0])
272 pValuesForTheCurrentYear[numSpace]
273 .template buildAnnualSurveyReport<VCardType>(
results, fileLevel, precision);
279 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
281 unsigned int pNbYearsParallel;
Definition of a link between two areas (Interconnection)
Definition links.h:50
Definition for a single area.
Definition area.h:52
Marginal DispatchableGenMargin.
Definition dispatchable-generation-margin.h:102
NextT NextType
Type of the next static variable.
Definition dispatchable-generation-margin.h:105
Variable::IVariable< DispatchableGenMargin< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition dispatchable-generation-margin.h:109
VCardDispatchableGenMargin VCardType
VCard.
Definition dispatchable-generation-margin.h:107
VCardType::ResultsType ResultsType
List of expected results.
Definition dispatchable-generation-margin.h:112
@ count
How many items have we got.
Definition dispatchable-generation-margin.h:119
Interface for any variable.
Definition variable.h:51
const StoredResultType & results() const
Definition variable.hxx:544
StoredResultType pResults
All the results about this variable.
Definition variable.h:327
@ count
The count if item in the list.
Definition results.h:56
Definition cbuilder.h:120
Definition dispatchable-generation-margin.h:124
Definition dispatchable-generation-margin.h:36
static constexpr int columnCount
Number of columns used by the variable (One ResultsType per column)
Definition dispatchable-generation-margin.h:79
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition dispatchable-generation-margin.h:81
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition dispatchable-generation-margin.h:69
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition dispatchable-generation-margin.h:85
static std::string Caption()
Caption.
Definition dispatchable-generation-margin.h:38
Results< R::AllYears::Average< R::AllYears::StdDeviation< R::AllYears::Min< R::AllYears::Max< > > > > > ResultsType
The expecte results.
Definition dispatchable-generation-margin.h:61
static constexpr uint8_t decimal
Decimal precision.
Definition dispatchable-generation-margin.h:77
static std::string Unit()
Unit.
Definition dispatchable-generation-margin.h:44
static std::string Description()
The short description of the variable.
Definition dispatchable-generation-margin.h:50
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition dispatchable-generation-margin.h:75
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition dispatchable-generation-margin.h:87
static constexpr uint8_t categoryDataLevel
Data Level.
Definition dispatchable-generation-margin.h:67
static constexpr uint8_t precision
Precision (views)
Definition dispatchable-generation-margin.h:73
VCardDispatchableGenMargin VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition dispatchable-generation-margin.h:64
Definition stdDeviation.h:40