Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
avail-dispatchable-generation.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_AvailableDispatchGen_H__
22#define __SOLVER_VARIABLE_ECONOMY_AvailableDispatchGen_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 "AVL DTG";
40 }
41
43 static std::string Unit()
44 {
45 return "MWh";
46 }
47
49 static std::string Description()
50 {
51 return "Available dispatchable generation";
52 }
53
55 typedef Results<R::AllYears::Average< // The average values thoughout all years
56 R::AllYears::StdDeviation< // The standard deviation values throughout all years
57 R::AllYears::Min< // The minimum values thoughout all years
58 R::AllYears::Max< // The maximum values thoughout all years
59 >>>>>
61
64
66 static constexpr uint8_t categoryDataLevel = Category::DataLevel::area;
68 static constexpr uint8_t categoryFileLevel = ResultsType::categoryFile
69 & (Category::FileLevel::id
70 | Category::FileLevel::va);
72 static constexpr uint8_t precision = Category::all;
74 static constexpr uint8_t nodeDepthForGUI = +0;
76 static constexpr uint8_t decimal = 0;
78 static constexpr int columnCount = 1;
80 static constexpr uint8_t spatialAggregate = Category::spatialAggregateSum;
81 static constexpr uint8_t spatialAggregateMode = Category::spatialAggregateEachYear;
82 static constexpr uint8_t spatialAggregatePostProcessing = 0;
84 static constexpr uint8_t hasIntermediateValues = 1;
86 static constexpr uint8_t isPossiblyNonApplicable = 0;
87
89 typedef std::vector<IntermediateValues> IntermediateValuesType;
90
92
93}; // class VCard
94
98template<class NextT = Container::EndOfList>
100 : public Variable::IVariable<AvailableDispatchGen<NextT>, NextT, VCardAvailableDispatchGen>
101{
102public:
104 typedef NextT NextType;
109
112
114
115 enum
116 {
118 count = 1 + NextT::count,
119 };
120
121 template<int CDataLevel, int CFile>
123 {
124 enum
125 {
126 count = ((VCardType::categoryDataLevel & CDataLevel
128 ? (NextType::template Statistics<CDataLevel, CFile>::count
130 : NextType::template Statistics<CDataLevel, CFile>::count),
131 };
132 };
133
134public:
135 void initializeFromStudy(Data::Study& study)
136 {
137 pNbYearsParallel = study.maxNbYearsInParallel;
138
139 // Average thoughout all years
140 InitializeResultsFromStudy(AncestorType::pResults, study);
141
142 // Intermediate values
143 pValuesForTheCurrentYear.resize(pNbYearsParallel);
144 for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
145 {
146 pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
147 }
148
149 // Next
150 NextType::initializeFromStudy(study);
151 }
152
153 template<class R>
154 static void InitializeResultsFromStudy(R& results, Data::Study& study)
155 {
156 VariableAccessorType::InitializeAndReset(results, study);
157 }
158
159 void initializeFromArea(Data::Study* study, Data::Area* area)
160 {
161 pArea = area;
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 for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
175 {
176 pValuesForTheCurrentYear[numSpace].reset();
177 }
178
179 // Next
180 NextType::simulationBegin();
181 }
182
183 void simulationEnd()
184 {
185 NextType::simulationEnd();
186 }
187
188 void yearBegin(unsigned int year, unsigned int numSpace)
189 {
190 // Somme de toutes les productions disponibles pour l'ensemble des
191 // paliers thermiques (+must-run)
192 pValuesForTheCurrentYear[numSpace].reset();
193 for (const auto& cluster: pArea->thermal.list.each_enabled())
194 {
195 const auto& availableProduction = cluster->series.getColumn(year);
196 for (unsigned int hour = 0; hour != cluster->series.timeSeries.height; ++hour)
197 {
198 pValuesForTheCurrentYear[numSpace].hour[hour] += availableProduction[hour];
199 }
200 }
201
202 // Next variable
203 NextType::yearBegin(year, numSpace);
204 }
205
206 void yearEndBuild(State& state, unsigned int year, unsigned int numSpace)
207 {
208 // Next variable
209 NextType::yearEndBuild(state, year, numSpace);
210 }
211
212 void yearEnd(unsigned int year, unsigned int numSpace)
213 {
214 // Compute all statistics for the current year (daily,weekly,monthly)
215 pValuesForTheCurrentYear[numSpace].computeStatisticsForTheCurrentYear();
216
217 // Next variable
218 NextType::yearEnd(year, numSpace);
219 }
220
221 void computeSummary(std::map<unsigned int, unsigned int>& numSpaceToYear,
222 unsigned int nbYearsForCurrentSummary)
223 {
224 for (unsigned int numSpace = 0; numSpace < nbYearsForCurrentSummary; ++numSpace)
225 {
226 // Merge all those values with the global results
227 AncestorType::pResults.merge(numSpaceToYear[numSpace] /*year*/,
228 pValuesForTheCurrentYear[numSpace]);
229 }
230
231 // Next variable
232 NextType::computeSummary(numSpaceToYear, nbYearsForCurrentSummary);
233 }
234
235 void hourBegin(unsigned int hourInTheYear)
236 {
237 // Next variable
238 NextType::hourBegin(hourInTheYear);
239 }
240
241 void hourForEachArea(State& state, unsigned int numSpace)
242 {
243 // Next variable
244 NextType::hourForEachArea(state, numSpace);
245 }
246
247 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
248 unsigned int,
249 unsigned int numSpace) const
250 {
251 return pValuesForTheCurrentYear[numSpace].hour;
252 }
253
254 void localBuildAnnualSurveyReport(SurveyResults& results,
255 int fileLevel,
256 int precision,
257 unsigned int numSpace) const
258 {
259 // Initializing external pointer on current variable non applicable status
260 results.isCurrentVarNA = AncestorType::isNonApplicable;
261
262 if (AncestorType::isPrinted[0])
263 {
264 // Write the data for the current year
265 results.variableCaption = VCardType::Caption();
266 results.variableUnit = VCardType::Unit();
267 pValuesForTheCurrentYear[numSpace]
268 .template buildAnnualSurveyReport<VCardType>(results, fileLevel, precision);
269 }
270 }
271
272private:
274 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
275 //
276 Data::Area* pArea;
277 unsigned int pNbYearsParallel;
278
279}; // class AvailableDispatchGen
280
281} // namespace Economy
282} // namespace Variable
283} // namespace Solver
284} // namespace Antares
285
286#endif // __SOLVER_VARIABLE_ECONOMY_AvailableDispatchGen_H__
Definition for a single area.
Definition area.h:52
ThermalClusterList list
List of all thermal clusters (enabled and disabled) except must-run clusters.
Definition container.h:90
Definition study.h:61
Marginal AvailableDispatchGen.
Definition avail-dispatchable-generation.h:101
VCardAvailableDispatchGen VCardType
VCard.
Definition avail-dispatchable-generation.h:106
@ count
How many items have we got.
Definition avail-dispatchable-generation.h:118
NextT NextType
Type of the next static variable.
Definition avail-dispatchable-generation.h:104
VCardType::ResultsType ResultsType
List of expected results.
Definition avail-dispatchable-generation.h:111
Variable::IVariable< AvailableDispatchGen< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition avail-dispatchable-generation.h:108
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
Definition avail-dispatchable-generation.h:123
Definition avail-dispatchable-generation.h:35
static constexpr uint8_t categoryDataLevel
Data Level.
Definition avail-dispatchable-generation.h:66
static std::string Caption()
Caption.
Definition avail-dispatchable-generation.h:37
static constexpr uint8_t precision
Precision (views)
Definition avail-dispatchable-generation.h:72
static constexpr uint8_t decimal
Decimal precision.
Definition avail-dispatchable-generation.h:76
static constexpr int columnCount
Number of columns used by the variable (One ResultsType per column)
Definition avail-dispatchable-generation.h:78
VCardAvailableDispatchGen VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition avail-dispatchable-generation.h:63
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition avail-dispatchable-generation.h:84
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition avail-dispatchable-generation.h:80
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition avail-dispatchable-generation.h:68
static std::string Description()
The short description of the variable.
Definition avail-dispatchable-generation.h:49
static std::string Unit()
Unit.
Definition avail-dispatchable-generation.h:43
Results< R::AllYears::Average< R::AllYears::StdDeviation< R::AllYears::Min< R::AllYears::Max< > > > > > ResultsType
The expecte results.
Definition avail-dispatchable-generation.h:60
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition avail-dispatchable-generation.h:86
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition avail-dispatchable-generation.h:74