Antares Simulator
Power System Simulator
generator.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 __ANTARES_SOLVER_timeSeries_GENERATOR_H__
22 #define __ANTARES_SOLVER_timeSeries_GENERATOR_H__
23 
24 #include <yuni/yuni.h>
25 
26 #include <antares/series/series.h>
27 #include <antares/study/fwd.h>
28 #include <antares/study/parameters.h>
29 #include <antares/study/parts/thermal/cluster.h>
30 #include <antares/study/study.h>
31 
32 #include "xcast/xcast.h"
33 
34 namespace fs = std::filesystem;
35 using LinkPair = std::pair<std::string, std::string>;
36 using LinkPairs = std::vector<LinkPair>;
37 
38 namespace Antares::TSGenerator
39 {
40 
42 {
43  unsigned int nbLinkTStoGenerate = 1;
44  bool derated = false;
45  // gp : we will have a problem with that if seed-tsgen-links not set in
46  // gp : generaldata.ini. In that case, our default value is wrong.
47  MersenneTwister random;
48 };
49 
51 {
52  LinkPair namesPair;
53 
54  unsigned unitCount = 1;
55  double nominalCapacity = 0;
56 
57  double forcedVolatility = 0.;
58  double plannedVolatility = 0.;
59 
60  Data::StatisticalLaw forcedLaw = Data::LawUniform;
61  Data::StatisticalLaw plannedLaw = Data::LawUniform;
62 
63  std::unique_ptr<Data::PreproAvailability> prepro;
64 
65  Matrix<> modulationCapacityDirect;
66  Matrix<> modulationCapacityIndirect;
67 
68  bool forceNoGeneration = false;
69  bool hasValidData = true;
70 };
71 
73 {
74 public:
76 
78  Matrix<>& modulation,
79  const std::string& name);
80 
81  const unsigned& unitCount;
82  const double& nominalCapacity;
83 
84  const double& forcedVolatility;
85  const double& plannedVolatility;
86 
87  Data::StatisticalLaw& forcedLaw;
88  Data::StatisticalLaw& plannedLaw;
89 
91 
92  Matrix<>::ColumnType& modulationCapacity;
93 
94  const std::string& name;
95 };
96 
97 using listOfLinks = std::vector<Data::AreaLink*>;
98 
99 void ResizeGeneratedTimeSeries(Data::AreaList& areas, Data::Parameters& params);
100 
104 template<enum Data::TimeSeriesType T>
105 bool GenerateTimeSeries(Data::Study& study, IResultWriter& writer);
106 
107 bool generateThermalTimeSeries(Data::Study& study,
108  const std::vector<Data::ThermalCluster*>& clusters,
109  MersenneTwister& thermalRandom);
110 
111 void writeThermalTimeSeries(const std::vector<Data::ThermalCluster*>& clusters,
112  const fs::path& savePath);
113 
114 bool generateLinkTimeSeries(std::vector<LinkTSgenerationParams>& links,
116  const fs::path& savePath);
117 
118 std::vector<Data::ThermalCluster*> getAllClustersToGen(const Data::AreaList& areas,
119  bool globalThermalTSgeneration);
120 
124 void DestroyAll(Data::Study& study);
125 
129 template<enum Data::TimeSeriesType T>
130 void Destroy(Data::Study& study);
131 
132 } // namespace Antares::TSGenerator
133 
134 #include "generator.hxx"
135 
136 #endif // __ANTARES_SOLVER_timeSeries_GENERATOR_H__
A list of areas.
Definition: area.h:365
General data for a study.
Definition: parameters.h:51
Thermal.
Definition: prepro.h:35
Definition: study.h:57
A single thermal cluster.
Definition: cluster.h:76
A n-by-n matrix.
Definition: matrix.h:44
typename Antares::Memory::Stored< T >::Type ColumnType
Column type.
Definition: matrix.h:62
MersenneTwister Pseudo random number generator.
Definition: mersenne-twister.h:41
Definition: i_writer.h:32