Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
nonProportionalCost.h
1/*
2** Copyright 2007-2024, RTE (https://www.rte-france.com)
3** See AUTHORS.txt
4** SPDX-License-Identifier: MPL-2.0
5** This file is part of Antares-Simulator,
6** Adequacy and Performance assessment for interconnected energy networks.
7**
8** Antares_Simulator is free software: you can redistribute it and/or modify
9** it under the terms of the Mozilla Public Licence 2.0 as published by
10** the Mozilla Foundation, either version 2 of the License, or
11** (at your option) any later version.
12**
13** Antares_Simulator is distributed in the hope that it will be useful,
14** but WITHOUT ANY WARRANTY; without even the implied warranty of
15** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16** Mozilla Public Licence 2.0 for more details.
17**
18** You should have received a copy of the Mozilla Public Licence 2.0
19** along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20*/
21#ifndef __SOLVER_VARIABLE_ECONOMY_NonProportionalCost_H__
22#define __SOLVER_VARIABLE_ECONOMY_NonProportionalCost_H__
23
24#include "antares/solver/variable/variable.h"
25
26namespace Antares
27{
28namespace Solver
29{
30namespace Variable
31{
32namespace Economy
33{
35{
37 static std::string Caption()
38 {
39 return "NP COST";
40 }
41
43 static std::string Unit()
44 {
45 return "Euro";
46 }
47
49 static std::string Description()
50 {
51 return "Non Proportional Cost throughout all MC years, of all the thermal dispatchable "
52 "clusters";
53 }
54
56 typedef Results<R::AllYears::Average< // The average values throughout all years
57 R::AllYears::StdDeviation< // The standard deviation values throughout all
58 // years
59 R::AllYears::Min< // The minimum values throughout all years
60 R::AllYears::Max< // The maximum values throughout all years
61 >>>>,
63 >
65
68
70 static constexpr uint8_t categoryDataLevel = Category::DataLevel::area;
72 static constexpr uint8_t categoryFileLevel = ResultsType::categoryFile
73 & (Category::FileLevel::id
74 | Category::FileLevel::va);
76 static constexpr uint8_t precision = Category::all;
78 static constexpr uint8_t nodeDepthForGUI = +0;
80 static constexpr uint8_t decimal = 0;
82 static constexpr int columnCount = 1;
84 static constexpr uint8_t spatialAggregate = Category::spatialAggregateSum;
85 static constexpr uint8_t spatialAggregateMode = Category::spatialAggregateEachYear;
86 static constexpr uint8_t spatialAggregatePostProcessing = 0;
88 static constexpr uint8_t hasIntermediateValues = 1;
90 static constexpr uint8_t isPossiblyNonApplicable = 0;
91
93 typedef std::vector<IntermediateValues> IntermediateValuesType;
94
96
97}; // class VCard
98
103template<class NextT = Container::EndOfList>
105 : public Variable::IVariable<NonProportionalCost<NextT>, NextT, VCardNonProportionalCost>
106{
107public:
109 typedef NextT NextType;
114
117
119
120 enum
121 {
123 count = 1 + NextT::count,
124 };
125
126 template<int CDataLevel, int CFile>
128 {
129 enum
130 {
131 count = ((VCardType::categoryDataLevel & CDataLevel
133 ? (NextType::template Statistics<CDataLevel, CFile>::count
135 : NextType::template Statistics<CDataLevel, CFile>::count),
136 };
137 };
138
139public:
140 void initializeFromStudy(Data::Study& study)
141 {
142 pNbYearsParallel = study.maxNbYearsInParallel;
143
144 InitializeResultsFromStudy(AncestorType::pResults, study);
145
146 pValuesForTheCurrentYear.resize(pNbYearsParallel);
147 for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
148 {
149 pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
150 }
151
152 // Next
153 NextType::initializeFromStudy(study);
154 }
155
156 template<class R>
157 static void InitializeResultsFromStudy(R& results, Data::Study& study)
158 {
159 VariableAccessorType::InitializeAndReset(results, study);
160 }
161
162 void initializeFromArea(Data::Study* study, Data::Area* area)
163 {
164 // Next
165 NextType::initializeFromArea(study, area);
166 }
167
168 void initializeFromLink(Data::Study* study, Data::AreaLink* link)
169 {
170 // Next
171 NextType::initializeFromAreaLink(study, link);
172 }
173
174 void simulationBegin()
175 {
176 // Next
177 NextType::simulationBegin();
178 }
179
180 void simulationEnd()
181 {
182 NextType::simulationEnd();
183 }
184
185 void yearBegin(unsigned int year, unsigned int numSpace)
186 {
187 // Reset the values for the current year
188 pValuesForTheCurrentYear[numSpace].reset();
189 // Next variable
190 NextType::yearBegin(year, numSpace);
191 }
192
193 void yearEndBuildForEachThermalCluster(State& state, uint year, unsigned int numSpace)
194 {
195 // Get end year calculations
196 for (unsigned int i = state.study.runtime.rangeLimits.hour[Data::rangeBegin];
197 i <= state.study.runtime.rangeLimits.hour[Data::rangeEnd];
198 ++i)
199 {
200 pValuesForTheCurrentYear[numSpace][i] += state
201 .thermalClusterNonProportionalCostForYear[i];
202 }
203
204 // Next variable
205 NextType::yearEndBuildForEachThermalCluster(state, year, numSpace);
206 }
207
208 void yearEndBuild(State& state, unsigned int year, unsigned int numSpace)
209 {
210 // Next variable
211 NextType::yearEndBuild(state, year, numSpace);
212 }
213
214 void yearEnd(unsigned int year, unsigned int numSpace)
215 {
216 // Compute all statistics for the current year (daily,weekly,monthly)
217 pValuesForTheCurrentYear[numSpace].computeStatisticsForTheCurrentYear();
218
219 // Next variable
220 NextType::yearEnd(year, numSpace);
221 }
222
223 void computeSummary(std::map<unsigned int, unsigned int>& numSpaceToYear,
224 unsigned int nbYearsForCurrentSummary)
225 {
226 for (unsigned int numSpace = 0; numSpace < nbYearsForCurrentSummary; ++numSpace)
227 {
228 // Merge all those values with the global results
229 AncestorType::pResults.merge(numSpaceToYear[numSpace] /*year*/,
230 pValuesForTheCurrentYear[numSpace]);
231 }
232
233 // Next variable
234 NextType::computeSummary(numSpaceToYear, nbYearsForCurrentSummary);
235 }
236
237 void hourBegin(unsigned int hourInTheYear)
238 {
239 // Next variable
240 NextType::hourBegin(hourInTheYear);
241 }
242
243 void hourForEachArea(State& state, unsigned int numSpace)
244 {
245 // Next variable
246 NextType::hourForEachArea(state, numSpace);
247 }
248
249 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
250 unsigned int,
251 unsigned int numSpace) const
252 {
253 return pValuesForTheCurrentYear[numSpace].hour;
254 }
255
256 void localBuildAnnualSurveyReport(SurveyResults& results,
257 int fileLevel,
258 int precision,
259 unsigned int numSpace) const
260 {
261 // Initializing external pointer on current variable non applicable status
262 results.isCurrentVarNA = AncestorType::isNonApplicable;
263
264 if (AncestorType::isPrinted[0])
265 {
266 // Write the data for the current year
267 results.variableCaption = VCardType::Caption();
268 results.variableUnit = VCardType::Unit();
269 pValuesForTheCurrentYear[numSpace]
270 .template buildAnnualSurveyReport<VCardType>(results, fileLevel, precision);
271 }
272 }
273
274private:
276 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
277 unsigned int pNbYearsParallel;
278
279}; // class NonProportionalCost
280
281} // namespace Economy
282} // namespace Variable
283} // namespace Solver
284} // namespace Antares
285
286#endif // __SOLVER_VARIABLE_ECONOMY_NonProportionalCost_H__
Definition for a single area.
Definition area.h:52
Definition study.h:61
C02 Average value of the overrall OperatingCost emissions expected from all the thermal dispatchable ...
Definition nonProportionalCost.h:106
Variable::IVariable< NonProportionalCost< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition nonProportionalCost.h:113
VCardNonProportionalCost VCardType
VCard.
Definition nonProportionalCost.h:111
NextT NextType
Type of the next static variable.
Definition nonProportionalCost.h:109
@ count
How many items have we got.
Definition nonProportionalCost.h:123
VCardType::ResultsType ResultsType
List of expected results.
Definition nonProportionalCost.h:116
Interface for any variable.
Definition variable.h:51
StoredResultType pResults
All the results about this variable.
Definition variable.h:327
Temporary buffer for allocating results for a single year.
Definition intermediate.h:46
Definition results.h:48
@ count
The count if item in the list.
Definition results.h:56
Definition cbuilder.h:120
Definition variable.h:25
static constexpr uint8_t precision
Precision (views)
Definition nonProportionalCost.h:76
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition nonProportionalCost.h:84
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition nonProportionalCost.h:90
static std::string Description()
The short description of the variable.
Definition nonProportionalCost.h:49
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition nonProportionalCost.h:88
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition nonProportionalCost.h:78
VCardNonProportionalCost VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition nonProportionalCost.h:67
static std::string Unit()
Unit.
Definition nonProportionalCost.h:43
static constexpr int columnCount
Number of columns used by the variable (One ResultsType per column)
Definition nonProportionalCost.h:82
static constexpr uint8_t categoryDataLevel
Data Level.
Definition nonProportionalCost.h:70
Results< R::AllYears::Average< R::AllYears::StdDeviation< R::AllYears::Min< R::AllYears::Max< > > > >, R::AllYears::Average > ResultsType
The expecte results.
Definition nonProportionalCost.h:64
static constexpr uint8_t decimal
Decimal precision.
Definition nonProportionalCost.h:80
static std::string Caption()
Caption.
Definition nonProportionalCost.h:37
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition nonProportionalCost.h:72