Antares Simulator
Power System Simulator
Library.h
1 
2 /*
3  * Copyright 2007-2025, RTE (https://www.rte-france.com)
4  * See AUTHORS.txt
5  * SPDX-License-Identifier: MPL-2.0
6  * This file is part of Antares-Simulator,
7  * Adequacy and Performance assessment for interconnected energy networks.
8  *
9  * Antares_Simulator is free software: you can redistribute it and/or modify
10  * it under the terms of the Mozilla Public Licence 2.0 as published by
11  * the Mozilla Foundation, either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Antares_Simulator is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * Mozilla Public Licence 2.0 for more details.
18  *
19  * You should have received a copy of the Mozilla Public Licence 2.0
20  * along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
21  */
22 
23 #pragma once
24 
25 #include <string>
26 #include <vector>
27 
28 namespace Antares::IO::Inputs::YmlModel
29 {
30 // Define structures
31 struct Parameter
32 {
33  std::string id;
34  bool time_dependent;
35  bool scenario_dependent;
36 };
37 
38 enum class ValueType
39 {
40  CONTINUOUS,
41  INTEGER,
42  BOOL
43 };
44 
45 inline std::string toString(const ValueType& value_type)
46 {
47  using namespace std::string_literals;
48  switch (value_type)
49  {
50  case ValueType::CONTINUOUS:
51  return "CONTINUOUS"s;
52  case ValueType::INTEGER:
53  return "INTEGER"s;
54  case ValueType::BOOL:
55  return "BOOL"s;
56  default:
57  return "UNKNOWN"s;
58  }
59 }
60 
61 struct Variable
62 {
63  std::string id;
64  std::string lower_bound;
65  std::string upper_bound;
66  ValueType variable_type;
67  bool time_dependent;
68  bool scenario_dependent;
69  std::string location;
70 };
71 
72 struct Port
73 {
74  std::string id;
75  std::string type;
76 };
77 
79 {
80  std::string port;
81  std::string field;
82  std::string definition;
83 };
84 
85 struct Constraint
86 {
87  std::string id;
88  std::string expression;
89  std::string location;
90 };
91 
93 {
94  std::string id;
95  std::string expression;
96 };
97 
98 struct Objective
99 {
100  std::string id;
101  std::string expression;
102  std::string location;
103 };
104 
105 struct Model
106 {
107  std::string id;
108  std::string description;
109  std::vector<Parameter> parameters;
110  std::vector<Variable> variables;
111  std::vector<Port> ports;
112  std::vector<PortFieldDefinition> port_field_definitions;
113  std::vector<Constraint> constraints;
114  std::vector<Constraint> binding_constraints;
115  std::vector<Objective> objectives;
116  std::vector<ExtraOutput> extra_outputs;
117 };
118 
119 struct PortType
120 {
121  std::string id;
122  std::string description;
123  // Small optimization: we only need the name of the fields
124  // No need for an intermediate struct "field" with just a string "name" member
125  std::vector<std::string> fields;
126  // Also, we only need the injection-field of the area-connection
127  std::string area_connection_injection_field;
128 };
129 
130 struct Library
131 {
132  std::string id;
133  std::string description;
134  std::vector<PortType> port_types;
135  std::vector<Model> models;
136 };
137 } // namespace Antares::IO::Inputs::YmlModel
Definition: Library.h:106
Definition: Library.h:73