Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
rules.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 __LIBS_STUDY_SCENARIO_BUILDER_RULES_H__
22#define __LIBS_STUDY_SCENARIO_BUILDER_RULES_H__
23
24#include <map>
25#include <memory>
26
27#include <yuni/yuni.h>
28#include <yuni/core/string.h>
29
30#include "../fwd.h"
31#include "BindingConstraintsTSNumbersData.h"
32#include "HydroTSNumberData.h"
33#include "LoadTSNumberData.h"
34#include "NTCTSNumberData.h"
35#include "RenewableTSNumberData.h"
36#include "TSnumberData.h"
37#include "ThermalTSNumberData.h"
38#include "WindTSNumberData.h"
39#include "hydroLevelsData.h"
40#include "solarTSNumberData.h"
41
42namespace Antares
43{
44namespace Data
45{
46namespace ScenarioBuilder
47{
51class Rules final: private Yuni::NonCopyable<Rules>
52{
53public:
55 using Ptr = std::shared_ptr<Rules>;
57 using Map = std::map<RulesScenarioName, Ptr>;
59 using MappingID = std::map<int, Ptr>;
60
62
63
68 explicit Rules(Study& study);
70 ~Rules() = default;
72
74
75
78 bool reset();
79
83 bool readLine(const AreaName::Vector& splitKey, const String& value, bool updaterMode = false);
84
88 void saveToINIFile(Yuni::IO::File::Stream& file) const;
90
92 uint areaCount() const;
93
95 const RulesScenarioName& name() const;
96 void setName(RulesScenarioName name);
97
103 bool apply();
104
105 // When current rule is the active one, sends warnings for disabled clusters.
106 void sendWarningsForDisabledClusters();
107
116
118 std::vector<thermalTSNumberData> thermal;
120 std::vector<renewableTSNumberData> renewable;
121
123 hydroLevelsData hydroInitialLevels = {"hl,", initLevelApply};
125 hydroLevelsData hydroFinalLevels = {"hfl,", finalLevelApply};
126
127 // Links NTC
128 std::vector<ntcTSNumberData> linksNTC;
129
130 BindingConstraintsTSNumberData binding_constraints;
131
132private:
133 // Member methods
134 bool readThermalCluster(const AreaName::Vector& instrs, const String& value, bool updaterMode);
135 bool readRenewableCluster(const AreaName::Vector& instrs,
136 const String& value,
137 bool updaterMode);
138 bool readLoad(const AreaName::Vector& instrs, const String& value, bool updaterMode);
139 bool readWind(const AreaName::Vector& instrs, const String& value, bool updaterMode);
140 bool readHydro(const AreaName::Vector& instrs, const String& value, bool updaterMode);
141 bool readSolar(const AreaName::Vector& instrs, const String& value, bool updaterMode);
142 bool readInitialHydroLevels(const AreaName::Vector& instrs,
143 const String& value,
144 bool updaterMode);
145 bool readFinalHydroLevels(const AreaName::Vector& instrs,
146 const String& value,
147 bool updaterMode);
148 bool readLink(const AreaName::Vector& instrs, const String& value, bool updaterMode);
149 bool readBindingConstraints(const AreaName::Vector& splitKey, const String& value);
150
151 Data::Area* getArea(const AreaName& areaname, bool updaterMode);
152 Data::AreaLink* getLink(const AreaName& fromAreaName,
153 const AreaName& toAreaName,
154 bool updaterMode);
155 bool checkGroupExists(const std::string& groupName) const;
156
157 // Member data
158 Study& study_;
160 uint pAreaCount;
162 RulesScenarioName pName;
163 // Disabled clusters when current rule is active (useful for sending warnings)
164 std::map<std::string, std::vector<uint>> disabledClustersOnRuleActive;
165
166}; // class Rules
167
168} // namespace ScenarioBuilder
169} // namespace Data
170} // namespace Antares
171
172#include "rules.hxx"
173
174#endif // __LIBS_STUDY_SCENARIO_BUILDER_RULES_H__
Definition for a single area.
Definition area.h:52
Definition BindingConstraintsTSNumbersData.h:32
Rules for TS numbers, for all years and a single timeseries.
Definition rules.h:52
std::vector< renewableTSNumberData > renewable
Renewable (array [0..pAreaCount - 1])
Definition rules.h:120
std::vector< thermalTSNumberData > thermal
Thermal (array [0..pAreaCount - 1])
Definition rules.h:118
Rules(Study &study)
Default constructor.
Definition rules.cpp:35
loadTSNumberData load
Load.
Definition rules.h:109
hydroTSNumberData hydro
Hydro.
Definition rules.h:113
bool reset()
Initialize data from the study.
Definition rules.cpp:69
void saveToINIFile(Yuni::IO::File::Stream &file) const
Export the data into a mere INI file.
Definition rules.cpp:41
std::map< RulesScenarioName, Ptr > Map
Map.
Definition rules.h:57
bool apply()
Apply the changes to the timeseries number matrices.
Definition rules.cpp:435
bool readLine(const AreaName::Vector &splitKey, const String &value, bool updaterMode=false)
Load information from a single line (extracted from an INI file)
Definition rules.cpp:379
solarTSNumberData solar
Solar.
Definition rules.h:111
hydroLevelsData hydroFinalLevels
hydro final levels
Definition rules.h:125
hydroLevelsData hydroInitialLevels
hydro initial levels
Definition rules.h:123
const RulesScenarioName & name() const
Name of the rules set.
Definition rules.hxx:35
std::shared_ptr< Rules > Ptr
Smart pointer.
Definition rules.h:55
std::map< int, Ptr > MappingID
Map ID.
Definition rules.h:59
uint areaCount() const
Get the number of areas.
Definition rules.hxx:30
windTSNumberData wind
Wind.
Definition rules.h:115
Rules for hydro levels, for all years and areas.
Definition hydroLevelsData.h:38
Definition HydroTSNumberData.h:29
Definition LoadTSNumberData.h:29
Definition solarTSNumberData.h:33
Definition WindTSNumberData.h:29
Definition study.h:61