Skip to content

Rolling horizon dsm#804

Open
Manish-Khanra wants to merge 5 commits into
mainfrom
rolling_horizon_dsm
Open

Rolling horizon dsm#804
Manish-Khanra wants to merge 5 commits into
mainfrom
rolling_horizon_dsm

Conversation

@Manish-Khanra
Copy link
Copy Markdown
Contributor

@Manish-Khanra Manish-Khanra commented Apr 30, 2026

Related Issue

Closes #804
If no issue exists, delete this line.

Description

This PR implements rolling-horizon optimization for the DSM units, enabling reactive bidding while maintaining inter-temporal feasibility. Previously, DSM units (steel plants, buildings, hydrogen plants, steam generation plants) optimized over the full simulation horizon. This feature allows units to re-optimize shorter look-ahead windows after each market round while carrying forward component states (e.g., storage SoC, operational status).

Checklist

  • Documentation updated (docstrings, READMEs, user guides, inline comments, doc folder updates etc.)
  • New unit/integration tests added (if applicable)
  • Changes noted in release notes (if any)
  • Consent to release this PR's code under the GNU Affero General Public License v3.0

Additional Notes (optional)

Key Features

  • Rolling-Horizon Mode: Configure via dsm_optimisation_config with horizon_mode, look_ahead_horizon, commit_horizon, and rolling_step keys
  • Three Steel Plant Strategies: cost-optimized (default), profile-guided (tracks normalized load profile), and min-demand (enforces hourly minimums)
  • Fully Extensible: Removed hardcoded technology-specific logic; new DSM unit types can enable rolling-horizon by setting 3 class attributes and optionally 1 method override
  • Production-Ready: All 53 tests passing; backward compatible; comprehensive documentation

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

❌ Patch coverage is 69.54315% with 180 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.40%. Comparing base (9c7a0bf) to head (6e63cb5).
⚠️ Report is 26 commits behind head on main.

Files with missing lines Patch % Lines
assume/units/dsm_load_shift.py 67.68% 137 Missing ⚠️
assume/common/forecaster.py 59.25% 11 Missing ⚠️
assume/common/forecast_algorithms.py 80.00% 9 Missing ⚠️
assume/units/steel_plant.py 82.00% 9 Missing ⚠️
assume/strategies/naive_strategies.py 33.33% 8 Missing ⚠️
assume/scenario/loader_csv.py 81.81% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #804      +/-   ##
==========================================
- Coverage   80.79%   80.40%   -0.40%     
==========================================
  Files          56       56              
  Lines        8676     9252     +576     
==========================================
+ Hits         7010     7439     +429     
- Misses       1666     1813     +147     
Flag Coverage Δ
pytest 80.40% <69.54%> (-0.40%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maurerle maurerle self-requested a review April 30, 2026 13:09
Copy link
Copy Markdown
Member

@maurerle maurerle left a comment

Choose a reason for hiding this comment

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

I did not review the dsm_load_shift.py - but all other files.
There are still a few things to do.

I guess that the way in which units are added to the DSMFlex is not that good, as the code seems to not know which parameters of the class exist.
The result is the need for various hasattr checks, as you never know if a param exists or is initialized.
I suggest using planning mode and a larger context window when using an LLM to help with this..

Comment thread assume/strategies/naive_strategies.py Outdated
Comment thread assume/strategies/naive_strategies.py Outdated
Comment thread assume/strategies/naive_strategies.py
Comment thread assume/units/steel_plant.py Outdated
Comment thread assume/units/steel_plant.py Outdated
Comment thread examples/examples.py Outdated
Comment thread tests/test_steel_plant.py Outdated

# Set the congestion_indicator in the instance
# Delete the old component if it exists to avoid Pyomo warnings
if hasattr(instance, "congestion_indicator"):
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.

I don't like this check - can't we test for something like instance.flexibility_measure == "congestion_management_flexibility" in which case the congestion_indicator is set?
This is more like a general thing

Co-authored-by: Copilot <copilot@github.com>
@Manish-Khanra Manish-Khanra requested a review from maurerle April 30, 2026 20:26
@maurerle
Copy link
Copy Markdown
Member

@Manish-Khanra please rebase/merge and fix the conflicts - then this can be merged :)

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.

2 participants