Skip to content

Deprecate HYDRO min_power in favour of min_flow#864

Open
lbonaldo wants to merge 7 commits intoGenXProject:developfrom
lbonaldo:lb/refactor-hydro_min_flow
Open

Deprecate HYDRO min_power in favour of min_flow#864
lbonaldo wants to merge 7 commits intoGenXProject:developfrom
lbonaldo:lb/refactor-hydro_min_flow

Conversation

@lbonaldo
Copy link
Collaborator

@lbonaldo lbonaldo commented Aug 26, 2025

Description

This PR introduces a deprecation path for the HYDRO min_power column and function, replacing them with min_flow. This change improves code consistency, since the column is actually used to enforce a minimum outflow requirement (power generation + spillage).

Changes Made

  1. Function Deprecation (src/model/resources/resources.jl)
    Deprecated: min_power(r::Hydro) function with deprecation warnings
    Added: New min_flow(r::Hydro) function that provides the same functionality
    Backward Compatibility: Old function continues to work during transition period
    Smart Fallback: Automatically detects and uses the appropriate column (min_flow preferred, min_power as fallback)
  2. Hydro Module Update (src/model/resources/hydro/hydro_res.jl)
    API Migration: Updated hydro constraints to use the new min_flow API
  3. Tests (test/test_load_resource_data.jl)
    API Validation: Confirms new min_flow function works with updated column names
  4. Documentation (docs/src/User_Guide/model_input.md)
    Deprecated: Min_Power column is kept with deprecation note
    Added: New Min_Flow column is documented

Migration Guide

For Users:

Immediate: No action required - existing code continues to work
Recommended: Update input data to use Min_Flow column instead of Min_Power
Future: min_power function will be removed in a future breaking release

For Developers:

New Code: Use min_flow(r::Hydro) instead of min_power(r::Hydro)
Data Files: Rename Min_Power columns to Min_Flow for clarity

Breaking Changes

None: This is a non-breaking change with full backward compatibility
Future: min_power function will be removed in a future breaking release

What type of PR is this? (check all applicable)

  • Code Refactor

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and .md files under /docs/src have been updated if necessary.
  • The latest changes on the target branch have been incorporated, so that any conflicts are taken care of before merging. This can be accomplished either by merging in the target branch (e.g. 'git merge develop') or by rebasing on top of the target branch (e.g. 'git rebase develop'). Please do not hesitate to reach out to the GenX development team if you need help with this.
  • Code has been tested to ensure all functionality works as intended.
  • CHANGELOG.md has been updated (if this is a 'notable' change).
  • I consent to the release of this PR's code under the GNU General Public license.

How this can be tested

By running the test suite.

Post-approval checklist for GenX core developers

After the PR is approved

  • Check that the latest changes on the target branch are incorporated, either via merge or rebase
  • Remember to squash and merge if incorporating into develop

@lbonaldo lbonaldo requested review from cfe316 and sambuddhac August 26, 2025 12:21
@lbonaldo lbonaldo self-assigned this Aug 26, 2025
Copy link
Collaborator

@sambuddhac sambuddhac left a comment

Choose a reason for hiding this comment

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

Looks good. Approved !!!

@lbonaldo lbonaldo force-pushed the lb/refactor-hydro_min_flow branch from 50e3079 to f7aca4b Compare January 8, 2026 22:54
| :------------ | :-----------|
|Min\_Flow |[0,1], The minimum generation level for a unit as a fraction of total capacity. This value cannot be higher than the smallest time-dependent CF value for a resource in `Generators_variability.csv`. **Recommended: Use this column for new inputs instead of `Min_Power`.**|
|Min\_Power |[0,1], **DEPRECATED**: Use `Min_Flow` instead. The minimum generation level for a unit as a fraction of total capacity. This value cannot be higher than the smallest time-dependent CF value for a resource in `Generators_variability.csv`.|
|Min\_Flow |[0,1], The minimum generation level for a unit as a fraction of total capacity. **Note**: setting a value greater than the time-dependent CF values for a resource in `Generators_variability.csv` can result in an infeasible model, because the model might not be able to generate enough power and/or discharge enough water to meet the minimum flow requirement. Always double check the variability data before running the model.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Very minor, but can you change because the model might not be able to generate to because the unit might not be able to generate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

of course!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants