test: multi-session same-sensor schedules accumulate (sum) - #2344
test: multi-session same-sensor schedules accumulate (sum)#2344sankalpsthakur wants to merge 4 commits into
Conversation
Documentation build overview
50 files changed ·
|
d446240 to
6632b8a
Compare
6632b8a to
c59ede3
Compare
| power_sensor = _shared_evse_power_sensor( | ||
| db, building, resolution, name="shared EVSE power non-overlap" | ||
| ) |
There was a problem hiding this comment.
The generic asset for an EVSE(connector) should be a charge point and not a building. A charge point can have a single or more connectors.
| def test_multiple_sessions_same_sensor_accumulate_overlapping_windows(db, building): | ||
| """Overlapping same-sensor sessions still sum after pre-allocating capacity. | ||
|
|
||
| Companion to ``test_multiple_sessions_same_sensor_accumulate_schedules``: when | ||
| two sessions share hours, power capacity must be pre-split in the flex-models | ||
| (Flix6x on #1947). The returned sensor schedule must still be the sum of both | ||
| device schedules, not the last session alone. | ||
|
|
||
| Setup: both sessions active all 4 hours at 0.5 kW each, each needing 2 kWh. | ||
| Sum → [1, 1, 1, 1] kW (~4 kWh). Overwrite would keep only one session at | ||
| 0.5 kW (~2 kWh). | ||
| """ |
There was a problem hiding this comment.
Overlapping sessions on the same power sensor would never happen. For example: we cannot charge two different cars from a single connector at the same time. This is applicable only in the terms of a charge point. A charge point has one or more connectors and that leads to overlapping sessions which then decrease the power capacity of the individual connector.
There was a problem hiding this comment.
For this test case, we should have different power sensors.
| power_sensor = _shared_evse_power_sensor( | ||
| db, building, resolution, name="shared EVSE power overlap" | ||
| ) |
There was a problem hiding this comment.
same as above. Use charge point asset
|
switching the asset to a charge point makes sense — there's no charge point fixture in the planning conftest yet ( on the overlapping test: the point of this pr is that two sessions on one sensor sum instead of overwrite (#1947). if that case moves to different power sensors it stops covering that. do you want the overlapping test dropped as unrealistic, or rewritten as a charge point with two connectors on separate sensors? happy either way, just don't want to guess. |
|
Thanks for pointing to the issue. The overlapping sessions example is wrong there. We should have separate power sensors. |
|
The main goal of that issue is to fix the non-overlapping sessions on the same power sensor. I have corrected the test case, maybe that helps you. |
|
the two-connector test exercises the charge point's site-capacity sharing, not the same-sensor accumulation from #1947/#1948 (that's still covered by the non-overlap test, but never with both sessions non-zero on the same tick). want a same-sensor overlap case added alongside it, or is the non-overlap coverage enough? |
Regression for FlexMeasures#1947 after core fix FlexMeasures#1948: two flex-model sessions sharing one power sensor must return a summed schedule, not overwrite. Signed-off-by: Sankalp Thakur <sankalphimself@gmail.com>
Strengthen the non-overlap regression with per-half assertions and add a companion case where capacity is pre-split across concurrent sessions on one power sensor (sum, not overwrite). Signed-off-by: Sankalp Thakur <sankalphimself@gmail.com>
Signed-off-by: Sankalp Thakur <sankalphimself@gmail.com>
Per review: an EVSE session's generic asset should be a charge point, not a building, and two sessions cannot physically overlap on the same connector's power sensor. Add a charge_point fixture and rewrite the overlapping-sessions test to use two connectors (separate power sensors) on one charge point, sharing its site-power-capacity - which is what actually makes overlap physically meaningful. The non-overlapping test keeps the single shared sensor, since that's the actual FlexMeasures#1947 regression, just moved onto the charge_point asset. Signed-off-by: Sankalp Thakur <sankalphimself@gmail.com>
813ce6e to
ff465b9
Compare
Description
StorageSchedulerto correctly combine multiple sessions targeting the same sensor #1948StorageSchedulerto correctly combine multiple sessions targeting the same sensor #1948 already changelogged the behaviour)Fixes #1947
Completes the regression-test slice discussed after #1948. Documentation example deferred pending product discussion (nhoening).
Core fix was #1948 (
storage_schedule[sensor] += ...). This PR only locks that in with focused tests maintainers asked for (high value / low effort).Impact
Severity: silent schedule loss — with multiple flex-model entries on one power sensor (common for EV sessions on a single charge point), only the last session's schedule was kept. Earlier sessions were overwritten with no error.
Before #1948: two non-overlapping 2 kWh sessions on one sensor → ~2 kWh delivered (first half zeros). After: ~4 kWh (both halves active).
Look & Feel
N/A (test-only).
Non-overlapping
[1, 1, 1, 1]kW, total energy 4 kWhStorageSchedulerto correctly combine multiple sessions targeting the same sensor #1948): would keep only the last session (~2 kWh, zeros in the first half)Overlapping (capacity pre-split)
Both sessions active all 4 hours at 0.5 kW each (pre-allocation per Flix6x on #1947):
[1, 1, 1, 1]kW (~4 kWh)How to test
Further Improvements
Related Items
StorageSchedulerto correctly combine multiple sessions targeting the same sensor #1948)StorageSchedulerto correctly combine multiple sessions targeting the same sensor #1948Sign-off