Skip to content

Fix: power capacity does not need to be mandatory#2222

Open
BelhsanHmida wants to merge 7 commits into
mainfrom
fix/power-capacity-does-not-need-to-be-mandatory
Open

Fix: power capacity does not need to be mandatory#2222
BelhsanHmida wants to merge 7 commits into
mainfrom
fix/power-capacity-does-not-need-to-be-mandatory

Conversation

@BelhsanHmida
Copy link
Copy Markdown
Contributor

Description

  • Let storage scheduling continue when a flex-model omits power-capacity.
  • Infer the symmetric device-level power limit from the greatest of consumption-capacity and production-capacity when both directional capacities are configured.
  • Keep the existing site-power-capacity fallback after the directional-capacity fallback.
  • Clarified the scheduling metadata for power-capacity, consumption-capacity, and production-capacity.
  • Added changelog entry.

Look & Feel

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

How to test

pytest -k "device_power_capacity_uses_greatest_directional_capacity_before_site_fallback"

Manual check:

  • With no power-capacity, production_capacity = 300 kW, and consumption_capacity = 700 kW, _get_device_power_capacity returned a 96-step capacity series whose values are close to 0.7 MW.
  • The method logged the expected missing power-capacity warning instead of raising the previous error.

Related Items

Closes SeitaBV/ems#210


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
Comment thread flexmeasures/data/schemas/scheduling/metadata.py Outdated
Comment on lines +344 to +345
description="""Device-level power constraint on consumption. How much power can be drawn by this asset.
If ``power-capacity`` is omitted and ``production-capacity`` is also configured, this field contributes to the inferred symmetric device-level power limit. [#minimum_overlap]_""",
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.

But this field also "contributes" if the production-capacity field is not configured, right? And that behaviour seems already described under power-capacity. I suggest reverting this change:

Suggested change
description="""Device-level power constraint on consumption. How much power can be drawn by this asset.
If ``power-capacity`` is omitted and ``production-capacity`` is also configured, this field contributes to the inferred symmetric device-level power limit. [#minimum_overlap]_""",
description="""Device-level power constraint on consumption. How much power can be drawn by this asset. [#minimum_overlap]_""",

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.

Actually, wouldn't you as a user expect that if you only define a consumption-capacity, that the production-capacity is automatically assumed to be zero? And vice versa.

(But if neither is set, they are not both assumed to be zero.)

I'm interested to hear your opinion.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. I reverted the extra sentence here and kept the fallback behavior described under power-capacity.

On the missing opposite direction: I agree that if consumption capacity is set, treating the production capacity as zero sounds intuitive. should this be implement this here?

resolution: timedelta,
beliefs_before: datetime | None,
) -> Sensor | SensorReference | list[dict] | ur.Quantity | pd.Series | None:
"""Return the largest directional capacity when both directions are configured."""
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.

Only when both are defined?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After some thought, I think “both” is too narrow here. Do you think we should infer the fallback power-capacity from the largest provided consumption-capacity or production-capacity when either one is set, and only fall back to site-power-capacity if neither is set?

BelhsanHmida and others added 2 commits June 4, 2026 21:24
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>
@BelhsanHmida BelhsanHmida requested a review from Flix6x June 5, 2026 11:39
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