Skip to content

feat: Multiple Hydro Rule Curves#2829

Merged
JasonMarechal25 merged 127 commits intodevelopfrom
feature/multiple-rule-curve-cr-24
Apr 16, 2026
Merged

feat: Multiple Hydro Rule Curves#2829
JasonMarechal25 merged 127 commits intodevelopfrom
feature/multiple-rule-curve-cr-24

Conversation

@nikolaredstork
Copy link
Copy Markdown
Collaborator

This PR implements the Multiple Rule Curves for Hydro Reservoirs as an optional new feature, RTE-I's CR24.

guilpier-code and others added 3 commits January 12, 2026 14:21
This PR is based on the [PR about multiple hydro rule
curves](#2829)
(CR 24).
It suggests quick and easy code improvements.

---------

Co-authored-by: guilpier <guillaume.pierre_externe@rte-france.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Feb 4, 2026

}

private:
bool load() final;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool load() final;
bool load() override final;

Comment on lines +105 to +112
ScenarizedRuleCurvesLoader(const std::filesystem::path& baseFolder,
const std::string& areaID,
TimeSeries& max,
TimeSeries& avg,
TimeSeries& min):
RuleCurvesLoader(baseFolder, areaID, max, avg, min)
{
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplification - use constructor delegation

Suggested change
ScenarizedRuleCurvesLoader(const std::filesystem::path& baseFolder,
const std::string& areaID,
TimeSeries& max,
TimeSeries& avg,
TimeSeries& min):
RuleCurvesLoader(baseFolder, areaID, max, avg, min)
{
}
using RuleCurvesLoader::RuleCurvesLoader;

Comment on lines +88 to +96
StandardRuleCurvesLoader(const std::filesystem::path& baseFolder,
const std::string& areaID,
TimeSeries& max,
TimeSeries& avg,
TimeSeries& min):
RuleCurvesLoader(baseFolder, areaID, max, avg, min)

{
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use constructor delegation - see below


### Input

#### New optional feature and compatibility flag for scenarized hydro reservoir levels
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

planned for 10.1.0

Comment on lines +477 to +478
const char* CompatibilityHydroRuleCurvesToCString(
const Parameters::Compatibility::HydroRuleCurves mode);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary (no more save functions)


auto& lowLevel = area.hydro.reservoirLevel[Data::PartHydro::minimum];
uint32_t seriesIndex = area.hydro.series->ruleCurves.min.getSeriesIndex(y);
const auto& lowLevel = area.hydro.series->ruleCurves.min.timeSeries[seriesIndex];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const auto& lowLevel = area.hydro.series->ruleCurves.min.timeSeries[seriesIndex];
const auto* lowLevel = area.hydro.series->ruleCurves.min.timeSeries[seriesIndex];

Comment on lines +90 to +92
const auto& minRuleCurves = area.hydro.series->ruleCurves.min.getColumn(year);
const auto& avgRuleCurves = area.hydro.series->ruleCurves.avg.getColumn(year);
const auto& maxRuleCurves = area.hydro.series->ruleCurves.max.getColumn(year);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const auto& minRuleCurves = area.hydro.series->ruleCurves.min.getColumn(year);
const auto& avgRuleCurves = area.hydro.series->ruleCurves.avg.getColumn(year);
const auto& maxRuleCurves = area.hydro.series->ruleCurves.max.getColumn(year);
const auto* minRuleCurves = area.hydro.series->ruleCurves.min.getColumn(year);
const auto* avgRuleCurves = area.hydro.series->ruleCurves.avg.getColumn(year);
const auto* maxRuleCurves = area.hydro.series->ruleCurves.max.getColumn(year);

Comment thread src/solver/hydro/management/monthly.cpp Outdated
else
{
auto& reservoirLevel = area.hydro.reservoirLevel[Data::PartHydro::average];
const auto& ruleCurves = area.hydro.series->ruleCurves.avg.getColumn(y);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const auto& ruleCurves = area.hydro.series->ruleCurves.avg.getColumn(y);
const auto* ruleCurves = area.hydro.series->ruleCurves.avg.getColumn(y);

.dayYear;
auto& minLvl = area.hydro.reservoirLevel[Data::PartHydro::minimum];

const auto& minLvl = area.hydro.series->ruleCurves.min.getColumn(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const auto& minLvl = area.hydro.series->ruleCurves.min.getColumn(
const auto* minLvl = area.hydro.series->ruleCurves.min.getColumn(

auto& maxLvl = area.hydro
.reservoirLevel[Data::PartHydro::maximum];

const auto& maxLvl = area.hydro.series->ruleCurves.max
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const auto& maxLvl = area.hydro.series->ruleCurves.max
const auto* maxLvl = area.hydro.series->ruleCurves.max

@dusanparipovic
Copy link
Copy Markdown
Contributor

Hi @flomnes I'll take a look asap.

@flomnes
Copy link
Copy Markdown
Member

flomnes commented Mar 25, 2026

@dusanparipovic I think I fixed most of the issues, the PR can finally be merged

@dusanparipovic
Copy link
Copy Markdown
Contributor

dusanparipovic commented Mar 25, 2026

@dusanparipovic I think I fixed most of the issues, the PR can finally be merged

If you want anything additional ping me, I'm looking for contribution on simulator :) @flomnes

@sonarqubecloud
Copy link
Copy Markdown

@JasonMarechal25 JasonMarechal25 changed the title Multiple Hydro Rule Curves feat: Multiple Hydro Rule Curves Apr 16, 2026
@JasonMarechal25 JasonMarechal25 merged commit 3fab005 into develop Apr 16, 2026
10 checks passed
@JasonMarechal25 JasonMarechal25 deleted the feature/multiple-rule-curve-cr-24 branch April 16, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants