Skip to content

Feat: Return inflexible device schedules from StorageScheduler#1994

Draft
Ahmad-Wahid wants to merge 9 commits intomainfrom
feat/multi-asset-scheduling
Draft

Feat: Return inflexible device schedules from StorageScheduler#1994
Ahmad-Wahid wants to merge 9 commits intomainfrom
feat/multi-asset-scheduling

Conversation

@Ahmad-Wahid
Copy link
Copy Markdown
Contributor

@Ahmad-Wahid Ahmad-Wahid commented Mar 2, 2026

Description

  • Add a safety filter to drop flex-model entries with sensor=None (TODO: fix root cause).
  • Track inflexible_device_sensors through _prepare() and extract their schedules from the EMS solution.
  • When return_multiple=True, include inflexible_device_schedule outputs (with unit conversion + resampling/rounding aligned with storage schedules).

How to test


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

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community bot commented Mar 2, 2026

Documentation build overview

📚 flexmeasures | 🛠️ Build #32207144 | 📁 Comparing 5e92a82 against latest (eaed1ee)

  🔍 Preview build  

Show files changed (1 files in total): 📝 1 modified | ➕ 0 added | ➖ 0 deleted
File Status
api/v3_0.html 📝 modified

Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
@Ahmad-Wahid Ahmad-Wahid self-assigned this Mar 5, 2026
@nhoening
Copy link
Copy Markdown
Contributor

@Ahmad-Wahid what about this PR?

if not self.config_deserialized:
self.deserialize_config()

# todo: look for the reason why flex_model has an object(dict) without a sensor, and fix the root cause if possible, instead of filtering it out here
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I know why this can happen. It happens when the db flex model of an asset is picked up when its parent asset is being scheduled. That means some devices are included in the optimization with only an asset ID known, and the power sensor ID to save the results is not guaranteed to be known.

Let's discuss what that means for this PR.

Comment on lines +1467 to +1476
inflexible_device_schedules = [
{
"name": "inflexible_device_schedule",
"sensor": sensor,
"data": inflexible_schedules[sensor],
"unit": sensor.unit,
}
for sensor in inflexible_schedules.keys()
if sensor is not None
]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This also means data/services/scheduling.py ends up saving the inflexible schedules to the sensors where their forecasts were being read from. Does that have added value?

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.

3 participants