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"
27namespace 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 typedef IntermediateValuesBaseType* IntermediateValuesTypeForSpatialAg;
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)
110template<
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(std::map<unsigned int, unsigned int>& numSpaceToYear,
232 unsigned int nbYearsForCurrentSummary)
234 for (
unsigned int numSpace = 0; numSpace < nbYearsForCurrentSummary; ++numSpace)
236 VariableAccessorType::ComputeSummary(pValuesForTheCurrentYear[numSpace],
238 numSpaceToYear[numSpace]);
241 NextType::computeSummary(numSpaceToYear, nbYearsForCurrentSummary);
244 void hourBegin(
unsigned int hourInTheYear)
247 NextType::hourBegin(hourInTheYear);
250 void hourForEachArea(
State& state,
unsigned int numSpace)
252 auto area = state.area;
253 auto& thermal = state.thermal;
254 for (
auto& cluster: area->thermal.list.each_enabled())
257 for (
int pollutant = 0; pollutant < Antares::Data::Pollutant::POLLUTANT_MAX;
260 pValuesForTheCurrentYear[numSpace][pollutant][state.hourInTheYear]
261 += cluster->emissions.factors[pollutant]
262 * thermal[state.area->index].thermalClustersProductions[cluster->enabledIndex];
267 NextType::hourForEachArea(state, numSpace);
270 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
272 unsigned int numSpace)
const
274 return pValuesForTheCurrentYear[numSpace][column].hour;
277 void localBuildAnnualSurveyReport(SurveyResults&
results,
280 unsigned int numSpace)
const
283 results.isCurrentVarNA = AncestorType::isNonApplicable;
287 if (AncestorType::isPrinted[i])
292 pValuesForTheCurrentYear[numSpace][i]
293 .template buildAnnualSurveyReport<VCardType>(
results, fileLevel, precision);
301 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
302 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 ThermalAirPollutantEmissions.
Definition thermalAirPollutantEmissions.h:114
VCardThermalAirPollutantEmissions VCardType
VCard.
Definition thermalAirPollutantEmissions.h:119
NextT NextType
Type of the next static variable.
Definition thermalAirPollutantEmissions.h:117
VCardType::ResultsType ResultsType
List of expected results.
Definition thermalAirPollutantEmissions.h:124
@ count
How many items have we got.
Definition thermalAirPollutantEmissions.h:131
Variable::IVariable< ThermalAirPollutantEmissions< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition thermalAirPollutantEmissions.h:121
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 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
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 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
static constexpr uint8_t categoryDataLevel
Data Level.
Definition thermalAirPollutantEmissions.h:61
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition thermalAirPollutantEmissions.h:75
VCardThermalAirPollutantEmissions VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition thermalAirPollutantEmissions.h:58
static std::string Caption()
Caption not used: several columns.
Definition thermalAirPollutantEmissions.h:32
static constexpr uint8_t decimal
Decimal precision.
Definition thermalAirPollutantEmissions.h:71
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition thermalAirPollutantEmissions.h:63
Definition stdDeviation.h:40