Skip to content

Add multi‑commodity support to device scheduler#1946

Draft
Ahmad-Wahid wants to merge 122 commits into
mainfrom
feat/multi-commodity
Draft

Add multi‑commodity support to device scheduler#1946
Ahmad-Wahid wants to merge 122 commits into
mainfrom
feat/multi-commodity

Conversation

@Ahmad-Wahid
Copy link
Copy Markdown
Contributor

@Ahmad-Wahid Ahmad-Wahid commented Feb 3, 2026

This PR adds initial support for multi‑commodity commitments (e.g. gas and electricity) in the device_scheduler, building on the grouped‑devices functionality. Flow commitments can now be tagged with a commodity, and EMS‑level flow constraints are applied per commodity by aggregating the relevant devices.

TODO

  • Specify how commodity is encoded per device in the flex‑model
  • Exclude non‑matching commodities (e.g. gas devices) from EMS electricity commitments
  • Extend flex‑model schema with commodity metadata
  • add gas-price field to flex-context
  • set up gas commitment using gas-powered devices and gas-price
  • Update scheduling.rst
  • Add tutorial examples for multi‑commodity scheduling

closes https://github.com/SeitaBV/simulations/issues/987

Flix6x and others added 26 commits December 5, 2025 16:50
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
…ontext

Signed-off-by: F.N. Claessen <felix@seita.nl>
…formulation

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
…and map them to the respective group id

Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented Feb 3, 2026

Documentation build overview

📚 flexmeasures | 🛠️ Build #31957437 | 📁 Comparing de4981e against latest (d9840bf)


🔍 Preview build

Show files changed (6 files in total): 📝 4 modified | ➕ 2 added | ➖ 0 deleted
File Status
genindex.html 📝 modified
_autodoc/COMMODITY.html ➕ added
_autodoc/GAS_PRICE.html ➕ added
_autosummary/flexmeasures.data.models.planning.html 📝 modified
_autosummary/flexmeasures.data.models.planning.storage.html 📝 modified
api/v3_0.html 📝 modified

Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
…chemas

Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Flix6x and others added 18 commits April 24, 2026 17:26
Signed-off-by: F.N. Claessen <claessen@seita.nl>
…mmitment does the optimizer treat their stocks as a combined resource

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>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
… preference for full soc sooner

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>
The two changes together are the backwards-compatible default that was missing: when no device is specified (device=None), to_frame() must emit NaN in the device_group column (not crash), so the optimizer routes the commitment through ems_flow_commitment_equalities exactly as it did before device_group was introduced.

Signed-off-by: F.N. Claessen <claessen@seita.nl>
…the pre-existing behaviour — each device is its own group

Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
…ce series with scheduler index

Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
@nhoening nhoening modified the milestones: 0.33.0, 0.34.0 May 23, 2026
Flix6x added 2 commits June 3, 2026 10:10
…n-gas-and-electricity

# Conflicts:
#	documentation/changelog.rst
…lectricity' into feat/multi-commodity

Signed-off-by: F.N. Claessen <claessen@seita.nl>

# Conflicts:
#	flexmeasures/data/schemas/scheduling/metadata.py
#	flexmeasures/ui/static/openapi-specs.json
Base automatically changed from feat/switching-between-gas-and-electricity to main June 3, 2026 08:49
Flix6x and others added 3 commits June 3, 2026 10:52
# Conflicts:
#	flexmeasures/data/models/planning/__init__.py
#	flexmeasures/data/models/planning/tests/test_commitments.py
#	flexmeasures/data/tests/test_scheduling_simultaneous.py
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
…tion

Context:
- Test test_all_metadata_fields_are_documented was failing because these fields were not documented
- Part of multi-commodity feature development
Change:
- Added ``commodity`` field to the storage flex-model table
- Added ``gas-price`` field to the flex-context table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Scheduling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants