Antares Simulator
Power System Simulator
xcast.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_LIBS_STUDY_XCAST_XCAST_H__
22 #define __ANTARES_LIBS_STUDY_XCAST_XCAST_H__
23 
24 #include <vector>
25 
26 #include <yuni/yuni.h>
27 #include <yuni/core/noncopyable.h>
28 
29 #include <antares/array/matrix.h>
30 #include <antares/study/fwd.h>
31 
32 namespace Antares::Data
33 {
34 class XCast final: private Yuni::NonCopyable<XCast>
35 {
36 public:
38  using Vector = std::vector<XCast*>;
40  using VectorConst = std::vector<const XCast*>;
41 
45  enum
46  {
47  dataCoeffAlpha = 0,
48  dataCoeffBeta,
49  dataCoeffGamma,
50  dataCoeffDelta,
51  dataCoeffTheta,
52  dataCoeffMu,
55  };
56 
61  {
63  dtNone = 0,
65  dtUniform = 1,
67  dtBeta = 2,
69  dtNormal = 3,
75  dtMax
76  };
77 
78  enum
79  {
82  };
83 
85  {
92  };
93 
94 public:
98  static const char* DistributionToCString(Distribution d);
99 
103  static Distribution StringToDistribution(AnyString str);
104 
108  static const char* DistributionToNameID(Distribution d);
109 
113  static const char* TSTranslationUseToCString(TSTranslationUse use);
114 
115  static TSTranslationUse CStringToTSTranslationUse(const AnyString& str);
116 
117 public:
119 
120 
123  XCast(TimeSeriesType ts);
127  ~XCast();
129 
133  void resetToDefaultValues();
134 
138  void copyFrom(const XCast& rhs);
139 
143  bool loadFromFolder(const std::filesystem::path& folder);
144 
148  bool saveToFolder(const AnyString& folder) const;
149 
151 
152 
155  bool forceReload(bool reload = false) const;
156 
160  void markAsModified() const;
161 
162 public:
167 
172 
177 
180 
183 
185  double capacity;
186 
195 
197  const TimeSeriesType timeSeries;
198 
199 protected:
200  void resetTransferFunction();
201 
202 }; // class XCast
203 
204 } // namespace Antares::Data
205 
206 #endif // __ANTARES_LIBS_STUDY_XCAST_XCAST_H__
Definition: xcast.h:35
bool forceReload(bool reload=false) const
Make sure that all data are loaded in memory.
Definition: xcast.cpp:413
std::vector< XCast * > Vector
Vector.
Definition: xcast.h:38
Distribution distribution
The probability distribution to use.
Definition: xcast.h:182
static const char * DistributionToNameID(Distribution d)
Convert a probability distribution into its string id representation.
Definition: xcast.cpp:78
@ dataMax
The maximum number of coefficients.
Definition: xcast.h:54
double capacity
The installed capacity.
Definition: xcast.h:185
Matrix< float > conversion
The conversion function.
Definition: xcast.h:194
TSTranslationUse useTranslation
How to use the timeseries average.
Definition: xcast.h:179
bool useConversion
True to use the transfer function after the generation of the time-series.
Definition: xcast.h:188
~XCast()
Destructor.
Definition: xcast.cpp:159
Distribution
All available probability distribution.
Definition: xcast.h:61
@ dtGammaShapeA
The Gamma distribution, of shape A.
Definition: xcast.h:73
@ dtNormal
The normal distribution.
Definition: xcast.h:69
@ dtMax
The maximum number of distributions.
Definition: xcast.h:75
@ dtWeibullShapeA
The Weibul distribution, of shape A.
Definition: xcast.h:71
@ dtNone
None.
Definition: xcast.h:63
@ dtBeta
The Beta distribution.
Definition: xcast.h:67
@ dtUniform
The uniform distribution.
Definition: xcast.h:65
Matrix< float > K
K (12x24)
Definition: xcast.h:171
void copyFrom(const XCast &rhs)
Copy settings from another XCast struct.
Definition: xcast.cpp:431
static const char * DistributionToCString(Distribution d)
Convert a distribution into its human readable representation.
Definition: xcast.cpp:71
@ conversionMaxPoints
Hard limit for the number of points of the transfer function.
Definition: xcast.h:81
Matrix< int32_t > translation
Time-series average.
Definition: xcast.h:176
bool loadFromFolder(const std::filesystem::path &folder)
Load data from a folder.
Definition: xcast.cpp:186
TSTranslationUse
Definition: xcast.h:85
@ tsTranslationNone
Do not use the time-series average.
Definition: xcast.h:87
@ tsTranslationBeforeConversion
Add the time-series average before computing the transfer function.
Definition: xcast.h:89
@ tsTranslationAfterConversion
Add the time-series average after computing the transfer function.
Definition: xcast.h:91
Matrix< float > data
Data required for XCast: coefficients (coeffMax x 12)
Definition: xcast.h:166
bool saveToFolder(const AnyString &folder) const
Save data to a folder.
Definition: xcast.cpp:353
void markAsModified() const
Mark the load data as modified.
Definition: xcast.cpp:423
std::vector< const XCast * > VectorConst
Vector with the const qualifier.
Definition: xcast.h:40
XCast(TimeSeriesType ts)
Constructor.
Definition: xcast.cpp:147
static Distribution StringToDistribution(AnyString str)
Convert a CString into a probability distribution.
Definition: xcast.cpp:92
static const char * TSTranslationUseToCString(TSTranslationUse use)
How to use the timeseries average.
Definition: xcast.cpp:40
void resetToDefaultValues()
Reset to default values.
Definition: xcast.cpp:167
const TimeSeriesType timeSeries
The related time-series.
Definition: xcast.h:197
A n-by-n matrix.
Definition: matrix.h:44