Skip to content

fix: StorageScheduler falls back to 0 correctly if no starting SoC can be found - #2431

Merged
nhoening merged 2 commits into
mainfrom
fix/no-soc-at-start
Aug 20, 2026
Merged

fix: StorageScheduler falls back to 0 correctly if no starting SoC can be found#2431
nhoening merged 2 commits into
mainfrom
fix/no-soc-at-start

Conversation

@nhoening

@nhoening nhoening commented Aug 20, 2026

Copy link
Copy Markdown
Member

Desription

Closes #2430: Errors when no starting SoC is given to StorageScheduler

  • Fix defaulting to 0 SoC at start for the asset-triggering route.
  • Added changelog item in documentation/changelog.rst

Note: If a state-of-charge sensor is given, but it has no recent data, we still fail with the clear “No recent state-of-charge value” error.

Analysis

Single-sensor scheduling calls ensure_soc_at_start(), which resolves a configured SoC source, tries the legacy asset value, and then defaults to 0 when soc-min or soc-max makes the entry a storage model. Asset/multi-device scheduling skips that routine entirely. The right correction is therefore to restore the same resolution/default policy per stock group, not to special-case soft minima.

PR #1946 deleted that call while retaining it for the sensor/dict branch. This affects your one-sensor case because an asset schedule with an explicit sensor entry remains a list; “multi-device mode” is really “asset/list mode,” not “more than one sensor.”
PR #2322 on July 15 partially repaired the regression by resolving soc-at-start from a configured state-of-charge source in the per-stock loop. It did not restore the zero fallback (or initially the legacy attribute fallback), which is why your no-source case still reaches _prepare() with None. In release terms, v0.33.1 still had the old behavior; the removal first appears in v0.33.2.dev0 and the v1.0 release line.

Look & Feel

Schedules with no SoC at start information should succeed.

How to test

Two tests were added to this PR without such information, but they still schedule.

…n be found

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@nhoening nhoening added this to the 1.0.0 milestone Aug 20, 2026
@nhoening nhoening self-assigned this Aug 20, 2026
@read-the-docs-community

read-the-docs-community Bot commented Aug 20, 2026

Copy link
Copy Markdown

Documentation build overview

📚 flexmeasures | 🛠️ Build #34155003 | 📁 Comparing 8ca2e18 against latest (d64270f)

  🔍 Preview build  

3 files changed
± changelog.html
± _autosummary/flexmeasures.data.models.planning.storage.html
± api/v3_0.html

Comment thread documentation/changelog.rst Outdated
Comment thread flexmeasures/data/models/planning/storage.py
Comment thread flexmeasures/data/models/planning/storage.py Outdated
Comment thread flexmeasures/data/models/planning/storage.py Outdated
Comment thread flexmeasures/data/models/planning/storage.py Outdated
@nhoening

Copy link
Copy Markdown
Member Author

I ran QA/Release workflow on this branch successfully: https://github.com/FlexMeasures/flexmeasures/actions/runs/32376386062

@nhoening
nhoening requested a review from Flix6x August 20, 2026 14:00
@nhoening
nhoening merged commit 3272084 into main Aug 20, 2026
14 checks passed
@nhoening
nhoening deleted the fix/no-soc-at-start branch August 20, 2026 21:16
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.

Errors when no starting SoC is given to StorageScheduler

3 participants