Skip to content

Fix: soc min does not need to be mandatory#2221

Open
BelhsanHmida wants to merge 11 commits into
mainfrom
fix/soc-min-does-not-need-to-be-mandatory
Open

Fix: soc min does not need to be mandatory#2221
BelhsanHmida wants to merge 11 commits into
mainfrom
fix/soc-min-does-not-need-to-be-mandatory

Conversation

@BelhsanHmida
Copy link
Copy Markdown
Contributor

Description

  • Let storage scheduling continue when a flex-model omits soc-min.
  • Treat missing soc-min as no global lower state-of-charge boundary, rather than defaulting it to zero.
  • Preserve timed soc-minima constraints without filling gaps with an implied global lower bound.
  • Clarified the scheduling metadata for optional soc-min.
  • Added changelog entry

Look & Feel

N/A. This is scheduler behavior and documentation only.

How to test

pytests:

pytest -k "add_storage_constraints_skips_global_minimum_when_soc_min_is_missing or add_storage_constraints_with_soc_minima_and_missing_soc_min_has_gaps"

Manual check:

  • Called add_storage_constraints(..., soc_min=None) directly.
  • Confirmed no TypeError is raised.
  • Confirmed the generated global min column remains empty.
  • Confirmed validate_storage_constraints(...) returns no violations.

Related Items

Closes SeitaBV/ems#211


Sign-off

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on code under GPL or other license that is incompatible with FlexMeasures

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
@BelhsanHmida BelhsanHmida self-assigned this Jun 4, 2026
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
@BelhsanHmida BelhsanHmida requested a review from Flix6x June 4, 2026 01:32
@Flix6x Flix6x added this to the 1.0.0 milestone Jun 4, 2026
Copy link
Copy Markdown
Member

@Flix6x Flix6x left a comment

Choose a reason for hiding this comment

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

Nice. I think we may need the same for soc-max. It would be interesting to extend the new tests to a case where soc-min is defined, but soc-max is missing (or both are missing).

Comment thread flexmeasures/data/schemas/scheduling/metadata.py Outdated
Comment thread flexmeasures/data/models/planning/tests/test_solver.py Outdated
Comment thread flexmeasures/data/models/planning/tests/test_solver.py Outdated
Comment thread flexmeasures/data/models/planning/storage.py Outdated
@Flix6x Flix6x mentioned this pull request Jun 4, 2026
6 tasks
BelhsanHmida and others added 6 commits June 4, 2026 21:55
Co-authored-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com>
Signed-off-by: Mohamed Belhsan Hmida <149331360+BelhsanHmida@users.noreply.github.com>
Co-authored-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com>
Signed-off-by: Mohamed Belhsan Hmida <149331360+BelhsanHmida@users.noreply.github.com>
Co-authored-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com>
Signed-off-by: Mohamed Belhsan Hmida <149331360+BelhsanHmida@users.noreply.github.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
@BelhsanHmida
Copy link
Copy Markdown
Contributor Author

Nice. I think we may need the same for soc-max. It would be interesting to extend the new tests to a case where soc-min is defined, but soc-max is missing (or both are missing).

Yes, this is now covered. I added tests for soc-min defined with missing soc-max, both bounds missing, and soc-maxima with gaps. I also added preprocessing coverage so missing soc-max no longer raises before constraints are built.

@BelhsanHmida BelhsanHmida requested a review from Flix6x June 4, 2026 21:19
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.

2 participants