Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

De-templatize HydroManagement::prepareNetDemand #1679

Merged
merged 2 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions src/solver/hydro/management/management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,7 @@ bool HydroManagement::checkMinGeneration(uint numSpace, uint year) const
return ret;
}

template<enum Data::StudyMode ModeT>
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;
Expand Down Expand Up @@ -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]);
}

Expand All @@ -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) {
Expand Down Expand Up @@ -525,11 +524,7 @@ void HydroManagement::makeVentilation(double* randomReservoirLevel,
throw FatalError("hydro management: invalid minimum generation");
}

if (parameters_.adequacy())
prepareNetDemand<Data::stdmAdequacy>(numSpace, y);
else
prepareNetDemand<Data::stdmEconomy>(numSpace, y);

prepareNetDemand(numSpace, y, parameters_.mode);
prepareEffectiveDemand(numSpace);

prepareMonthlyOptimalGenerations(randomReservoirLevel, y, numSpace);
Expand Down
3 changes: 1 addition & 2 deletions src/solver/hydro/management/management.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<enum Data::StudyMode ModeT>
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
Expand Down