You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Share storage-efficiency per stock group and index solver stock by group (#2325)
* Speed up device_scheduler with a recursive stock balance
`_get_stock_change` expressed a device's stock at step j as a running sum
over all earlier steps, so the number of model nonzeros grew quadratically
with the scheduling horizon (e.g. ~12k nonzeros at 12h, ~349k at 3 days).
That dominated solve time on longer horizons.
Introduce an explicit `device_stock` variable coupled by a recursive
`device_stock_balance` constraint (stock[j] = a*stock[j-1] + b*change[j],
with a, b the per-step loss coefficients that apply_stock_changes_and_losses
computes). This is mathematically equivalent -- verified identical
objectives across horizons and against the planning test suite -- and keeps
the number of nonzeros linear in the horizon. Solve time drops ~10x at the
2-day default horizon and ~23x at 3 days.
Found while investigating SeitaBV/ems#172.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LeqGFrHfGrBHAJyjdAyr3y
* Reference PR #2282 in the changelog entry
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LeqGFrHfGrBHAJyjdAyr3y
* Address review: apply changelog suggestion and cache stock-group device lists
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Fix degenerate optimum in alignment regression test after merging main
The recursion formulation lands on a cost-equal alternative vertex (A charges 3,
B discharges 1 for free under net site metering). Make device B lossy in both
directions so the optimum is unique again.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Share storage-efficiency per stock group and index solver stock by group (#2324)
- storage-efficiency may now be defined on the entry holding a shared stock's
SoC parameters (or on exactly one member device) and applies to all members;
conflicting definitions fail fast, mirroring how #2321 treats the other SoC
parameters.
- device_scheduler now models one stock variable and one balance recursion per
stock group instead of per device, dropping the redundant secondary
recursions, and validates that grouped devices share their storage
efficiency and initial stock.
- Fix a latent key collision in device_to_group: an ungrouped device whose
index equalled a state-of-charge sensor id was silently merged into that
stock group, feeding its flows into the wrong stock.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Add changelog entries for PR #2325
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Enable storage losses in the dynamic-capacity test and consolidate changelog
The buffer's storage-efficiency (previously ignored, with a 'does not work yet'
todo) is now honored, so enable it at 99% per 15 minutes and update the
expected schedules: the heater covers the loss-induced remainder beyond the
maxed-out boiler around the clock, and the boiler tops up the buffer in the
final hour of the cheap-electricity window.
Also fold the two changelog entries into the existing shared-storage feature
entry for v1.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Attach soft SoC commitments to their stock, not to a device index
Enabler for scoping #2194's SoC-constraint relaxation per stock:
- StockCommitment gains a 'stock' attribute holding the stock key; the
StorageScheduler stamps it on all soft SoC commitments (soc-minima,
soc-maxima, prefer-full).
- The solver couples stock-scoped commitments to the stock group as a whole
(via the group's first device, whose stock is the group's stock), regardless
of which device index the commitment names.
- DeviceInventory.stock_constraint_device(stock_key) exposes the device that
applies a stock's SoC constraints, complementing stock_groups for
deserialization-time scoping logic.
- The solver's grouped-device efficiency guard now tolerates a missing
efficiency column (the default, lossless case), which direct callers of
device_scheduler commonly omit.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Remove dead device_stock_commitment_equalities
It was never registered as a model constraint; all device-level commitments
route through grouped_commitment_equalities.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: documentation/changelog.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ New features
20
20
* Floor off-clock API datetimes to a non-instantaneous sensor's resolution by default when ingesting sensor data, uploading sensor data, and handling scheduler flex-model timed events; configurable with the ``floor_datetimes_to_resolution`` sensor attribute [see `PR #2146 <https://www.github.com/FlexMeasures/flexmeasures/pull/2146>`_]
21
21
* Sensor references in flex-model and flex-context support various ways of filtering by source [see `PR #2209 <https://www.github.com/FlexMeasures/flexmeasures/pull/2209>`_]
22
22
* Let storage scheduling infer missing ``power-capacity`` from directional device capacities before falling back to site capacity, and default the missing opposite capacity to zero when only a non-zero ``consumption-capacity`` or ``production-capacity`` is configured [see `PR #2222 <https://www.github.com/FlexMeasures/flexmeasures/pull/2222>`_]
23
-
* Support multiple feeders to a shared storage [see `PR #2001 <https://www.github.com/FlexMeasures/flexmeasures/pull/2001>`_, `PR #2321 <https://www.github.com/FlexMeasures/flexmeasures/pull/2321>`_ and `PR #2322 <https://www.github.com/FlexMeasures/flexmeasures/pull/2322>`_]
23
+
* Support multiple feeders to a shared storage [see `PR #2001 <https://www.github.com/FlexMeasures/flexmeasures/pull/2001>`_, `PR #2321 <https://www.github.com/FlexMeasures/flexmeasures/pull/2321>`_, `PR #2322 <https://www.github.com/FlexMeasures/flexmeasures/pull/2322>`_ and `PR #2325 <https://www.github.com/FlexMeasures/flexmeasures/pull/2325>`_]
24
24
* The flex-context can now define multiple commodities, each specifying their own prices and grid capacities [see `PR #1946 <https://www.github.com/FlexMeasures/flexmeasures/pull/1946>`_, `PR #2172 <https://www.github.com/FlexMeasures/flexmeasures/pull/2172>`_, `PR #2235 <https://www.github.com/FlexMeasures/flexmeasures/pull/2235>`_ and `PR #2271 <https://www.github.com/FlexMeasures/flexmeasures/pull/2271>`_]
25
25
* Commodity contexts that omit grid-connection fields (prices and site capacities) now get smart defaults instead of failing or silently leaving the grid unconstrained — for instance, a bare ``{"commodity": "gas"}`` is treated as having no grid connection; see :ref:`commodity_context_defaults` for the full rules [see `PR #2272 <https://www.github.com/FlexMeasures/flexmeasures/pull/2272>`_]
26
26
* CLI support for adding/editing account attributes [see `PR #2242 <https://www.github.com/FlexMeasures/flexmeasures/pull/2242>`_]
0 commit comments