Fix: soc min does not need to be mandatory#2221
Conversation
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>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Flix6x
left a comment
There was a problem hiding this comment.
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).
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>
Yes, this is now covered. I added tests for |
Signed-off-by: Mohamed Belhsan Hmida <149331360+BelhsanHmida@users.noreply.github.com>
…e without hard constraints on the SoC Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
…need-to-be-mandatory # Conflicts: # documentation/changelog.rst
…mandatory' into fix/soc-min-does-not-need-to-be-mandatory
| if soc_max_asset is not None: | ||
| self.flex_model["soc-max"] = soc_max_asset | ||
| else: | ||
| # Lacking information about the battery's nominal capacity, we use the highest target value as the maximum state of charge |
There was a problem hiding this comment.
I thought about this at length. I now think we should not use ensure_soc_min_max anymore at all. It was only used for the old sensor schedule trigger anyway. I now removed it. This means we no longer try to infer the soc-min or soc-max if they are not passed. The function originally:
- Tried to get the soc-min/max from the asset. By now this already happens in
collect_flex_config, for all fields, so this became redundant. - Assumed 0 as the soc-min. Not a good assumption if SoC is used as a proxy for temperature.
- Tried to get the soc-max from the soc-targets field. Not a good assumption of the soc-max lies below soc-at-start.
The greater contribution of this PR is allowing constraint validation to pass for devices without soc-min or soc-max. That means the StorageScheduler is becoming a more generic DeviceScheduler. I'm not ready to rename it yet, but this is where I feel we are heading.
Description
soc-min.soc-minas no global lower state-of-charge boundary, rather than defaulting it to zero.soc-minimaconstraints without filling gaps with an implied global lower bound.soc-min.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:
add_storage_constraints(..., soc_min=None)directly.TypeErroris raised.mincolumn remains empty.validate_storage_constraints(...)returns no violations.Related Items
Closes SeitaBV/ems#211
Sign-off