Skip to content

feat: allow setting a power sensor in the flex-model of an asset when patching#2190

Draft
Flix6x wants to merge 12 commits into
mainfrom
feat/sensor-in-db-flex-model
Draft

feat: allow setting a power sensor in the flex-model of an asset when patching#2190
Flix6x wants to merge 12 commits into
mainfrom
feat/sensor-in-db-flex-model

Conversation

@Flix6x
Copy link
Copy Markdown
Contributor

@Flix6x Flix6x commented May 20, 2026

Description

  • ...
  • Added changelog item in documentation/changelog.rst

Look & Feel

...

How to test

...

Further Improvements

...

Related Items

...


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

… patching

Signed-off-by: F.N. Claessen <claessen@seita.nl>
Flix6x added 11 commits May 20, 2026 15:20
Signed-off-by: F.N. Claessen <claessen@seita.nl>
… DBStorageFlexModelSchema

Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Context:
- StorageScheduler could already write state-of-charge schedules to a secondary sensor
- Users wanted the same for consumption and production power
Change:
- Add StorageScheduler._build_consumption_production_schedules() static method
- Call it in compute(), with resampling and rounding matching the soc_schedule pattern
- If only consumption sensor defined: full power profile (consumption positive, production negative)
- If only production sensor defined: full power profile inverted (production positive, consumption negative)
- If both defined: split — non-negative part to consumption sensor, sign-flipped non-positive part to production sensor
- Include results in return_multiple output as consumption_schedule / production_schedule entries
- Sign convention is encoded in the key name so no consumption_is_positive attribute is needed
…ut sensors

Context:
- StorageScheduler now supports writing schedules to consumption and production sensors
Change:
- test_battery_solver_multi_commitment: add consumption and production output sensors
  to the battery, include them in the flex-model, and verify unit conversion (MW → kW)
  and the split logic (all-positive schedule → consumption all positive, production all zero)
- test_trigger_schedule_uses_state_of_charge_sensor_for_soc_at_start: add production
  output sensor and verify 96 beliefs are stored after scheduling
- test_add_storage_schedule_uses_state_of_charge_sensor_for_soc_at_start: add consumption
  output sensor and verify 48 beliefs are stored after scheduling
… changelog entry

Context:
- StorageScheduler now writes schedules to consumption/production sensors
Change:
- Expand CONSUMPTION and PRODUCTION metadata descriptions with the split logic
  (only consumption, only production, or both defined) and clarify that the sign
  convention is encoded in the key name (no consumption_is_positive attribute needed)
- Add changelog entry in v0.33.0 New features section (PR number TBD)
Signed-off-by: F.N. Claessen <claessen@seita.nl>
@Flix6x Flix6x mentioned this pull request May 20, 2026
6 tasks
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.

1 participant