21 #ifndef __SOLVER_VARIABLE_ECONOMY_thermalAirPollutantEmissions_H__
22 #define __SOLVER_VARIABLE_ECONOMY_thermalAirPollutantEmissions_H__
24 #include <antares/study/study.h>
25 #include "antares/solver/variable/variable.h"
27 namespace Antares::Solver::Variable::Economy
46 return "Overall pollutant emissions expected from all the thermal clusters";
64 & (Category::FileLevel::id
65 | Category::FileLevel::va);
73 static constexpr
int columnCount = Antares::Data::Pollutant::POLLUTANT_MAX;
76 static constexpr uint8_t spatialAggregateMode = Category::spatialAggregateEachYear;
77 static constexpr uint8_t spatialAggregatePostProcessing = 0;
84 typedef IntermediateValuesBaseType* IntermediateValuesType;
86 using IntermediateValuesTypeForSpatialAg = std::unique_ptr<IntermediateValuesBaseType[]>;
90 static std::string Caption(
const unsigned int indx)
92 if (indx < Antares::Data::Pollutant::POLLUTANT_MAX)
94 return Antares::Data::Pollutant::getPollutantName(indx).c_str();
100 static std::string Unit([[maybe_unused]]
const unsigned int indx)
110 template<
class NextT = Container::EndOfList>
113 VCardThermalAirPollutantEmissions>
134 template<
int CDataLevel,
int CFile>
150 delete[] pValuesForTheCurrentYear;
155 pNbYearsParallel = study.maxNbYearsInParallel;
159 pValuesForTheCurrentYear =
new VCardType::IntermediateValuesBaseType[pNbYearsParallel];
160 for (
unsigned int numSpace = 0; numSpace < pNbYearsParallel; ++numSpace)
164 pValuesForTheCurrentYear[numSpace][i].initializeFromStudy(study);
169 NextType::initializeFromStudy(study);
177 results[i].initializeFromStudy(study);
185 NextType::initializeFromArea(study, area);
191 NextType::initializeFromAreaLink(study, link);
194 void simulationBegin()
197 NextType::simulationBegin();
202 NextType::simulationEnd();
205 void yearBegin(
unsigned int year,
unsigned int numSpace)
210 pValuesForTheCurrentYear[numSpace][i].reset();
213 NextType::yearBegin(year, numSpace);
216 void yearEndBuild(
State& state,
unsigned int year,
unsigned int numSpace)
219 NextType::yearEndBuild(state, year, numSpace);
222 void yearEnd(
unsigned int year,
unsigned int numSpace)
224 VariableAccessorType::template ComputeStatistics<VCardType>(
225 pValuesForTheCurrentYear[numSpace]);
228 NextType::yearEnd(year, numSpace);
231 void computeSummary(
unsigned int year,
unsigned int numSpace)
234 VariableAccessorType::ComputeSummary(pValuesForTheCurrentYear[numSpace],
239 NextType::computeSummary(year, numSpace);
242 void hourBegin(
unsigned int hourInTheYear)
245 NextType::hourBegin(hourInTheYear);
248 void hourForEachArea(
State& state,
unsigned int numSpace)
250 auto area = state.area;
251 auto& thermal = state.thermal;
252 for (
auto& cluster: area->thermal.list.each_enabled())
255 for (
int pollutant = 0; pollutant < Antares::Data::Pollutant::POLLUTANT_MAX;
258 pValuesForTheCurrentYear[numSpace][pollutant][state.hourInTheYear]
259 += cluster->emissions.factors[pollutant]
260 * thermal[state.area->index].thermalClustersProductions[cluster->enabledIndex];
265 NextType::hourForEachArea(state, numSpace);
268 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
270 unsigned int numSpace)
const
272 return pValuesForTheCurrentYear[numSpace][column].hour;
275 void localBuildAnnualSurveyReport(SurveyResults&
results,
278 unsigned int numSpace)
const
281 results.isCurrentVarNA = AncestorType::isNonApplicable;
285 if (AncestorType::isPrinted[i])
288 results.variableCaption = VCardType::Multiple::Caption(i);
289 results.variableUnit = VCardType::Multiple::Unit(i);
290 pValuesForTheCurrentYear[numSpace][i]
291 .template buildAnnualSurveyReport<VCardType>(
results, fileLevel, precision);
299 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
300 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 ThermalAirPollutantEmissions.
Definition: thermalAirPollutantEmissions.h:114
VCardType::ResultsType ResultsType
List of expected results.
Definition: thermalAirPollutantEmissions.h:124
NextT NextType
Type of the next static variable.
Definition: thermalAirPollutantEmissions.h:117
Variable::IVariable< ThermalAirPollutantEmissions< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition: thermalAirPollutantEmissions.h:121
VCardThermalAirPollutantEmissions VCardType
VCard.
Definition: thermalAirPollutantEmissions.h:119
@ count
How many items have we got.
Definition: thermalAirPollutantEmissions.h:131
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: thermalAirPollutantEmissions.h:136
Definition: thermalAirPollutantEmissions.h:89
Definition: thermalAirPollutantEmissions.h:30
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition: thermalAirPollutantEmissions.h:79
static std::string Description()
The short description of the variable.
Definition: thermalAirPollutantEmissions.h:44
static std::string Unit()
Unit.
Definition: thermalAirPollutantEmissions.h:38
static constexpr uint8_t precision
Precision (views)
Definition: thermalAirPollutantEmissions.h:67
static constexpr int columnCount
Number of columns used by the variable (One ResultsType per column)
Definition: thermalAirPollutantEmissions.h:73
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition: thermalAirPollutantEmissions.h:81
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition: thermalAirPollutantEmissions.h:69
Results< R::AllYears::Average< R::AllYears::StdDeviation< R::AllYears::Min< R::AllYears::Max< > > > > > ResultsType
The expecte results.
Definition: thermalAirPollutantEmissions.h:55
static constexpr uint8_t categoryDataLevel
Data Level.
Definition: thermalAirPollutantEmissions.h:61
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition: thermalAirPollutantEmissions.h:75
static std::string Caption()
Caption not used: several columns.
Definition: thermalAirPollutantEmissions.h:32
static constexpr uint8_t decimal
Decimal precision.
Definition: thermalAirPollutantEmissions.h:71
VCardThermalAirPollutantEmissions VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition: thermalAirPollutantEmissions.h:58
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition: thermalAirPollutantEmissions.h:63
Definition: stdDeviation.h:33