Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
parameters.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 __ANTARES_LIBS_STUDY_PARAMETERS_H__
22#define __ANTARES_LIBS_STUDY_PARAMETERS_H__
23
24#include <cassert>
25#include <cstdlib>
26#include <vector>
27
28#include <yuni/yuni.h>
29#include <yuni/core/string.h>
30
31#include <antares/date/date.h>
32#include <antares/inifile/inifile.h>
33#include <antares/optimization-options/options.h>
34#include <antares/study/UnfeasibleProblemBehavior.hpp>
35#include <antares/writer/result_format.h>
36#include "antares/antares/antares.h"
37#include "antares/study/fwd.h"
38
39#include "parameters/adq-patch-params.h"
40#include "variable-print-info.h"
41#include "version.h"
42
43namespace Antares::Data
44{
50class Parameters final
51{
52public:
54
55
56 bool economy() const;
58 bool adequacy() const;
60
64 void resetPlaylist(uint nbOfYears);
65
78 bool loadFromFile(const std::filesystem::path& filename, const StudyVersion& version);
79
81 bool loadFromINI(const IniFile& ini, const StudyVersion& version);
82
96 void prepareForSimulation(const StudyLoadOptions& options);
97
104 bool saveToFile(const AnyString& filename) const;
105
112 bool isTSGeneratedByPrepro(const TimeSeriesType ts) const;
113
117 void reset();
121 void resetSeeds();
130
134 void handleOptimizationOptions(const StudyLoadOptions& options);
135
139 void fixBadValues();
140
141 void validateOptions(const StudyLoadOptions&);
142
146 void fixRefreshIntervals();
147
152 void fixGenRefreshForNTC();
153
157 void resetYearsWeigth();
158
164 std::vector<float> getYearsWeight() const;
165
172 float getYearsWeightSum() const;
173
180 void setYearWeight(uint year, float weight);
181
182 // Do we create files in the input folder ?
183 bool haveToImport(int tsKind) const;
184
186 void saveToINI(IniFile& ini) const;
187
188public:
190
191
192 SimulationMode mode;
194
196
197
198 Yuni::String horizon;
200
202
203
208 DayOfTheWeek dayOfThe1stJanuary;
210 DayOfTheWeek firstWeekday;
216
218
219
228 std::vector<bool> yearsFilter;
229
234
236 // Computed automatically from the number of MC years and the playlist
244
246
247
258
260
261
268
280
282
283
292
294
295
303
305
306
315
317
318
326
332
334
335
338
346
349
351
352
354
357
360
362
364
366 {
371
372 struct Reserve
373 {
382
383 } reserve;
384
385 struct Thermal
386 {
387 // Thermal cluster min stable power
388 bool minStablePower;
389
392 } thermal;
393
395 mpsExportStatus exportMPS;
396
399
401 UnfeasibleProblemBehavior unfeasibleProblemBehavior;
402
403 bool exportSolutions;
404 } include;
405
407 {
408 enum class HydroPmax
409 {
410 Daily,
411 Hourly
412 };
413 HydroPmax hydroPmax = HydroPmax::Daily;
414 };
415
416 Compatibility compatibility;
417
418 // Shedding
419 struct
420 {
422 SheddingPolicy policy;
423 } shedding;
424
425 struct
426 {
428 PowerFluctuations fluctuations;
429 } power;
430
431 struct UCMode
432 {
434 UnitCommitmentMode ucMode;
435
437 void addExcludedVariables(std::vector<std::string>&) const;
438 };
439
440 UCMode unitCommitment;
441
442 struct
443 {
445 NumberOfCoresMode ncMode;
446 } nbCores;
447
449 {
451 RenewableGenerationModelling rgModelling;
452 void addExcludedVariables(std::vector<std::string>&) const;
453 RenewableGenerationModelling operator()() const;
454 void toAggregated();
455 void toClusters();
456 bool isAggregated() const;
457 bool isClusters() const;
458 };
459
460 RenewableGeneration renewableGeneration;
461
462 struct
463 {
465 HydroHeuristicPolicy hhPolicy;
466 } hydroHeuristicPolicy;
467
468 struct
469 {
471 HydroPricingMode hpMode;
472 } hydroPricing;
473
475 GlobalTransmissionCapacities transmissionCapacities;
477 SimplexOptimization simplexOptimizationRange;
479
480 AdequacyPatch::AdqPatchParams adqPatchParams;
481
483
484
485 RulesScenarioName activeRulesScenario;
487
489
490
491 // This variable is not stored within the study but only used by the solver
492 bool noOutput = false;
494
495 bool hydroDebug;
496
498
499
500 uint seed[seedMax];
502
503 // Format of results. Currently, only single files or zip archive are supported
504 ResultFormat resultFormat = legacyFilesDirectories;
505
506 // Naming constraints and variables in problems
507 bool namedProblems;
508
509 // All options related to optimization
511
512private:
513 void resetPlayedYears(uint nbOfYears);
514
516 std::vector<float> yearsWeight;
517
518}; // class Parameters
519
523const char* SimulationModeToCString(SimulationMode mode);
524
532bool StringToSimulationMode(SimulationMode& mode, Yuni::CString<20, false> text);
533
534const char* CompatibilityHydroPmaxToCString(const Parameters::Compatibility::HydroPmax);
535bool StringToCompatibilityHydroPmax(Parameters::Compatibility::HydroPmax&, const std::string& text);
536
537} // namespace Antares::Data
538
539#endif // __ANTARES_LIBS_STUDY_PARAMETERS_H__
Definition variable-print-info.h:97
General data for a study.
Definition parameters.h:51
bool readonly
Read-only mode.
Definition parameters.h:345
PowerFluctuations fluctuations
Power fluctuations.
Definition parameters.h:428
uint nbTimeSeriesLoad
Nb of timeSeries : Load.
Definition parameters.h:248
bool leapYear
Leap year.
Definition parameters.h:214
DayOfTheWeek firstWeekday
First day in the week.
Definition parameters.h:210
std::vector< float > getYearsWeight() const
Get MC years weight dependending on playlist configuration.
Definition parameters.cpp:1437
uint timeSeriesToArchive
TimeSeries to archive.
Definition parameters.h:290
GlobalTransmissionCapacities transmissionCapacities
Transmission capacities.
Definition parameters.h:475
uint exportTimeSeriesInInput
TimeSeries to Import.
Definition parameters.h:313
void prepareForSimulation(const StudyLoadOptions &options)
Prepare all settings for a simulation.
Definition parameters.cpp:1489
HydroHeuristicPolicy hhPolicy
Hydro heuristic policy.
Definition parameters.h:465
bool saveToFile(const AnyString &filename) const
Save data to an ini file.
Definition parameters.cpp:2052
bool noOutput
No output.
Definition parameters.h:492
void fixBadValues()
Try to detect then fix any bad value.
Definition parameters.cpp:1338
HydroPricingMode hpMode
Hydro Pricing Mode.
Definition parameters.h:471
AllVariablesPrintInfo variablesPrintInfo
List of all output variables print info.
Definition parameters.h:233
uint effectiveNbYears
The number of years that will be really performed.
Definition parameters.h:237
uint nbTimeSeriesHydro
Nb of timeSeries : Hydro.
Definition parameters.h:250
bool geographicTrimming
Definition parameters.h:242
bool derated
Derated.
Definition parameters.h:222
NumberOfCoresMode ncMode
Number of Cores Mode.
Definition parameters.h:445
Yuni::String horizon
Horizon year, not used by the solver.
Definition parameters.h:198
bool isTSGeneratedByPrepro(const TimeSeriesType ts) const
Get if a time-series must be generated by the preprocessor.
Definition parameters.cpp:393
uint nbTimeSeriesThermal
Nb of timeSeries : Thermal.
Definition parameters.h:254
Date::DayInterval simulationDays
Simulation days interval.
Definition parameters.h:206
bool synthesis
Write the simulation synthesis into the output.
Definition parameters.h:348
bool yearByYear
Export results each year.
Definition parameters.h:220
void resetThresholdsAdqPatch()
Reset to default all threshold values in adequacy patch.
RulesScenarioName activeRulesScenario
The current active rules for building scenarios (useful if building mode == custom)
Definition parameters.h:485
uint refreshIntervalSolar
Refresh interval (in years) for timeSeries : Solar.
Definition parameters.h:278
void resetSeeds()
Reset to default all seeds.
Definition parameters.cpp:254
bool spillageBound
Spillage bound.
Definition parameters.h:353
SimplexOptimization simplexOptimizationRange
Simplex optimization range (day/week)
Definition parameters.h:477
SimulationMode mode
Mode of the study (adequacy, economy...)
Definition parameters.h:192
uint timeSeriesToGenerate
TimeSeries to generate.
Definition parameters.h:301
bool loadFromFile(const std::filesystem::path &filename, const StudyVersion &version)
Load data from a file.
Definition parameters.cpp:2035
uint nbTimeSeriesSolar
Nb of timeSeries : Solar.
Definition parameters.h:256
void setYearWeight(uint year, float weight)
Define weight for a MC year.
Definition parameters.cpp:1483
void fixGenRefreshForNTC()
Try to detect then fix TS generation/refresh parameters for NTC.
Definition parameters.cpp:1316
void resetYearsWeigth()
Reset MC year weight to 1 for all years.
Definition parameters.cpp:1431
uint refreshIntervalThermal
Refresh interval (in years) for timeSeries : Thermal.
Definition parameters.h:276
void reset()
Reset to default all values in a structure for general data.
Definition parameters.cpp:281
uint interModal
Inter-modal.
Definition parameters.h:330
uint seed[seedMax]
Seeds.
Definition parameters.h:500
void resetAdqPatchParameters()
Reset to default all adequacy patch values.
bool thematicTrimming
Custom variable selection (each variable will be manually selected for print by the user)
Definition parameters.h:231
MonthName firstMonthInYear
The first month of the simulation year.
Definition parameters.h:212
DayOfTheWeek dayOfThe1stJanuary
Day of the 1st january.
Definition parameters.h:208
void resetPlaylist(uint nbOfYears)
Reset the playlist (played years and associated years)
Definition parameters.cpp:1795
uint refreshIntervalWind
Refresh interval (in years) for timeSeries : Wind.
Definition parameters.h:274
uint refreshIntervalHydro
Refresh interval (in years) for timeSeries : Hydro.
Definition parameters.h:272
uint timeSeriesAccuracyOnCorrelation
Accuracy on correlation.
Definition parameters.h:359
bool storeTimeseriesNumbers
Store the sampled timeseries numbers.
Definition parameters.h:336
std::vector< bool > yearsFilter
Flag to perform the calculations or not from the solver.
Definition parameters.h:228
bool userPlaylist
Custom playlist (each year will be manually selected by the user)
Definition parameters.h:226
bool useCustomScenario
Custom scenario.
Definition parameters.h:224
bool improveUnitsStartup
Improve units startup.
Definition parameters.h:356
uint timeSeriesToRefresh
Time series to refresh on-line.
Definition parameters.h:267
uint refreshIntervalLoad
Refresh interval (in years) for timeSeries : Load.
Definition parameters.h:270
bool economy() const
Get if the simulation is in economy mode.
Definition parameters.cpp:244
void saveToINI(IniFile &ini) const
Save the internal settings into an INI file.
Definition parameters.cpp:1801
void handleOptimizationOptions(const StudyLoadOptions &options)
Handle priority between command-line option and configuration file.
Definition parameters.cpp:1283
uint nbTimeSeriesWind
Nb of timeSeries : Wind.
Definition parameters.h:252
float getYearsWeightSum() const
Get MC years weight sum dependending on playlist configuration.
Definition parameters.cpp:1453
uint intraModal
TimeSeries where the draws are correlated.
Definition parameters.h:325
SheddingPolicy policy
Shedding policy.
Definition parameters.h:422
bool adequacy() const
Get if the simulation is in adequacy mode.
Definition parameters.cpp:249
bool loadFromINI(const IniFile &ini, const StudyVersion &version)
Load data from an INI file.
Definition parameters.cpp:1203
uint nbYears
Number of years to study.
Definition parameters.h:204
void fixRefreshIntervals()
Try to detect then fix refresh intervals.
Definition parameters.cpp:1293
Definition load-options.h:36
Version of a study.
Definition version.h:36
Data for an INI file.
Definition inifile.h:34
Definition adq-patch-params.h:91
Definition parameters.h:407
bool dayAhead
Day ahead reserve.
Definition parameters.h:375
bool strategic
Strategic reserve.
Definition parameters.h:377
bool spinning
Spinning reserve.
Definition parameters.h:379
bool primary
Primary reserve.
Definition parameters.h:381
bool minUPTime
Thermal cluster Min U/D Time.
Definition parameters.h:391
mpsExportStatus exportMPS
Flag to export mps files.
Definition parameters.h:395
bool hurdleCosts
Hurdle costs.
Definition parameters.h:370
UnfeasibleProblemBehavior unfeasibleProblemBehavior
Enum to define unfeasible problem behavior.
Definition parameters.h:401
bool constraints
Include binding constraints.
Definition parameters.h:368
bool exportStructure
a flag to export structure needed for Antares XPansion
Definition parameters.h:398
RenewableGenerationModelling rgModelling
Renewable generation mode.
Definition parameters.h:451
Definition parameters.h:432
void addExcludedVariables(std::vector< std::string > &) const
Some variables rely on dual values & marginal costs.
Definition parameters.cpp:2125
UnitCommitmentMode ucMode
Unit Commitment Mode.
Definition parameters.h:434
Definition date.h:164