Reduce PV forecast failsafe minimum from 18 to 12 hours#284
Merged
Conversation
The failsafe in ForecastSolarBaseclass was too aggressive when running between 0:00-2:00 AM since forecast data may not yet cover 18 hours ahead. Reduced minimum to 12 hours (12 intervals for 60-min resolution, 48 intervals for 15-min resolution). Fixes: interval count was also wrong for 15-min resolution (72 != 18*4). 48 slots at 15-min = exactly 12 hours. Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix aggressive failsafe for PV values delivery
Reduce PV forecast failsafe minimum from 18 to 12 hours
Feb 27, 2026
MaStr
approved these changes
Feb 27, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts the solar forecast failsafe to accept shorter PV forecasts during early-night hours by reducing the minimum required forecast horizon from 18 hours to 12 hours, and updates tests accordingly.
Changes:
- Lowered the minimum forecast-length threshold in the ForecastSolar baseclass from 18h to 12h (including 15-min equivalent).
- Updated RuntimeError message text to reference 12 hours.
- Updated unit tests to match the new threshold and adjust insufficient-data fixtures.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/batcontrol/forecastsolar/baseclass.py |
Lowers the minimum forecast horizon check to 12 hours and updates the emitted error/log messages. |
tests/batcontrol/forecastsolar/test_baseclass.py |
Updates failing test matcher to expect the new 12-hour error message. |
tests/batcontrol/forecastsolar/test_baseclass_alignment.py |
Updates integration tests/matchers and insufficient 15-min test data to reflect the new 12-hour threshold. |
Owner
|
@copilot apply changes based on the comments in this thread |
Using max(keys()) gives the largest 0-based index, which is one less than the actual interval count and causes a spurious failure when data has exactly the required number of intervals. Switch to len() which correctly reflects the actual count. Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com>
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
baseclass.pylen(current_aligned_forecast)instead ofmax(keys())for interval count checktest_baseclass.pyandtest_baseclass_alignment.pyOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.