Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
wind.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_TimeSeriesValuesWind_H__
22#define __SOLVER_VARIABLE_ECONOMY_TimeSeriesValuesWind_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 "WIND";
40 }
41
43 static std::string Unit()
44 {
45 return "MWh";
46 }
47
49 static std::string Description()
50 {
51 return "Wind generation, thoughout all MC years";
52 }
53
55 typedef Results<R::AllYears::Average< // The average values throughout all years
56 R::AllYears::StdDeviation< // The standard deviation values throughout all years
57 R::AllYears::Min< // The minimum values throughout all years
58 R::AllYears::Max< // The maximum values throughout 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<TimeSeriesValuesWind<NextT>, NextT, VCardTimeSeriesValuesWind>
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 InitializeResultsFromStudy(AncestorType::pResults, study);
140
141 pValuesForTheCurrentYear.resize(pNbYearsParallel);
142 for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
143 {
144 pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
145 }
146
147 isRenewableGenerationAggregrated = study.parameters.renewableGeneration.isAggregated();
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 // Next
179 NextType::simulationBegin();
180 }
181
182 void simulationEnd()
183 {
184 NextType::simulationEnd();
185 }
186
187 void yearBegin(unsigned int year, unsigned int numSpace)
188 {
189 if (isRenewableGenerationAggregrated)
190 {
191 // The current wind time-series
192 (void)::memcpy(pValuesForTheCurrentYear[numSpace].hour,
193 pArea->wind.series.getColumn(year),
194 sizeof(double) * pArea->wind.series.timeSeries.height);
195 }
196
197 // Next variable
198 NextType::yearBegin(year, numSpace);
199 }
200
201 void yearEndBuild(State& state, unsigned int year, unsigned int numSpace)
202 {
203 // Next variable
204 NextType::yearEndBuild(state, year, numSpace);
205 }
206
207 void yearEnd(unsigned int year, unsigned int numSpace)
208 {
209 // Compute all statistics for the current year (daily,weekly,monthly)
210 pValuesForTheCurrentYear[numSpace].computeStatisticsForTheCurrentYear();
211
212 // Next variable
213 NextType::yearEnd(year, numSpace);
214 }
215
216 void computeSummary(std::map<unsigned int, unsigned int>& numSpaceToYear,
217 unsigned int nbYearsForCurrentSummary)
218 {
219 for (unsigned int numSpace = 0; numSpace < nbYearsForCurrentSummary; ++numSpace)
220 {
221 // Merge all those values with the global results
222 AncestorType::pResults.merge(numSpaceToYear[numSpace] /*year*/,
223 pValuesForTheCurrentYear[numSpace]);
224 }
225
226 // Next variable
227 NextType::computeSummary(numSpaceToYear, nbYearsForCurrentSummary);
228 }
229
230 void hourBegin(unsigned int hourInTheYear)
231 {
232 // Next variable
233 NextType::hourBegin(hourInTheYear);
234 }
235
236 void hourForEachArea(State& state, unsigned int numSpace)
237 {
238 // Next variable
239 NextType::hourForEachArea(state, numSpace);
240 }
241
242 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
243 unsigned int,
244 unsigned int numSpace) const
245 {
246 return pValuesForTheCurrentYear[numSpace].hour;
247 }
248
249 void localBuildAnnualSurveyReport(SurveyResults& results,
250 int fileLevel,
251 int precision,
252 unsigned int numSpace) const
253 {
254 // Initializing external pointer on current variable non applicable status
255 results.isCurrentVarNA = AncestorType::isNonApplicable;
256
257 if (AncestorType::isPrinted[0])
258 {
259 // Write the data for the current year
260 results.variableCaption = VCardType::Caption();
261 results.variableUnit = VCardType::Unit();
262 pValuesForTheCurrentYear[numSpace]
263 .template buildAnnualSurveyReport<VCardType>(results, fileLevel, precision);
264 }
265 }
266
267private:
269 Data::Area* pArea;
271 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
272 unsigned int pNbYearsParallel;
273 bool isRenewableGenerationAggregrated = true;
274
275}; // class TimeSeriesValuesWind
276
277} // namespace Economy
278} // namespace Variable
279} // namespace Solver
280} // namespace Antares
281
282#endif // __SOLVER_VARIABLE_ECONOMY_TimeSeriesValuesWind_H__
Definition for a single area.
Definition area.h:52
Wind::Container wind
Wind time-series and Wind prepro data.
Definition area.h:258
Definition study.h:61
TimeSeries series
Definition container.h:68
uint height
Height of the matrix.
Definition matrix.h:443
Marginal TimeSeriesValuesWind.
Definition wind.h:101
VCardTimeSeriesValuesWind VCardType
VCard.
Definition wind.h:106
Variable::IVariable< TimeSeriesValuesWind< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition wind.h:108
NextT NextType
Type of the next static variable.
Definition wind.h:104
@ count
How many items have we got.
Definition wind.h:118
VCardType::ResultsType ResultsType
List of expected results.
Definition wind.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 constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition wind.h:80
static constexpr uint8_t precision
Precision (views)
Definition wind.h:72
static std::string Caption()
Caption.
Definition wind.h:37
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition wind.h:68
static constexpr uint8_t decimal
Decimal precision.
Definition wind.h:76
Results< R::AllYears::Average< R::AllYears::StdDeviation< R::AllYears::Min< R::AllYears::Max< > > > > > ResultsType
The expecte results.
Definition wind.h:60
VCardTimeSeriesValuesWind VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition wind.h:63
static std::string Unit()
Unit.
Definition wind.h:43
static constexpr uint8_t categoryDataLevel
Data Level.
Definition wind.h:66
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition wind.h:84
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition wind.h:74
static constexpr int columnCount
Number of columns used by the variable (One ResultsType per column)
Definition wind.h:78
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition wind.h:86
static std::string Description()
The short description of the variable.
Definition wind.h:49