Skip to content

Commit

Permalink
ChangeInflowsToAccommodateFinalLevels
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zakir committed Jun 23, 2024
1 parent c109624 commit 147bba8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class PrepareInflows

void ComputeInflows(uint year);
//! prepare data for Final reservoir level
void ChangeInflowsToAccommodateFinalLevels(uint year);
};

} // namespace Antares
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class HydroManagement final
double* random_reservoir_level,
uint y,
HydroSpecificMap& hydro_specific_map);
void ChangeInflowsToAccommodateFinalLevels(uint year);

//! Monthly target generations
// note: inflows may have two different types, if in swap mode or not
Expand Down
24 changes: 0 additions & 24 deletions src/solver/hydro/management/PrepareInflows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,4 @@ void PrepareInflows::ComputeInflows(uint year)
});
}

void PrepareInflows::ChangeInflowsToAccommodateFinalLevels(uint year)
{
areas_.each(
[this, &year](Data::Area& area)
{
auto& data = area.hydro.managementData[year];

if (!area.hydro.deltaBetweenFinalAndInitialLevels[year].has_value())
{
return;
}

// Must be done before prepareMonthlyTargetGenerations
double delta = area.hydro.deltaBetweenFinalAndInitialLevels[year].value();
if (delta < 0)
{
data.inflows[0] -= delta;
}
else if (delta > 0)
{
data.inflows[11] -= delta;
}
});
}
} // namespace Antares
25 changes: 25 additions & 0 deletions src/solver/hydro/management/management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,36 @@ void HydroManagement::makeVentilation(double* randomReservoirLevel,
Antares::Data::Area::ScratchMap& scratchmap)
{
HydroSpecificMap hydro_specific_map;
ChangeInflowsToAccommodateFinalLevels(y);
prepareNetDemand(y, parameters_.mode, scratchmap, hydro_specific_map);
prepareEffectiveDemand(y, hydro_specific_map);

prepareMonthlyOptimalGenerations(randomReservoirLevel, y, hydro_specific_map);
prepareDailyOptimalGenerations(y, scratchmap, hydro_specific_map);
}

void HydroManagement::ChangeInflowsToAccommodateFinalLevels(uint year)
{
areas_.each(
[this, &year](Data::Area& area)
{
auto& data = area.hydro.managementData[year];

if (!area.hydro.deltaBetweenFinalAndInitialLevels[year].has_value())
{
return;
}

// Must be done before prepareMonthlyTargetGenerations
double delta = area.hydro.deltaBetweenFinalAndInitialLevels[year].value();
if (delta < 0)
{
data.inflows[0] -= delta;
}
else if (delta > 0)
{
data.inflows[11] -= delta;
}
});
}
} // namespace Antares

0 comments on commit 147bba8

Please sign in to comment.