Skip to content

Commit

Permalink
move HydroManagementData::MLE
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zakir committed Jun 11, 2024
1 parent 6d4c56e commit 147b818
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ struct HydroSpecific

//! Daily local effective load
std::array<double, dayYearCount> DLE;
//! Monthly local effective demand
std::array<double, 12> MLE;
};
//! Temporary data
struct HydroManagementData
{
//! Monthly local effective demand
std::array<double, 12> MLE;
//! Monthly optimal generation
std::array<double, 12> MOG;
//! Monthly optimal level
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ class HydroManagement final
// note: inflows may have two different types, if in swap mode or not
// \return The total inflow for the whole year
double prepareMonthlyTargetGenerations(Data::Area& area,
Antares::Data::HydroManagementData& data);
Antares::Data::HydroManagementData& data,
Antares::Data::HydroSpecific& hydro_specific);

void prepareDailyOptimalGenerations(uint y,
Antares::Data::Area::ScratchMap& scratchmap,
Expand Down
10 changes: 5 additions & 5 deletions src/solver/hydro/management/management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@ void HydroManagement::prepareEffectiveDemand(uint year,

assert(!std::isnan(effectiveDemand) && "nan value detected for effectiveDemand");
hydro_specific.DLE[day] += effectiveDemand;
data.MLE[realmonth] += effectiveDemand;
hydro_specific.MLE[realmonth] += effectiveDemand;

assert(not std::isnan(hydro_specific.DLE[day]) && "nan value detected for DLE");
assert(not std::isnan(data.MLE[realmonth]) && "nan value detected for DLE");
assert(not std::isnan(hydro_specific.MLE[realmonth]) && "nan value detected for DLE");
}

auto minimumYear = std::numeric_limits<double>::infinity();
Expand Down Expand Up @@ -254,9 +254,9 @@ void HydroManagement::prepareEffectiveDemand(uint year,
}
}

if (data.MLE[realmonth] < minimumYear)
if (hydro_specific.MLE[realmonth] < minimumYear)
{
minimumYear = data.MLE[realmonth];
minimumYear = hydro_specific.MLE[realmonth];
}

dayYear += daysPerMonth;
Expand All @@ -266,7 +266,7 @@ void HydroManagement::prepareEffectiveDemand(uint year,
{
for (uint realmonth = 0; realmonth != 12; ++realmonth)
{
data.MLE[realmonth] -= minimumYear - 1e-4;
hydro_specific.MLE[realmonth] -= minimumYear - 1e-4;
}
}
});
Expand Down
18 changes: 10 additions & 8 deletions src/solver/hydro/management/monthly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ static void CheckHydroAllocationProblem(Data::Area& area,
}
}

double HydroManagement::prepareMonthlyTargetGenerations(Data::Area& area,
Antares::Data::HydroManagementData& data)
double HydroManagement::prepareMonthlyTargetGenerations(
Data::Area& area,
Antares::Data::HydroManagementData& data,
Antares::Data::HydroSpecific& hydro_specific)
{
double total = 0;

Expand All @@ -106,9 +108,9 @@ double HydroManagement::prepareMonthlyTargetGenerations(Data::Area& area,

for (uint realmonth = 0; realmonth != 12; ++realmonth)
{
if (data.MLE[realmonth] > monthlyMaxDemand)
if (hydro_specific.MLE[realmonth] > monthlyMaxDemand)
{
monthlyMaxDemand = data.MLE[realmonth];
monthlyMaxDemand = hydro_specific.MLE[realmonth];
}
}

Expand All @@ -117,8 +119,8 @@ double HydroManagement::prepareMonthlyTargetGenerations(Data::Area& area,
double coeff = 0.;
for (uint realmonth = 0; realmonth != 12; ++realmonth)
{
assert(data.MLE[realmonth] / monthlyMaxDemand >= 0.);
coeff += std::pow(data.MLE[realmonth] / monthlyMaxDemand,
assert(hydro_specific.MLE[realmonth] / monthlyMaxDemand >= 0.);
coeff += std::pow(hydro_specific.MLE[realmonth] / monthlyMaxDemand,
area.hydro.intermonthlyBreakdown);
}

Expand All @@ -129,9 +131,9 @@ double HydroManagement::prepareMonthlyTargetGenerations(Data::Area& area,

for (uint realmonth = 0; realmonth != 12; ++realmonth)
{
assert(data.MLE[realmonth] / monthlyMaxDemand >= 0.);
assert(hydro_specific.MLE[realmonth] / monthlyMaxDemand >= 0.);
data.MTG[realmonth] = coeff
* std::pow(data.MLE[realmonth] / monthlyMaxDemand,
* std::pow(hydro_specific.MLE[realmonth] / monthlyMaxDemand,
area.hydro.intermonthlyBreakdown);
}
}
Expand Down

0 comments on commit 147b818

Please sign in to comment.