Antares Simulator
Power System Simulator
categories.h
1 /*
2 ** Copyright 2007-2025, 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_CATEGORIES_H__
22 #define __SOLVER_VARIABLE_CATEGORIES_H__
23 
24 #include <antares/antares/constants.h>
25 
26 namespace Antares::Solver::Variable::Category
27 {
28 namespace DataLevel
29 {
31 constexpr uint8_t area = 1;
33 constexpr uint8_t thermalAggregate = 2;
35 constexpr uint8_t link = 4;
37 constexpr uint8_t setOfAreas = 8;
38 // Data belonging to a binding constraint
39 constexpr uint8_t bindingConstraint = 16;
41 constexpr uint8_t maxDataLevel = 16;
42 } // namespace DataLevel
43 
44 namespace FileLevel
45 {
47 constexpr uint8_t va = 1;
49 constexpr uint8_t id = 2;
51 constexpr uint8_t de = 4;
53 constexpr uint8_t de_res = 8;
55 constexpr uint8_t bc = 16;
57 constexpr uint8_t de_sts = 32;
59 constexpr uint8_t maxFileLevel = 32;
61 constexpr uint8_t allFile = va | id | de | de_res | bc | de_sts;
62 }; // namespace FileLevel
63 
64 enum Precision
65 {
67  hourly = 1,
69  daily = 2,
71  weekly = 4,
73  monthly = 8,
75  annual = 16,
77  all = hourly | daily | weekly | monthly | annual,
78 };
79 
83 enum ColumnManagement
84 {
86  dynamicColumns = -1,
88  noColumn = 0,
90  singleColumn = 1,
91 };
92 
96 enum Digest
97 {
99  digestNone = 0,
101  digestAllYears = 1,
103  digestFlowLinear = 2,
105  digestFlowQuad = 4,
106 };
107 
111 enum SpatialAggregate
112 {
114  noSpatialAggregate = 0,
116  spatialAggregateSum = 1,
118  spatialAggregateMax = 2,
120  spatialAggregateAverage = 4,
122  spatialAggregateSumThen1IfPositive = 8,
124  spatialAggregateOr = 16,
125 };
126 
127 enum SpatialAggregateMode
128 {
130  spatialAggregateEachYear = 1,
132  spatialAggregateOnce = 2,
133 };
134 
135 enum SpatialAggregatePostProcessing
136 {
137  spatialAggregatePostProcessingPrice = 1,
138 };
139 
143 static inline uint MaxDecimalPrecision(uint fileLevel)
144 {
145  return (fileLevel != FileLevel::id) ? 2u : 0u;
146 }
147 
148 template<int Index, int Limit>
149 struct NextLevel
150 {
151  enum
152  {
153  next = (Index != Limit) ? Index * 2 : 0,
154  };
155 };
156 
157 template<class StreamT>
158 inline void DataLevelToStream(StreamT& out, int dataLevel)
159 {
160  switch (dataLevel)
161  {
162  using namespace DataLevel;
163  case area:
164  out += "area";
165  break;
166  case thermalAggregate:
167  out += "thermal";
168  break;
169  case link:
170  out += "link";
171  break;
172  case setOfAreas:
173  out += "set of areas";
174  break;
175  default:
176  out += NULL;
177  };
178 }
179 
180 template<class StreamT>
181 inline void FileLevelToStreamShort(StreamT& out, int fileLevel)
182 {
183  switch (fileLevel)
184  {
185  using namespace FileLevel;
186  case va:
187  out += "va";
188  break;
189  case id:
190  out += "id";
191  break;
192  case de:
193  out += "de";
194  break;
195  case de_res:
196  out += "res";
197  break;
198  case bc:
199  out += "bc";
200  break;
201  case de_sts:
202  out += "sts";
203  break;
204  default:
205  out += NULL;
206  }
207 }
208 
209 template<class StreamT>
210 inline void FileLevelToStream(StreamT& out, int fileLevel)
211 {
212  switch (fileLevel)
213  {
214  using namespace FileLevel;
215  case va:
216  out += "values";
217  break;
218  case id:
219  out += "id";
220  break;
221  case de:
222  out += "details";
223  break;
224  case de_res:
225  out += "details-res";
226  break;
227  case bc:
228  out += "binding-constraints";
229  break;
230  case de_sts:
231  out += "details-STstorage";
232  break;
233  default:
234  out += NULL;
235  }
236 }
237 
238 template<class StreamT>
239 inline void PrecisionLevelToStream(StreamT& out, int precisionLevel)
240 {
241  switch (precisionLevel)
242  {
243  case hourly:
244  out += "hourly";
245  break;
246  case daily:
247  out += "daily";
248  break;
249  case weekly:
250  out += "weekly";
251  break;
252  case monthly:
253  out += "monthly";
254  break;
255  case annual:
256  out += "annual";
257  break;
258  default:
259  out += NULL;
260  }
261 }
262 
263 } // namespace Antares::Solver::Variable::Category
264 
265 #endif // __SOLVER_VARIABLE_CATEGORIES_H__