Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
domesticUnsuppliedEnergy.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_DomesticUnsuppliedEnergy_H__
22#define __SOLVER_VARIABLE_ECONOMY_DomesticUnsuppliedEnergy_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 "DENS";
40 }
41
43 static std::string Unit()
44 {
45 return "MWh";
46 }
47
49 static std::string Description()
50 {
51 return "Domestic Unsupplied Energy (demand that cannot be satisfied without "
52 "interconnections/links)";
53 }
54
56 typedef Results<R::AllYears::Average< // The average values throughout all years
57 R::AllYears::StdDeviation< // The standard deviation values throughout all years
58 R::AllYears::Min< // The minimum values throughout all years
59 R::AllYears::Max< // The maximum values throughout all years
60 >>>>>
62
65
67 static constexpr uint8_t categoryDataLevel = Category::DataLevel::area;
69 static constexpr uint8_t categoryFileLevel = ResultsType::categoryFile
70 & (Category::FileLevel::id
71 | Category::FileLevel::va);
73 static constexpr uint8_t precision = Category::all;
75 static constexpr uint8_t nodeDepthForGUI = +0;
77 static constexpr uint8_t decimal = 0;
79 static constexpr int columnCount = 1;
81 static constexpr uint8_t spatialAggregate = Category::spatialAggregateSum;
82 static constexpr uint8_t spatialAggregateMode = Category::spatialAggregateEachYear;
83 static constexpr uint8_t spatialAggregatePostProcessing = 0;
85 static constexpr uint8_t hasIntermediateValues = 1;
87 static constexpr uint8_t isPossiblyNonApplicable = 0;
88
90 typedef std::vector<IntermediateValues> IntermediateValuesType;
91
93
94}; // class VCard
95
100template<class NextT = Container::EndOfList>
101class DomesticUnsuppliedEnergy: public Variable::IVariable<DomesticUnsuppliedEnergy<NextT>,
102 NextT,
103 VCardDomesticUnsuppliedEnergy>
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 // Intermediate values
143 InitializeResultsFromStudy(AncestorType::pResults, study);
144
145 pValuesForTheCurrentYear.resize(pNbYearsParallel);
146 for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
147 {
148 pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
149 }
150
151 // Next
152 NextType::initializeFromStudy(study);
153 }
154
155 template<class R>
156 static void InitializeResultsFromStudy(R& results, Data::Study& study)
157 {
158 VariableAccessorType::InitializeAndReset(results, study);
159 }
160
161 void initializeFromArea(Data::Study* study, Data::Area* area)
162 {
163 // Next
164 NextType::initializeFromArea(study, area);
165 }
166
167 void initializeFromLink(Data::Study* study, Data::AreaLink* link)
168 {
169 // Next
170 NextType::initializeFromAreaLink(study, link);
171 }
172
173 void simulationBegin()
174 {
175 for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
176 {
177 pValuesForTheCurrentYear[numSpace].reset();
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 // Reset the values for the current year
191 pValuesForTheCurrentYear[numSpace].reset();
192
193 // Next variable
194 NextType::yearBegin(year, numSpace);
195 }
196
197 void yearEndBuild(State& state, unsigned int year, unsigned int numSpace)
198 {
199 // Next variable
200 NextType::yearEndBuild(state, year, numSpace);
201 }
202
203 void yearEnd(unsigned int year, unsigned int numSpace)
204 {
205 // Compute all statistics for the current year (daily,weekly,monthly)
206 pValuesForTheCurrentYear[numSpace].computeStatisticsForTheCurrentYear();
207
208 // Next variable
209 NextType::yearEnd(year, numSpace);
210 }
211
212 void computeSummary(std::map<unsigned int, unsigned int>& numSpaceToYear,
213 unsigned int nbYearsForCurrentSummary)
214 {
215 for (unsigned int numSpace = 0; numSpace < nbYearsForCurrentSummary; ++numSpace)
216 {
217 // Merge all those values with the global results
218 AncestorType::pResults.merge(numSpaceToYear[numSpace] /*year*/,
219 pValuesForTheCurrentYear[numSpace]);
220 }
221
222 // Next variable
223 NextType::computeSummary(numSpaceToYear, nbYearsForCurrentSummary);
224 }
225
226 void hourBegin(unsigned int hourInTheYear)
227 {
228 // Next variable
229 NextType::hourBegin(hourInTheYear);
230 }
231
232 void hourForEachArea(State& state, unsigned int numSpace)
233 {
234 // Total DomesticUnsuppliedEnergy emissions
235 pValuesForTheCurrentYear[numSpace][state.hourInTheYear] = state.hourlyResults
236 ->ValeursHorairesDENS
237 [state.hourInTheWeek];
238
239 // Next variable
240 NextType::hourForEachArea(state, numSpace);
241 }
242
243 Antares::Memory::Stored<double>::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
244 unsigned int,
245 unsigned int numSpace) const
246 {
247 return pValuesForTheCurrentYear[numSpace].hour;
248 }
249
250 void localBuildAnnualSurveyReport(SurveyResults& results,
251 int fileLevel,
252 int precision,
253 unsigned int numSpace) const
254 {
255 // Initializing external pointer on current variable non applicable status
256 results.isCurrentVarNA = AncestorType::isNonApplicable;
257
258 if (AncestorType::isPrinted[0])
259 {
260 // Write the data for the current year
261 results.variableCaption = VCardType::Caption();
262 results.variableUnit = VCardType::Unit();
263 pValuesForTheCurrentYear[numSpace]
264 .template buildAnnualSurveyReport<VCardType>(results, fileLevel, precision);
265 }
266 }
267
268private:
270 typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
271 unsigned int pNbYearsParallel;
272
273}; // class DomesticUnsuppliedEnergy
274
275} // namespace Economy
276} // namespace Variable
277} // namespace Solver
278} // namespace Antares
279
280#endif // __SOLVER_VARIABLE_ECONOMY_DomesticUnsuppliedEnergy_H__
Definition for a single area.
Definition area.h:52
Definition study.h:61
C02 Average value of the overrall DomesticUnsuppliedEnergy emissions expected from all the thermal di...
Definition domesticUnsuppliedEnergy.h:104
NextT NextType
Type of the next static variable.
Definition domesticUnsuppliedEnergy.h:107
Variable::IVariable< DomesticUnsuppliedEnergy< NextT >, NextT, VCardType > AncestorType
Ancestor.
Definition domesticUnsuppliedEnergy.h:111
VCardDomesticUnsuppliedEnergy VCardType
VCard.
Definition domesticUnsuppliedEnergy.h:109
@ count
How many items have we got.
Definition domesticUnsuppliedEnergy.h:121
VCardType::ResultsType ResultsType
List of expected results.
Definition domesticUnsuppliedEnergy.h:114
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 domesticUnsuppliedEnergy.h:73
static constexpr uint8_t decimal
Decimal precision.
Definition domesticUnsuppliedEnergy.h:77
static std::string Caption()
Caption.
Definition domesticUnsuppliedEnergy.h:37
static constexpr uint8_t categoryFileLevel
File level (provided by the type of the results)
Definition domesticUnsuppliedEnergy.h:69
Results< R::AllYears::Average< R::AllYears::StdDeviation< R::AllYears::Min< R::AllYears::Max< > > > > > ResultsType
The expecte results.
Definition domesticUnsuppliedEnergy.h:61
static constexpr uint8_t isPossiblyNonApplicable
Can this variable be non applicable (0 : no, 1 : yes)
Definition domesticUnsuppliedEnergy.h:87
static constexpr uint8_t hasIntermediateValues
Intermediate values.
Definition domesticUnsuppliedEnergy.h:85
static constexpr int columnCount
Number of columns used by the variable (One ResultsType per column)
Definition domesticUnsuppliedEnergy.h:79
static std::string Unit()
Unit.
Definition domesticUnsuppliedEnergy.h:43
static constexpr uint8_t categoryDataLevel
Data Level.
Definition domesticUnsuppliedEnergy.h:67
static std::string Description()
The short description of the variable.
Definition domesticUnsuppliedEnergy.h:49
VCardDomesticUnsuppliedEnergy VCardForSpatialAggregate
The VCard to look for for calculating spatial aggregates.
Definition domesticUnsuppliedEnergy.h:64
static constexpr uint8_t nodeDepthForGUI
Indentation (GUI)
Definition domesticUnsuppliedEnergy.h:75
static constexpr uint8_t spatialAggregate
The Spatial aggregation.
Definition domesticUnsuppliedEnergy.h:81