Antares Simulator
Power System Simulator
cluster.hxx
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_PARTS_THERMAL_CLUSTER_HXX__
22 #define __ANTARES_LIBS_STUDY_PARTS_THERMAL_CLUSTER_HXX__
23 
24 namespace Yuni::Extension::CString
25 {
26 template<class CStringT>
27 class Append<CStringT, Antares::Data::StatisticalLaw>
28 {
29 public:
30  static void Perform(CStringT& string, Antares::Data::StatisticalLaw law)
31  {
32  switch (law)
33  {
34  case Antares::Data::LawUniform:
35  string += "uniform";
36  break;
37  case Antares::Data::LawGeometric:
38  string += "geometric";
39  break;
40  }
41  }
42 };
43 
44 template<class CStringT>
45 class Append<CStringT, Antares::Data::CostGeneration>
46 {
47 public:
48  static void Perform(CStringT& string, Antares::Data::CostGeneration costgeneration)
49  {
50  switch (costgeneration)
51  {
52  case Antares::Data::setManually:
53  string += "setManually";
54  break;
55  case Antares::Data::useCostTimeseries:
56  string += "useCostTimeseries";
57  break;
58  }
59  }
60 };
61 
62 template<class CStringT>
63 class Append<CStringT, Antares::Data::LocalTSGenerationBehavior>
64 {
65 public:
66  static void Perform(CStringT& string, Antares::Data::LocalTSGenerationBehavior behavior)
67  {
68  switch (behavior)
69  {
70  case Antares::Data::LocalTSGenerationBehavior::forceGen:
71  string += "force generation";
72  break;
73  case Antares::Data::LocalTSGenerationBehavior::forceNoGen:
74  string += "force no generation";
75  break;
76  default:
77  string += "use global";
78  break;
79  }
80  }
81 };
82 
83 template<>
84 class Into<Antares::Data::StatisticalLaw>
85 {
86 public:
87  using TargetType = Antares::Data::StatisticalLaw;
88 
89  enum
90  {
91  valid = 1
92  };
93 
94  static bool Perform(AnyString string, TargetType& out);
95 
96  template<class StringT>
97  static TargetType Perform(const StringT& s)
98  {
99  TargetType law = Antares::Data::LawUniform;
100  Perform(s, law);
101  return law;
102  }
103 };
104 
105 template<>
106 class Into<Antares::Data::CostGeneration>
107 {
108 public:
109  using TargetType = Antares::Data::CostGeneration;
110  enum class Validation
111  {
112  valid = 1
113  };
114 
115  static bool Perform(AnyString string, TargetType& out);
116 
117  template<class StringT>
118  static TargetType Perform(const StringT& s)
119  {
120  TargetType costgeneration = Antares::Data::setManually;
121  Perform(s, costgeneration);
122  return costgeneration;
123  }
124 };
125 
126 template<>
127 class Into<Antares::Data::LocalTSGenerationBehavior>
128 {
129 public:
130  using TargetType = Antares::Data::LocalTSGenerationBehavior;
131 
132  enum
133  {
134  valid = 1
135  };
136 
137  static bool Perform(AnyString string, TargetType& out);
138 
139  template<class StringT>
140  static TargetType Perform(const StringT& s)
141  {
142  TargetType behavior = Antares::Data::LocalTSGenerationBehavior::useGlobalParameter;
143  Perform(s, behavior);
144  return behavior;
145  }
146 };
147 
148 } // namespace Yuni::Extension::CString
149 
150 #endif // __ANTARES_LIBS_STUDY_PARTS_THERMAL_CLUSTER_HXX__