23 #include "antares/solver/variable/variable.h"
25 namespace Antares::Solver::Variable::Economy
28 constexpr
double eps = 1e-2;
29 constexpr
double margin = 5.;
48 return "Near Price Cap Hours";
66 & (Category::FileLevel::id
67 | Category::FileLevel::va);
77 static constexpr uint8_t
spatialAggregate = Category::spatialAggregateSumThen1IfPositive;
78 static constexpr uint8_t spatialAggregateMode = Category::spatialAggregateEachYear;
79 static constexpr uint8_t spatialAggregatePostProcessing = 0;
86 typedef std::vector<IntermediateValues> IntermediateValuesType;
88 using IntermediateValuesTypeForSpatialAg = std::unique_ptr<IntermediateValuesBaseType[]>;
95 template<
class NextT = Container::EndOfList>
117 template<
int CDataLevel,
int CFile>
133 pNbYearsParallel = study.maxNbYearsInParallel;
137 pValuesForTheCurrentYear.resize(pNbYearsParallel);
138 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
140 pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
143 NextType::initializeFromStudy(study);
149 VariableAccessorType::InitializeAndReset(
results, study);
154 unsuppliedEnergyCost = area->thermal.unsuppliedEnergyCost;
156 NextType::initializeFromArea(study, area);
159 void simulationBegin()
161 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
163 pValuesForTheCurrentYear[numSpace].reset();
165 NextType::simulationBegin();
168 void yearBegin(
unsigned int year,
unsigned int numSpace)
171 pValuesForTheCurrentYear[numSpace].reset();
173 NextType::yearBegin(year, numSpace);
176 void yearEndBuild(
State& state,
unsigned int year,
unsigned int numSpace)
178 NextType::yearEndBuild(state, year, numSpace);
181 void yearEnd(
unsigned int year,
unsigned int numSpace)
185 pValuesForTheCurrentYear[numSpace].computeStatisticsForTheCurrentYear();
187 NextType::yearEnd(year, numSpace);
190 void computeSummary(
unsigned int year,
unsigned int numSpace)
196 NextType::computeSummary(year, numSpace);
199 void hourForEachArea(
State& state,
unsigned int numSpace)
201 double mrgPrice = -state.hourlyResults->CoutsMarginauxHoraires[state.hourInTheWeek];
202 if (mrgPrice > unsuppliedEnergyCost - margin + eps)
204 pValuesForTheCurrentYear[numSpace][state.hourInTheYear] = 1.;
206 NextType::hourForEachArea(state, numSpace);
209 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
211 unsigned int numSpace)
const
213 return pValuesForTheCurrentYear[numSpace].hour;
216 void localBuildAnnualSurveyReport(SurveyResults&
results,
219 unsigned int numSpace)
const
222 results.isCurrentVarNA = AncestorType::isNonApplicable;
224 if (AncestorType::isPrinted[0])
229 pValuesForTheCurrentYear[numSpace]
230 .template buildAnnualSurveyReport<VCardType>(
results, fileLevel, precision);
236 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
237 unsigned int pNbYearsParallel;
238 double unsuppliedEnergyCost = 0.;
Definition for a single area.
Definition: area.h:51
Definition: nearPriceCap.h:97
NextT NextType
Type of the next static variable.
Definition: nearPriceCap.h:100
Variable::IVariable< NearPriceCap< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition: nearPriceCap.h:104
VCardType::ResultsType ResultsType
List of expected results.
Definition: nearPriceCap.h:107
VCardNearPriceCap VCardType
VCard.
Definition: nearPriceCap.h:102
@ count
How many items have we got.
Definition: nearPriceCap.h:114
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: nearPriceCap.h:119
Definition: nearPriceCap.h:32
static std::string Caption()
Caption.
Definition: nearPriceCap.h:34
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition: nearPriceCap.h:81
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition: nearPriceCap.h:83
static std::string Description()
The short description of the variable.
Definition: nearPriceCap.h:46
static constexpr int columnCount
Number of columns used by the variable (One ResultsType per column)
Definition: nearPriceCap.h:75
static constexpr uint8_t categoryDataLevel
Data Level.
Definition: nearPriceCap.h:63
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition: nearPriceCap.h:65
static constexpr uint8_t decimal
Decimal precision.
Definition: nearPriceCap.h:73
static std::string Unit()
Unit.
Definition: nearPriceCap.h:40
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition: nearPriceCap.h:71
VCardNearPriceCap VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition: nearPriceCap.h:60
Results< R::AllYears::Average< R::AllYears::StdDeviation< R::AllYears::Min< R::AllYears::Max< > > > > > ResultsType
The expecte results.
Definition: nearPriceCap.h:57
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition: nearPriceCap.h:77
static constexpr uint8_t precision
Precision (views)
Definition: nearPriceCap.h:69
Definition: stdDeviation.h:33