Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
operatingCost.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_OperatingCost_H__
22#define __SOLVER_VARIABLE_ECONOMY_OperatingCost_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 "OP. COST";
40 }
41
43 static std::string Unit()
44 {
45 return "Euro";
46 }
47
49 static std::string Description()
50 {
51 return "Operating Cost throughout all MC years, of all the thermal dispatchable clusters";
52 }
53
55 typedef Results<R::AllYears::Average< // The average values throughout all years
56 R::AllYears::StdDeviation< // The standard deviation values throughout all
57 // years
58 R::AllYears::Min< // The minimum values throughout all years
59 R::AllYears::Max< // The maximum values throughout all years
60 >>>>,
62 >
64
67
69 static constexpr uint8_t categoryDataLevel = Category::DataLevel::area;
71 static constexpr uint8_t categoryFileLevel = ResultsType::categoryFile
72 & (Category::FileLevel::id
73 | Category::FileLevel::va);
75 static constexpr uint8_t precision = Category::all;
77 static constexpr uint8_t nodeDepthForGUI = +0;
79 static constexpr uint8_t decimal = 0;
81 static constexpr int columnCount = 1;
83 static constexpr uint8_t spatialAggregate = Category::spatialAggregateSum;
84 static constexpr uint8_t spatialAggregateMode = Category::spatialAggregateEachYear;
85 static constexpr uint8_t spatialAggregatePostProcessing = 0;
87 static constexpr uint8_t hasIntermediateValues = 1;
89 static constexpr uint8_t isPossiblyNonApplicable = 0;
90
92 typedef std::vector<IntermediateValues> IntermediateValuesType;
93
95
96}; // class VCard
97
102template<class NextT = Container::EndOfList>
103class OperatingCost: public Variable::IVariable<OperatingCost<NextT>, NextT, VCardOperatingCost>
104{
105public:
107 typedef NextT NextType;
112
115
117
118 enum
119 {
121 count = 1 + NextT::count,
122 };
123
124 template<int CDataLevel, int CFile>
126 {
127 enum
128 {
129 count = ((VCardType::categoryDataLevel & CDataLevel
131 ? (NextType::template Statistics<CDataLevel, CFile>::count
133 : NextType::template Statistics<CDataLevel, CFile>::count),
134 };
135 };
136
137public:
138 void initializeFromStudy(Data::Study& study)
139 {
140 pNbYearsParallel = study.maxNbYearsInParallel;
141
142 InitializeResultsFromStudy(AncestorType::pResults, study);
143
144 pValuesForTheCurrentYear.resize(pNbYearsParallel);
145 for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
146 {
147 pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
148 }
149
150 // Next
151 NextType::initializeFromStudy(study);
152 }
153
154 template<class R>
155 static void InitializeResultsFromStudy(R& results, Data::Study& study)
156 {
157 VariableAccessorType::InitializeAndReset(results, study);
158 }
159
160 void initializeFromArea(Data::Study* study, Data::Area* area)
161 {
162 // Next
163 NextType::initializeFromArea(study, area);
164 }
165
166 void initializeFromLink(Data::Study* study, Data::AreaLink* link)
167 {
168 // Next
169 NextType::initializeFromAreaLink(study, link);
170 }
171
172 void simulationBegin()
173 {
174 // Next
175 NextType::simulationBegin();
176 }
177
178 void simulationEnd()
179 {
180 NextType::simulationEnd();
181 }
182
183 void yearBegin(unsigned int year, unsigned int numSpace)
184 {
185 // Reset the values for the current year
186 pValuesForTheCurrentYear[numSpace].reset();
187 // Next variable
188 NextType::yearBegin(year, numSpace);
189 }
190
191 void yearEndBuildForEachThermalCluster(State& state, uint year, unsigned int numSpace)
192 {
193 // Get end year calculations
194 for (unsigned int i = state.study.runtime.rangeLimits.hour[Data::rangeBegin];
195 i <= state.study.runtime.rangeLimits.hour[Data::rangeEnd];
196 ++i)
197 {
198 pValuesForTheCurrentYear[numSpace][i] += state.thermalClusterOperatingCostForYear[i];
199 }
200
201 // Next variable
202 NextType::yearEndBuildForEachThermalCluster(state, year, numSpace);
203 }
204
205 void yearEndBuild(State& state, unsigned int year, unsigned int numSpace)
206 {
207 // Next variable
208 NextType::yearEndBuild(state, year, numSpace);
209 }
210
211 void yearEnd(unsigned int year, unsigned int numSpace)
212 {
213 // Compute all statistics for the current year (daily,weekly,monthly)
214 pValuesForTheCurrentYear[numSpace].computeStatisticsForTheCurrentYear();
215
216 // Next variable
217 NextType::yearEnd(year, numSpace);
218 }
219
220 void computeSummary(std::map<unsigned int, unsigned int>& numSpaceToYear,
221 unsigned int nbYearsForCurrentSummary)
222 {
223 for (unsigned int numSpace = 0; numSpace < nbYearsForCurrentSummary; ++numSpace)
224 {
225 // Merge all those values with the global results
226 AncestorType::pResults.merge(numSpaceToYear[numSpace] /*year*/,
227 pValuesForTheCurrentYear[numSpace]);
228 }
229
230 // Next variable
231 NextType::computeSummary(numSpaceToYear, nbYearsForCurrentSummary);
232 }
233
234 void hourBegin(unsigned int hourInTheYear)
235 {
236 // Next variable
237 NextType::hourBegin(hourInTheYear);
238 }
239
240 void hourForEachArea(State& state, unsigned int numSpace)
241 {
242 // Next variable
243 NextType::hourForEachArea(state, numSpace);
244 }
245
246 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
247 unsigned int,
248 unsigned int numSpace) const
249 {
250 return pValuesForTheCurrentYear[numSpace].hour;
251 }
252
253 void localBuildAnnualSurveyReport(SurveyResults& results,
254 int fileLevel,
255 int precision,
256 unsigned int numSpace) const
257 {
258 // Initializing external pointer on current variable non applicable status
259 results.isCurrentVarNA = AncestorType::isNonApplicable;
260
261 if (AncestorType::isPrinted[0])
262 {
263 // Write the data for the current year
264 results.variableCaption = VCardType::Caption();
265 results.variableUnit = VCardType::Unit();
266 pValuesForTheCurrentYear[numSpace]
267 .template buildAnnualSurveyReport<VCardType>(results, fileLevel, precision);
268 }
269 }
270
271private:
273 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
274 unsigned int pNbYearsParallel;
275
276}; // class OperatingCost
277
278} // namespace Economy
279} // namespace Variable
280} // namespace Solver
281} // namespace Antares
282
283#endif // __SOLVER_VARIABLE_ECONOMY_OperatingCost_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 operatingCost.h:104
@ count
How many items have we got.
Definition operatingCost.h:121
VCardType::ResultsType ResultsType
List of expected results.
Definition operatingCost.h:114
NextT NextType
Type of the next static variable.
Definition operatingCost.h:107
VCardOperatingCost VCardType
VCard.
Definition operatingCost.h:109
Variable::IVariable< OperatingCost< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition operatingCost.h:111
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 std::string Unit()
Unit.
Definition operatingCost.h:43
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition operatingCost.h:77
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition operatingCost.h:87
static constexpr uint8_t categoryDataLevel
Data Level.
Definition operatingCost.h:69
static constexpr int columnCount
Number of columns used by the variable (One ResultsType per column)
Definition operatingCost.h:81
static std::string Caption()
Caption.
Definition operatingCost.h:37
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition operatingCost.h:71
static std::string Description()
The short description of the variable.
Definition operatingCost.h:49
static constexpr uint8_t precision
Precision (views)
Definition operatingCost.h:75
VCardOperatingCost VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition operatingCost.h:66
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition operatingCost.h:89
Results< R::AllYears::Average< R::AllYears::StdDeviation< R::AllYears::Min< R::AllYears::Max< > > > >, R::AllYears::Average > ResultsType
The expecte results.
Definition operatingCost.h:63
static constexpr uint8_t decimal
Decimal precision.
Definition operatingCost.h:79
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition operatingCost.h:83