Skip to content

Commit

Permalink
Fix thermal output
Browse files Browse the repository at this point in the history
  • Loading branch information
h-fournier committed Dec 20, 2024
1 parent 64918d7 commit bf3e25a
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 392 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 @@ -358,9 +358,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
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 bf3e25a

Please sign in to comment.