Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
state.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 __SOLVER_VARIABLE_STATE_H__
22#define __SOLVER_VARIABLE_STATE_H__
23
24#include <array>
25#include <vector>
26
27#include <yuni/yuni.h>
28
29#include <antares/study/area/scratchpad.h>
30#include <antares/study/fwd.h>
31#include "antares/solver/simulation/sim_structure_donnees.h"
32#include "antares/solver/simulation/sim_structure_probleme_economique.h"
33
34namespace Antares::Solver::Variable
35{
37{
38public:
39 explicit ThermalState(const Data::AreaList& areas);
40
42 {
43 public:
44 void initializeFromArea(const Data::Area& area);
46 std::vector<double> thermalClustersProductions;
47
50 std::vector<double> thermalClustersOperatingCost;
51
54 std::vector<uint> numberOfUnitsONbyCluster;
55
57 std::vector<double> PMinOfClusters;
58
59 std::vector<unsigned int> unitCountLastHour;
60 std::vector<double> productionLastHour;
61 std::vector<double> pminOfAGroup;
62 };
63
64 StateForAnArea& operator[](size_t areaIndex);
65
66private:
67 std::vector<StateForAnArea> thermal;
68};
69
70class State
71{
72public:
73 explicit State(Data::Study& s);
74
80 void initFromAreaIndex(const unsigned int areaIndex, uint numSpace);
81
90 void initFromThermalClusterIndex(const unsigned int clusterEnabledIndex);
91
101 void yearEndBuildFromThermalClusterIndex(const unsigned int clusterEnabledIndex);
102
103private:
111 void initFromThermalClusterIndexProduction(const unsigned int clusterEnabledIndex);
112
113 void yearEndBuildThermalClusterCalculateStartupCosts(
114 const uint& maxDurationON,
115 const std::array<uint, HOURS_PER_YEAR>& ON_min,
116 const std::array<uint, HOURS_PER_YEAR>& ON_opt,
117 const Data::ThermalCluster* currentCluster);
118
119 std::array<uint, HOURS_PER_YEAR> computeEconomicallyOptimalNbClustersONforEachHour(
120 const uint& maxDurationON,
121 const std::array<uint, HOURS_PER_YEAR>& ON_min,
122 const std::array<uint, HOURS_PER_YEAR>& ON_max) const;
123
130 void yearEndSmoothDispatchedUnitsCount(const unsigned int clusterEnabledIndex, uint numSpace);
131
132public:
136 void startANewYear();
137
141 void yearEndResetThermal();
142
144 unsigned int year;
146 unsigned int weekInTheYear;
148 unsigned int hourInTheYear;
150 unsigned int hourInTheWeek;
153
156
159
166
168
169
174
176
177 RESULTATS_HORAIRES* hourlyResults;
180
182 double thermalClusterProductionForYear[HOURS_PER_YEAR];
186
193
194 double renewableClusterProduction;
195
197 const double* dispatchableMargin;
199
202
204 Data::SimulationMode simulationMode;
206 Data::UnitCommitmentMode unitCommitmentMode;
209 // Thermal data, used to compute overall cost, etc.
210 ThermalState thermal;
212 unsigned int numSpace;
217
218 // Annual costs to be printed in output into separate files
219 // -----------------------------------------------------------------
220 // Sum over all year's hours of :
221 // - sum over all areas of variable "overall cost"
222 // - sum over all links of variable "hurdle cost".
223 // That is : Somme(h in Y)[ Somme(a in areas)(OV. COST[h,a]) + Somme(l in links)(HURDLE
224 // COST[h,l]) ]
225 double annualSystemCost = 0.;
235 double averageUpdateTime = 0.;
236 // -----------------------------------------------------------------
237}; // class State
238
239} // namespace Antares::Solver::Variable
240
241#include "state.hxx"
242
243#endif // __SOLVER_VARIABLE_STATE_H__
A list of areas.
Definition area.h:366
Scratchpad for temporary data performed by the solver.
Definition scratchpad.h:43
Definition for a single area.
Definition area.h:52
Definition cluster.h:42
Definition study.h:61
A single thermal cluster.
Definition cluster.h:78
A n-by-n matrix.
Definition jit.h:30
Data::Area * area
The current area.
Definition state.h:155
Data::AreaLink * link
The current link.
Definition state.h:165
double optimalSolutionCost1
Sum of the weekly optimal costs over the year (first optimisation step)
Definition state.h:227
double thermalClusterPMinOfTheClusterForYear[HOURS_PER_YEAR]
Minimum power of the cluster for the whole year.
Definition state.h:192
double averageOptimizationTime2
Average time spent in second optimization over the year (ms)
Definition state.h:233
double thermalClusterOperatingCostForYear[HOURS_PER_YEAR]
Thermal operating cost for the current thermal cluster for the whole year.
Definition state.h:188
void initFromAreaIndex(const unsigned int areaIndex, uint numSpace)
Initialize some variables according an area index.
Definition state.hxx:66
void yearEndBuildFromThermalClusterIndex(const unsigned int clusterEnabledIndex)
End the year by smoothing the thermal units run and computing costs. We assume here that the variable...
Definition state.cpp:228
void startANewYear()
Reset internal data.
Definition state.hxx:30
double averageUpdateTime
Average time spent updating the problem over the year (ms)
Definition state.h:235
PROBLEME_HEBDO * problemeHebdo
Probleme Hebdo.
Definition state.h:201
Data::UnitCommitmentMode unitCommitmentMode
Study unit commitment mode: fast(ucHeuristic) / accurate(ucMILP)
Definition state.h:206
double thermalClusterProductionForYear[HOURS_PER_YEAR]
Thermal production for the current thermal cluster for the whole year.
Definition state.h:182
Data::Study & study
Reference to the original study.
Definition state.h:208
const double * dispatchableMargin
Dispatchable margin for the current area (valid only from weekForEachArea)
Definition state.h:197
VALEURS_DE_NTC_ET_RESISTANCES ntc
NTC Values.
Definition state.h:179
Matrix resSpilled
Spilled energy for all areas in the week.
Definition state.h:172
Data::ThermalCluster * thermalCluster
The current thermal cluster (used in yearEndBuildForEachThermalCluster functions)
Definition state.h:158
void yearEndResetThermal()
Reset thermal internal data for end of year calculations.
Definition state.hxx:53
Data::RenewableCluster * renewableCluster
The current renewable cluster.
Definition state.h:161
unsigned int hourInTheWeek
Current hour in the week (zero-based)
Definition state.h:150
unsigned int hourInTheSimulation
Current hour from the begining of the simulation.
Definition state.h:152
uint thermalClusterDispatchedUnitsCountForYear[HOURS_PER_YEAR]
Definition state.h:185
unsigned int year
Current year.
Definition state.h:144
double optimalSolutionCost2
Sum of the weekly optimal costs over the year (second optimisation step)
Definition state.h:229
double thermalClusterNonProportionalCostForYear[HOURS_PER_YEAR]
Thermal NP Cost for the current thermal cluster for the whole year.
Definition state.h:190
unsigned int weekInTheYear
Current week for current year (zero-based)
Definition state.h:146
Data::SimulationMode simulationMode
Simulation mode: economy / adequacy / expansion.
Definition state.h:204
void initFromThermalClusterIndex(const unsigned int clusterEnabledIndex)
Initialize some variable according a thermal cluster index.
Definition state.cpp:68
unsigned int numSpace
Index of the state in the state vector.
Definition state.h:212
bool simplexRunNeeded
Flag to know if the simplex has been used for the current week.
Definition state.h:216
double averageOptimizationTime1
Average time spent in first optimization over the year (ms)
Definition state.h:231
unsigned int hourInTheYear
Current hour in the year (zero-based)
Definition state.h:148
Data::AreaScratchpad * scratchpad
The Scratchpad for the current area.
Definition state.h:163
std::vector< double > thermalClustersOperatingCost
Definition state.h:50
std::vector< uint > numberOfUnitsONbyCluster
Definition state.h:54
std::vector< double > thermalClustersProductions
Thermal production for thermal clusters for the current hour in the year.
Definition state.h:46
std::vector< double > PMinOfClusters
Minimum power of all clusters for the current hour in the year.
Definition state.h:57
Definition sim_structure_probleme_economique.h:403
Definition sim_structure_probleme_economique.h:354
Definition sim_structure_probleme_economique.h:118