diff --git a/src/libs/antares/study/include/antares/study/area/area.h b/src/libs/antares/study/include/antares/study/area/area.h
index 59eaf54ecf..f3fb1c6cf0 100644
--- a/src/libs/antares/study/include/antares/study/area/area.h
+++ b/src/libs/antares/study/include/antares/study/area/area.h
@@ -358,9 +358,9 @@ class Area final: private Yuni::NonCopyable
/// \name AllCapacityReservations structure to keep track of the added capacity reservations
AllCapacityReservations allCapacityReservations;
- BiMap>
+ BiMap>
reserveParticipationThermalClustersIndexMap;
- BiMap>
+ BiMap>
reserveParticipationSTStorageClustersIndexMap;
BiMap reserveParticipationLTStorageIndexMap;
diff --git a/src/libs/antares/study/parts/short-term-storage/cluster.cpp b/src/libs/antares/study/parts/short-term-storage/cluster.cpp
index f7ef1af3b8..f6cb5071b1 100644
--- a/src/libs/antares/study/parts/short-term-storage/cluster.cpp
+++ b/src/libs/antares/study/parts/short-term-storage/cluster.cpp
@@ -47,15 +47,14 @@ const char* STStorageCluster::GroupName(enum Group grp)
case Group::Other2:
return "Other2";
case Group::Other3:
- return "Other 3";
+ return "Other3";
case Group::Other4:
- return "Other 4";
+ return "Other4";
case Group::Other5:
- return "Other 5";
- case Group::groupMax:
- return "";
+ return "Other5";
+ default :
+ throw std::out_of_range("groupMax shouln't be printed");
}
- return "";
} // namespace Antares::Data::ShortTermStorage
bool STStorageCluster::loadFromSection(const IniFile::Section& section)
diff --git a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOffUnitsPlant.h b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOffUnitsPlant.h
index 8013e799a0..f502d543b9 100644
--- a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOffUnitsPlant.h
+++ b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOffUnitsPlant.h
@@ -172,24 +172,6 @@ class ReserveParticipationByDispatchableOffUnitsPlant
void yearEndBuildForEachThermalCluster(State& state, uint year, unsigned int numSpace)
{
- // Get end year calculations
- if (pSize)
- {
- for (unsigned int i = state.study.runtime.rangeLimits.hour[Data::rangeBegin];
- i <= state.study.runtime.rangeLimits.hour[Data::rangeEnd];
- ++i)
- {
- for (auto const& [reserveName, reserveParticipation] :
- state.reserveParticipationPerThermalClusterForYear[i][state.thermalCluster->name()])
- {
- pValuesForTheCurrentYear
- [numSpace][state.area->reserveParticipationThermalClustersIndexMap.get(
- std::make_pair(reserveName, state.thermalCluster->name()))]
- .hour[i]
- = reserveParticipation.offUnitsParticipation;
- }
- }
- }
// Next variable
NextType::yearEndBuildForEachThermalCluster(state, year, numSpace);
}
@@ -239,6 +221,21 @@ class ReserveParticipationByDispatchableOffUnitsPlant
void hourForEachArea(State& state, unsigned int numSpace)
{
+ // Get end year calculations
+ for (auto& [clusterName, _]:
+ state.reserveParticipationPerThermalClusterForYear[state.hourInTheYear])
+ {
+ for (const auto& [reserveName, reserveParticipation]:
+ state
+ .reserveParticipationPerThermalClusterForYear[state.hourInTheYear][clusterName])
+ {
+ pValuesForTheCurrentYear[numSpace]
+ [state.area->reserveParticipationThermalClustersIndexMap
+ .get(std::make_pair(reserveName, clusterName))]
+ .hour[state.hourInTheYear]
+ = reserveParticipation.offUnitsParticipation;
+ }
+ }
// Next variable
NextType::hourForEachArea(state, numSpace);
}
@@ -273,9 +270,10 @@ class ReserveParticipationByDispatchableOffUnitsPlant
}
else
{
- auto [clusterName, reserveName]
- = results.data.area->reserveParticipationThermalClustersIndexMap.get(i);
- results.variableCaption = clusterName + "_" + reserveName; // VCardType::Caption();
+ auto [reserveName, clusterName]
+ = results.data.area->reserveParticipationThermalClustersIndexMap.get(i);
+ results.variableCaption = reserveName + "_" + clusterName
+ + "_off"; // VCardType::Caption();
results.variableUnit = VCardType::Unit();
pValuesForTheCurrentYear[numSpace][i].template buildAnnualSurveyReport(
results, fileLevel, precision);
diff --git a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOnUnitsPlant.h b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOnUnitsPlant.h
index 7a7ca8e4f9..0556ca76f9 100644
--- a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOnUnitsPlant.h
+++ b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOnUnitsPlant.h
@@ -172,24 +172,6 @@ class ReserveParticipationByDispatchableOnUnitsPlant
void yearEndBuildForEachThermalCluster(State& state, uint year, unsigned int numSpace)
{
- // Get end year calculations
- if (pSize)
- {
- for (unsigned int i = state.study.runtime.rangeLimits.hour[Data::rangeBegin];
- i <= state.study.runtime.rangeLimits.hour[Data::rangeEnd];
- ++i)
- {
- for (auto const& [reserveName, reserveParticipation] :
- state.reserveParticipationPerThermalClusterForYear[i][state.thermalCluster->name()])
- {
- pValuesForTheCurrentYear
- [numSpace][state.area->reserveParticipationThermalClustersIndexMap.get(
- std::make_pair(reserveName, state.thermalCluster->name()))]
- .hour[i]
- = reserveParticipation.onUnitsParticipation;
- }
- }
- }
// Next variable
NextType::yearEndBuildForEachThermalCluster(state, year, numSpace);
}
@@ -239,6 +221,22 @@ class ReserveParticipationByDispatchableOnUnitsPlant
void hourForEachArea(State& state, unsigned int numSpace)
{
+ // Get end year calculations
+ for (auto& [clusterName, _]:
+ state.reserveParticipationPerThermalClusterForYear[state.hourInTheYear])
+ {
+ for (const auto& [reserveName, reserveParticipation]:
+ state
+ .reserveParticipationPerThermalClusterForYear[state.hourInTheYear][clusterName])
+ {
+ pValuesForTheCurrentYear[numSpace]
+ [state.area->reserveParticipationThermalClustersIndexMap
+ .get(std::make_pair(reserveName, clusterName))]
+ .hour[state.hourInTheYear]
+ = reserveParticipation.onUnitsParticipation;
+ }
+ }
+
// Next variable
NextType::hourForEachArea(state, numSpace);
}
@@ -273,9 +271,10 @@ class ReserveParticipationByDispatchableOnUnitsPlant
}
else
{
- auto [clusterName, reserveName]
- = results.data.area->reserveParticipationThermalClustersIndexMap.get(i);
- results.variableCaption = clusterName + "_" + reserveName; // VCardType::Caption();
+ auto [reserveName, clusterName]
+ = results.data.area->reserveParticipationThermalClustersIndexMap.get(i);
+ results.variableCaption = reserveName + "_"
+ + clusterName; // VCardType::Caption();
results.variableUnit = VCardType::Unit();
pValuesForTheCurrentYear[numSpace][i].template buildAnnualSurveyReport(
results, fileLevel, precision);
diff --git a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchablePlant.h b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchablePlant.h
deleted file mode 100644
index 863e203898..0000000000
--- a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchablePlant.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
-** Copyright 2007-2023 RTE
-** Authors: Antares_Simulator Team
-**
-** This file is part of Antares_Simulator.
-**
-** Antares_Simulator is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** There are special exceptions to the terms and conditions of the
-** license as they are applied to this software. View the full text of
-** the exceptions in file COPYING.txt in the directory of this software
-** distribution
-**
-** Antares_Simulator is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with Antares_Simulator. If not, see .
-**
-** SPDX-License-Identifier: licenceRef-GPL3_WITH_RTE-Exceptions
-*/
-#ifndef __SOLVER_VARIABLE_ECONOMY_ReserveParticipationByDispatchableOnUnitsPlant_H__
-#define __SOLVER_VARIABLE_ECONOMY_ReserveParticipationByDispatchableOnUnitsPlant_H__
-
-#include "../variable.h"
-#include "./vCardReserveParticipationByDispatchableOnUnitsPlant.h"
-
-namespace Antares
-{
-namespace Solver
-{
-namespace Variable
-{
-namespace Economy
-{
-
-/*!
-** \brief C02 Average value of the overrall OperatingCost emissions expected from all
-** the thermal dispatchable clusters
-*/
-template
-class ReserveParticipationByDispatchableOnUnitsPlant
- : public Variable::IVariable,
- NextT,
- VCardReserveParticipationByDispatchableOnUnitsPlant>
-{
-public:
- //! Type of the next static variable
- typedef NextT NextType;
- //! VCard
- typedef VCardReserveParticipationByDispatchableOnUnitsPlant VCardType;
- //! Ancestor
- typedef Variable::IVariable, NextT, VCardType>
- AncestorType;
-
- //! List of expected results
- typedef typename VCardType::ResultsType ResultsType;
-
- typedef VariableAccessor VariableAccessorType;
-
- enum
- {
- //! How many items have we got
- count = 1 + NextT::count,
- };
-
- template
- struct Statistics
- {
- enum
- {
- count
- = ((VCardType::categoryDataLevel & CDataLevel && VCardType::categoryFileLevel & CFile)
- ? (NextType::template Statistics::count
- + VCardType::columnCount * ResultsType::count)
- : NextType::template Statistics::count),
- };
- };
-
-public:
- ReserveParticipationByDispatchableOnUnitsPlant() : pValuesForTheCurrentYear(NULL), pSize(0)
- {
- }
-
- ~ReserveParticipationByDispatchableOnUnitsPlant()
- {
- for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
- delete[] pValuesForTheCurrentYear[numSpace];
- delete[] pValuesForTheCurrentYear;
- }
-
- void initializeFromStudy(Data::Study& study)
- {
- // Next
- NextType::initializeFromStudy(study);
- }
-
- void initializeFromArea(Data::Study* study, Data::Area* area)
- {
- // Get the number of years in parallel
- pNbYearsParallel = study->maxNbYearsInParallel;
- pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel];
-
- // Get the number of thermal reserveParticipations
- pSize = area->thermal.list.reserveParticipationsCount();
- if (pSize)
- {
- AncestorType::pResults.resize(pSize);
- for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
- pValuesForTheCurrentYear[numSpace]
- = new VCardType::IntermediateValuesDeepType[pSize];
-
- for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
- for (unsigned int i = 0; i != pSize; ++i)
- pValuesForTheCurrentYear[numSpace][i].initializeFromStudy(*study);
-
- for (unsigned int i = 0; i != pSize; ++i)
- {
- AncestorType::pResults[i].initializeFromStudy(*study);
- AncestorType::pResults[i].reset();
- }
- }
- else
- {
- for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
- pValuesForTheCurrentYear[numSpace] = nullptr;
-
- AncestorType::pResults.clear();
- }
-
- // Next
- NextType::initializeFromArea(study, area);
- }
-
- size_t getMaxNumberColumns() const
- {
- return pSize * ResultsType::count;
- }
-
- void initializeFromLink(Data::Study* study, Data::AreaLink* link)
- {
- // Next
- NextType::initializeFromAreaLink(study, link);
- }
-
- void simulationBegin()
- {
- // Next
- NextType::simulationBegin();
- }
-
- void simulationEnd()
- {
- NextType::simulationEnd();
- }
-
- void yearBegin(unsigned int year, unsigned int numSpace)
- {
- // Reset the values for the current year
- for (unsigned int i = 0; i != pSize; ++i)
- pValuesForTheCurrentYear[numSpace][i].reset();
-
- // Next variable
- NextType::yearBegin(year, numSpace);
- }
-
- void yearEndBuildForEachThermalCluster(State& state, uint year, unsigned int numSpace)
- {
- // Get end year calculations
- if (pSize)
- {
- for (unsigned int i = state.study.runtime.rangeLimits.hour[Data::rangeBegin];
- i <= state.study.runtime.rangeLimits.hour[Data::rangeEnd];
- ++i)
- {
- for (auto const& [reserveName, reserveParticipation] :
- state.reserveParticipationPerClusterForYear[i][state.thermalCluster->name()])
- {
- pValuesForTheCurrentYear
- [numSpace][state.getAreaIndexReserveParticipationFromReserveAndThermalCluster(
- reserveName, state.thermalCluster->name())]
- .hour[i]
- = reserveParticipation.onUnitsParticipation;
- }
- }
- }
-
- // Next variable
- NextType::yearEndBuildForEachThermalCluster(state, year, numSpace);
- }
-
- void yearEndBuild(State& state, unsigned int year)
- {
- // Next variable
- NextType::yearEndBuild(state, year);
- }
-
- void yearEnd(unsigned int year, unsigned int numSpace)
- {
- // Merge all results for all thermal clusters
- {
- for (unsigned int i = 0; i < pSize; ++i)
- {
- // Compute all statistics for the current year (daily,weekly,monthly)
- pValuesForTheCurrentYear[numSpace][i].computeStatisticsForTheCurrentYear();
- }
- }
- // Next variable
- NextType::yearEnd(year, numSpace);
- }
-
- void computeSummary(std::map& numSpaceToYear,
- unsigned int nbYearsForCurrentSummary)
- {
- for (unsigned int numSpace = 0; numSpace < nbYearsForCurrentSummary; ++numSpace)
- {
- for (unsigned int i = 0; i < pSize; ++i)
- {
- // Merge all those values with the global results
- AncestorType::pResults[i].merge(numSpaceToYear[numSpace],
- pValuesForTheCurrentYear[numSpace][i]);
- }
- }
-
- // Next variable
- NextType::computeSummary(numSpaceToYear, nbYearsForCurrentSummary);
- }
-
- void hourBegin(unsigned int hourInTheYear)
- {
- // Next variable
- NextType::hourBegin(hourInTheYear);
- }
-
- void hourForEachArea(State& state, unsigned int numSpace)
- {
- // Next variable
- NextType::hourForEachArea(state, numSpace);
- }
-
- Antares::Memory::Stored::ConstReturnType retrieveRawHourlyValuesForCurrentYear(
- unsigned int,
- unsigned int numSpace) const
- {
- return pValuesForTheCurrentYear[numSpace]->hour;
- }
-
- void localBuildAnnualSurveyReport(SurveyResults& results,
- int fileLevel,
- int precision,
- unsigned int numSpace) const
- {
- // Initializing external pointer on current variable non applicable status
- results.isCurrentVarNA = AncestorType::isNonApplicable;
-
- if (AncestorType::isPrinted[0])
- {
- assert(NULL != results.data.area);
- const auto& thermal = results.data.area->thermal;
-
- // Write the data for the current year
- for (uint i = 0; i < pSize; ++i)
- {
- // Write the data for the current year
- results.variableCaption = thermal.list[i]->name(); // VCardType::Caption();
- results.variableUnit = VCardType::Unit();
- pValuesForTheCurrentYear[numSpace][i].template buildAnnualSurveyReport(
- results, fileLevel, precision);
- }
- }
- }
-
-private:
- //! Intermediate values for each year
- typename VCardType::IntermediateValuesType pValuesForTheCurrentYear;
- size_t pSize;
- unsigned int pNbYearsParallel;
-
-}; // class ReserveParticipationByDispatchableOnUnitsPlant
-
-} // namespace Economy
-} // namespace Variable
-} // namespace Solver
-} // namespace Antares
-
-#endif // __SOLVER_VARIABLE_ECONOMY_ReserveParticipationByDispatchableOnUnitsPlant_H__
\ No newline at end of file
diff --git a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationBySTStorageGroup.h b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationBySTStorageGroup.h
index 9ae580066a..c32e1319a4 100644
--- a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationBySTStorageGroup.h
+++ b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationBySTStorageGroup.h
@@ -105,16 +105,12 @@ class ReserveParticipationBySTStorageGroup
pNbYearsParallel = study->maxNbYearsInParallel;
pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel];
- // Get the area
- pSize = 0;
- for (auto res : area->allCapacityReservations.areaCapacityReservationsUp)
- {
- pSize += Antares::Data::ShortTermStorage::Group::groupMax;
- }
- for (auto res : area->allCapacityReservations.areaCapacityReservationsDown)
- {
- pSize += Antares::Data::ShortTermStorage::Group::groupMax;
- }
+ // Get the number of potential group reserve participation
+ pSize = area->allCapacityReservations.areaCapacityReservationsUp.size()
+ * Antares::Data::ShortTermStorage::groupMax
+ + area->allCapacityReservations.areaCapacityReservationsDown.size()
+ * Antares::Data::ShortTermStorage::groupMax;
+
if (pSize)
{
AncestorType::pResults.resize(pSize);
@@ -234,7 +230,7 @@ class ReserveParticipationBySTStorageGroup
{
auto& area = state.area;
int column = 0;
- for (auto [reserveName, _] : area->allCapacityReservations.areaCapacityReservationsUp)
+ for (const auto& [reserveName, _]: area->allCapacityReservations.areaCapacityReservationsUp)
{
for (int indexGroup = 0; indexGroup < Antares::Data::ShortTermStorage::groupMax;
indexGroup++)
@@ -246,7 +242,8 @@ class ReserveParticipationBySTStorageGroup
column++;
}
}
- for (auto [reserveName, _] : area->allCapacityReservations.areaCapacityReservationsDown)
+ for (const auto& [reserveName, _]:
+ area->allCapacityReservations.areaCapacityReservationsDown)
{
for (int indexGroup = 0; indexGroup < Antares::Data::ShortTermStorage::groupMax;
indexGroup++)
@@ -283,14 +280,14 @@ class ReserveParticipationBySTStorageGroup
// Write the data for the current year
int column = 0;
- for (auto& res : results.data.area->allCapacityReservations.areaCapacityReservationsUp)
+ for (const auto& [resName, _]:
+ results.data.area->allCapacityReservations.areaCapacityReservationsUp)
{
- for (int indexGroup = 0;
- indexGroup < Antares::Data::ShortTermStorage::Group::groupMax;
+ for (int indexGroup = 0; indexGroup < Antares::Data::ShortTermStorage::groupMax;
indexGroup++)
{
// Write the data for the current year
- Yuni::String caption = res.first;
+ Yuni::String caption = resName;
caption << "_"
<< Antares::Data::ShortTermStorage::STStorageCluster::GroupName(
static_cast(indexGroup));
@@ -301,15 +298,14 @@ class ReserveParticipationBySTStorageGroup
column++;
}
}
- for (auto& res :
+ for (const auto& [resName, _]:
results.data.area->allCapacityReservations.areaCapacityReservationsDown)
{
- for (int indexGroup = 0;
- indexGroup < Antares::Data::ShortTermStorage::Group::groupMax;
+ for (int indexGroup = 0; indexGroup < Antares::Data::ShortTermStorage::groupMax;
indexGroup++)
{
// Write the data for the current year
- Yuni::String caption = res.first;
+ Yuni::String caption = resName;
caption << "_"
<< Antares::Data::ShortTermStorage::STStorageCluster::GroupName(
static_cast(indexGroup));
diff --git a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByThermalGroup.h b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByThermalGroup.h
index 36117e17f4..d05ad408b9 100644
--- a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByThermalGroup.h
+++ b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByThermalGroup.h
@@ -103,16 +103,11 @@ class ReserveParticipationByThermalGroup : public Variable::IVariablemaxNbYearsInParallel;
pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel];
- // Get the area
- pSize = 0;
- for (auto res : area->allCapacityReservations.areaCapacityReservationsUp)
- {
- pSize += Antares::Data::groupMax;
- }
- for (auto res : area->allCapacityReservations.areaCapacityReservationsDown)
- {
- pSize += Antares::Data::groupMax;
- }
+ // Get the number of potential group reserve participation
+ pSize = area->allCapacityReservations.areaCapacityReservationsUp.size()
+ * Antares::Data::groupMax
+ + area->allCapacityReservations.areaCapacityReservationsDown.size()
+ * Antares::Data::groupMax;
if (pSize)
{
AncestorType::pResults.resize(pSize);
@@ -233,7 +228,7 @@ class ReserveParticipationByThermalGroup : public Variable::IVariableallCapacityReservations.areaCapacityReservationsUp)
+ for (const auto& [reserveName, _]: area->allCapacityReservations.areaCapacityReservationsUp)
{
for (int indexGroup = 0; indexGroup < Antares::Data::groupMax; indexGroup++)
{
@@ -244,7 +239,8 @@ class ReserveParticipationByThermalGroup : public Variable::IVariableallCapacityReservations.areaCapacityReservationsDown)
+ for (const auto& [reserveName, _]:
+ area->allCapacityReservations.areaCapacityReservationsDown)
{
for (int indexGroup = 0; indexGroup < Antares::Data::groupMax; indexGroup++)
{
@@ -277,16 +273,15 @@ class ReserveParticipationByThermalGroup : public Variable::IVariablethermal;
-
// Write the data for the current year
int column = 0;
- for (auto res : results.data.area->allCapacityReservations.areaCapacityReservationsUp)
+ for (const auto& [resName, _]:
+ results.data.area->allCapacityReservations.areaCapacityReservationsUp)
{
for (int indexGroup = 0; indexGroup < Antares::Data::groupMax; indexGroup++)
{
// Write the data for the current year
- Yuni::String caption = res.first;
+ Yuni::String caption = resName;
caption << "_" << Data::ThermalCluster::GroupName(static_cast(indexGroup));
results.variableCaption = caption; // VCardType::Caption();
results.variableUnit = VCardType::Unit();
@@ -295,12 +290,13 @@ class ReserveParticipationByThermalGroup : public Variable::IVariableallCapacityReservations.areaCapacityReservationsDown)
+ for (const auto& [resName, _]:
+ results.data.area->allCapacityReservations.areaCapacityReservationsDown)
{
for (int indexGroup = 0; indexGroup < Antares::Data::groupMax; indexGroup++)
{
// Write the data for the current year
- Yuni::String caption = res.first;
+ Yuni::String caption = resName;
caption << "_" << Data::ThermalCluster::GroupName(static_cast(indexGroup));
results.variableCaption = caption; // VCardType::Caption();
results.variableUnit = VCardType::Unit();
diff --git a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationMarginalCost.h b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationMarginalCost.h
index fc372ef6a3..91652a8362 100644
--- a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationMarginalCost.h
+++ b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationMarginalCost.h
@@ -104,15 +104,8 @@ class ReserveParticipationMarginalCost : public Variable::IVariableallCapacityReservations.areaCapacityReservationsUp)
- {
- pSize += 1;
- }
- for (auto res : area->allCapacityReservations.areaCapacityReservationsDown)
- {
- pSize += 1;
- }
+ pSize = area->allCapacityReservations.areaCapacityReservationsUp.size()
+ + area->allCapacityReservations.areaCapacityReservationsDown.size();
if (pSize)
{
AncestorType::pResults.resize(pSize);
diff --git a/src/solver/variable/state.cpp b/src/solver/variable/state.cpp
index 43c43d59c6..49fcff5ec5 100644
--- a/src/solver/variable/state.cpp
+++ b/src/solver/variable/state.cpp
@@ -357,11 +357,12 @@ void State::initFromThermalClusterIndexProduction(const uint clusterAreaWideInde
.thermalGroupsReserveParticipation[thermalCluster->groupID][res]
+= participationOn + participationOff;
- reserveParticipationPerThermalClusterForYear[hourInTheYear][thermalCluster->name()][res]
- .addOffParticipation(participationOff);
+ DetailledParticipation participation;
+ participation.addOffParticipation(participationOff);
+ participation.addOnParticipation(participationOn);
+
+ reserveParticipationPerThermalClusterForYear[hourInTheYear][thermalCluster->name()][res] = participation;
- reserveParticipationPerThermalClusterForYear[hourInTheYear][thermalCluster->name()][res]
- .addOnParticipation(participationOn);
}
else
logs.error() << "No index for cluster " << thermalCluster->name() << " in reserve "