Skip to content

Commit

Permalink
Merge branch 'feature/reserve_model_lot3_scalian_fix_thermal' into fe…
Browse files Browse the repository at this point in the history
…ature/reserve_model_lot3_scalian
  • Loading branch information
h-fournier committed Dec 20, 2024
2 parents cbebdc7 + 55d7e33 commit 68ae217
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 399 deletions.
4 changes: 2 additions & 2 deletions src/libs/antares/study/include/antares/study/area/area.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,9 @@ class Area final: private Yuni::NonCopyable<Area>
/// \name AllCapacityReservations structure to keep track of the added capacity reservations
AllCapacityReservations allCapacityReservations;

BiMap<std::pair<Data::ClusterName, Data::ReserveName>>
BiMap<std::pair<Data::ReserveName, Data::ClusterName>>
reserveParticipationThermalClustersIndexMap;
BiMap<std::pair<Data::ClusterName, Data::ReserveName>>
BiMap<std::pair<Data::ReserveName, Data::ClusterName>>
reserveParticipationSTStorageClustersIndexMap;
BiMap<Data::ReserveName> reserveParticipationLTStorageIndexMap;

Expand Down
11 changes: 5 additions & 6 deletions src/libs/antares/study/parts/short-term-storage/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions src/libs/antares/study/parts/short-term-storage/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,18 +238,18 @@ std::pair<Data::ShortTermStorage::Group, Data::ReserveName>
STStorageInput::reserveParticipationGroupAt(const Area* area, unsigned int index) const
{
int column = 0;
for (auto [reserveName, _] : area->allCapacityReservations.areaCapacityReservationsUp)
for (const auto& [reserveName, _]: area->allCapacityReservations.areaCapacityReservationsUp)
{
for (int indexGroup = 0; indexGroup < Data::ThermalCluster::groupMax; indexGroup++)
for (int indexGroup = 0; indexGroup < Data::ShortTermStorage::groupMax; indexGroup++)
{
if (column == index)
return {static_cast<Data::ShortTermStorage::Group>(indexGroup), reserveName};
column++;
}
}
for (auto [reserveName, _] : area->allCapacityReservations.areaCapacityReservationsDown)
for (const auto& [reserveName, _]: area->allCapacityReservations.areaCapacityReservationsDown)
{
for (int indexGroup = 0; indexGroup < Data::ThermalCluster::groupMax; indexGroup++)
for (int indexGroup = 0; indexGroup < Data::ShortTermStorage::groupMax; indexGroup++)
{
if (column == index)
return {static_cast<Data::ShortTermStorage::Group>(indexGroup), reserveName};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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<VCardType>(
results, fileLevel, precision);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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<VCardType>(
results, fileLevel, precision);
Expand Down
Loading

0 comments on commit 68ae217

Please sign in to comment.