From 5d55e3ef90a904486329e21d84837d4af8b2b9d6 Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Thu, 5 Oct 2023 11:04:37 +0200 Subject: [PATCH] De-templatize `HydroManagement::prepareNetDemand` Templates make for larger binaries since 2 functions are required. --- src/solver/hydro/management/management.cpp | 13 ++++--------- src/solver/hydro/management/management.h | 3 +-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/solver/hydro/management/management.cpp b/src/solver/hydro/management/management.cpp index f0ae5d1711..b5a16b0a5f 100644 --- a/src/solver/hydro/management/management.cpp +++ b/src/solver/hydro/management/management.cpp @@ -369,8 +369,7 @@ bool HydroManagement::checkMinGeneration(uint numSpace, uint year) const return ret; } -template -void HydroManagement::prepareNetDemand(uint numSpace, uint year) +void HydroManagement::prepareNetDemand(uint numSpace, uint year, Data::StudyMode mode) { areas_.each([&](Data::Area& area) { uint z = area.index; @@ -398,7 +397,7 @@ void HydroManagement::prepareNetDemand(uint numSpace, uint year) netdemand = + loadSeries[hour] - windSeries[hour] - scratchpad.miscGenSum[hour] - solarSeries[hour] - ror[hour] - - ((ModeT != Data::stdmAdequacy) ? scratchpad.mustrunSum[hour] + - ((mode != Data::stdmAdequacy) ? scratchpad.mustrunSum[hour] : scratchpad.originalMustrunSum[hour]); } @@ -407,7 +406,7 @@ void HydroManagement::prepareNetDemand(uint numSpace, uint year) { netdemand = loadSeries[hour] - scratchpad.miscGenSum[hour] - ror[hour] - - ((ModeT != Data::stdmAdequacy) ? scratchpad.mustrunSum[hour] + - ((mode != Data::stdmAdequacy) ? scratchpad.mustrunSum[hour] : scratchpad.originalMustrunSum[hour]); area.renewable.list.each([&](const Antares::Data::RenewableCluster& cluster) { @@ -525,12 +524,8 @@ void HydroManagement::makeVentilation(double* randomReservoirLevel, throw FatalError("hydro management: invalid minimum generation"); } - if (parameters_.adequacy()) - prepareNetDemand(numSpace, y); - else - prepareNetDemand(numSpace, y); - prepareEffectiveDemand(numSpace); + prepareNetDemand(numSpace, y, parameters_.mode); prepareMonthlyOptimalGenerations(randomReservoirLevel, y, numSpace); prepareDailyOptimalGenerations(state, y, numSpace); diff --git a/src/solver/hydro/management/management.h b/src/solver/hydro/management/management.h index 67d52f57ad..deb1f1f4d5 100644 --- a/src/solver/hydro/management/management.h +++ b/src/solver/hydro/management/management.h @@ -135,8 +135,7 @@ class HydroManagement final //! check minimum generation is lower than available inflows bool checkMinGeneration(uint numSpace, uint year) const; //! Prepare the net demand for each area - template - void prepareNetDemand(uint numSpace, uint year); + void prepareNetDemand(uint numSpace, uint year, Data::StudyMode mode); //! Prepare the effective demand for each area void prepareEffectiveDemand(uint numSpace); //! Monthly Optimal generations