Skip to content

Commit

Permalink
Complete hydro logs (#2221)
Browse files Browse the repository at this point in the history
- Instead of return, use a flag to record all possible errors
- Add precision for final level reservoir, hopefully it will make this
log message more useful

Remark : We use the newly-introduced errorCollector to limit output to
10 entries per area
  • Loading branch information
flomnes authored Jul 2, 2024
1 parent 9e22ab3 commit f77b6e1
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/solver/hydro/management/HydroInputsChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ bool HydroInputsChecker::checkWeeklyMinGeneration(uint year, const Data::Area& a
const auto& srcinflows = area.hydro.series->storage.getColumn(year);
const auto& srcmingen = area.hydro.series->mingen.getColumn(year);
// Weekly minimum generation <= Weekly inflows for each week
bool ret = true;
for (uint week = 0; week < calendar_.maxWeeksInYear - 1; ++week)
{
double totalWeekMingen = 0.0;
Expand All @@ -122,30 +123,32 @@ bool HydroInputsChecker::checkWeeklyMinGeneration(uint year, const Data::Area& a
<< " the minimum generation of " << totalWeekMingen << " MW in week " << week + 1
<< " of TS-" << area.hydro.series->mingen.getSeriesIndex(year) + 1
<< " is incompatible with the inflows of " << totalWeekInflows << " MW.";
return false;
ret = false;
}
}
return true;
return ret;
}

bool HydroInputsChecker::checkYearlyMinGeneration(uint year, const Data::Area& area)
{
const auto& data = area.hydro.managementData.at(year);
bool ret = true;
if (data.totalYearMingen > data.totalYearInflows)
{
// Yearly minimum generation <= Yearly inflows
errorCollector_(area.name)
<< " the minimum generation of " << data.totalYearMingen << " MW of TS-"
<< area.hydro.series->mingen.getSeriesIndex(year) + 1
<< " is incompatible with the inflows of " << data.totalYearInflows << " MW.";
return false;
ret = false;
}
return true;
return ret;
}

bool HydroInputsChecker::checkMonthlyMinGeneration(uint year, const Data::Area& area)
{
const auto& data = area.hydro.managementData.at(year);
bool ret = true;
for (uint month = 0; month != 12; ++month)
{
uint realmonth = calendar_.months[month].realmonth;
Expand All @@ -158,10 +161,10 @@ bool HydroInputsChecker::checkMonthlyMinGeneration(uint year, const Data::Area&
<< area.hydro.series->mingen.getSeriesIndex(year) + 1
<< " is incompatible with the inflows of " << data.totalMonthInflows[realmonth]
<< " MW.";
return false;
ret = false;
}
}
return true;
return ret;
}

bool HydroInputsChecker::checkGenerationPowerConsistency(uint year)
Expand Down Expand Up @@ -222,7 +225,9 @@ void HydroInputsChecker::CheckFinalReservoirLevelsConfiguration(uint year)
errorCollector_);
if (!validator.check())
{
errorCollector_(area.name) << "hydro final level : infeasibility";
errorCollector_(area.name)
<< "hydro final level : infeasibility for area " << area.name
<< " please check the corresponding final level data (scenario-builder)";
}
if (validator.finalLevelFineForUse())
{
Expand Down

0 comments on commit f77b6e1

Please sign in to comment.