Feat: Switching between gas and electricity#1934
Conversation
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>
Documentation build overview
Show files changed (13 files in total): 📝 11 modified | ➕ 1 added | ➖ 1 deleted
|
There was a problem hiding this comment.
Great draft! Let's start collecting todos in the PR description. We can decide what is in scope and what is out. One idea would be to split it up by feature:
Feature: multi-commodity
- spec how we would encode the commodity per device in the flex-model
- extend flex-model schema, limiting the commodity field to electricity and gas
- exclude gas-fired devices from all current EMS commitments
- add gas-price field to flex-context
- set up gas commitment using gas-powered devices and gas-price
- extend scheduling.rst
- extend tutorial
Feature: beyond electricity and gas
- add commodity field to commitment schema
- document how to set up other commodities
Feature: multi-feed stocks
- spec how we would encode the shared storage per device in the flex-model
- extend flex-model schema
- extend scheduling.rst
- extend tutorial
Feature: multi-feed flows
- spec how we would encode the shared capacity per device in the flex-model
- extend flex-model schema
- extend scheduling.rst
- extend tutorial
Alternatively, we do one PR first to create support for all 3 features in the device_scheduler only, and touch the StorageScheduler just enough so we can safely experiment with the first two features in simulation. Then, once we're experienced we tackle the flex-model schema, and split up the documentation work for the 3 features.
NB for the schema speccing, we already have some results from a previous session regarding feature 3, in terms of defining a grid topology. I believe the design that came out of that should also fit the other two features, so we end up with a similar UX for what would at first glance appear to be three very different features.
| ) | ||
| commitments.append( | ||
| FlowCommitment( | ||
| name=device_commodity[d], |
There was a problem hiding this comment.
I'm wondering whether we need commitments to be uniquely named, for the cost reporting (commitment_costs) in our StorageScheduler, and whether we need some way of computing totals. Something to check in the test by having an assert statement on the total expected electricity and gas costs.
There was a problem hiding this comment.
I have added some assert statements, please look into them
There was a problem hiding this comment.
Thanks. I think these must include some reasoning behind the values, though, because taking the scheduling results at face value and then asserting they are correct is rather worthless.
First follow-up question: why are the electricity costs negative?
| # ---- key behavioural check: | ||
| # total commitment cost should be <= 1 breach per group per timestep | ||
| # | ||
| # If baselines were duplicated, cost would be ~2x for the shared buffer. | ||
| expected_max_cost = len(index) * breach_price * 2 | ||
| assert planned_costs <= expected_max_cost |
There was a problem hiding this comment.
A bit hard to follow, this one. Maybe there's something more straightforward we could use to check for the expected behaviour.
There was a problem hiding this comment.
I still don't understand what these key behavioural checks are actually doing.
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
…n-gas-and-electricity # Conflicts: # flexmeasures/data/models/planning/tests/test_commitments.py
This PR extends the Commitment model and device scheduler to support grouped devices within a single commitment.
Why
Until now, a commitment could apply to:
This was insufficient for real‑world setups such as:
What changed
Commitments now support custom device groups, allowing a single
FlowCommitment or StockCommitment to aggregate over multiple devices.
The scheduler aggregates flows or stocks per device group and applies deviation penalties once per group per timestep.
Commitments may reference:
New Pyomo sets (cg, cjg) and constraints enforce grouped commitment
equalities consistently for both flow and stock commitments.
Cost reporting correctly aggregates costs per logical commitment instead of
duplicating them per device.
Result
This enables correct modelling of shared buffers and feeder‑level soft
constraints without artificial cost inflation or duplicated baselines.
How to test
1️⃣ Run the new unit test
This test verifies:
2️⃣ Sanity‑check behaviour (what to look for)