Skip to content

test: multi-session same-sensor schedules accumulate (sum) - #2344

Merged
Ahmad-Wahid merged 6 commits into
FlexMeasures:mainfrom
sankalpsthakur:test-1947-multi-session-same-sensor
Aug 16, 2026
Merged

test: multi-session same-sensor schedules accumulate (sum)#2344
Ahmad-Wahid merged 6 commits into
FlexMeasures:mainfrom
sankalpsthakur:test-1947-multi-session-same-sensor

Conversation

@sankalpsthakur

@sankalpsthakur sankalpsthakur commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Description

Regression tests for multi flex-model sessions after #1948:

  • Non-overlapping windows on one power sensor: schedules sum
  • Overlapping sessions use two connectors on one charge point, with each connector's power-capacity pre-split during the shared hours
  • EVSE generic asset is a charge point, not a building

Test-only. DCO signed.

Validation

  • uv run pytest flexmeasures/data/models/planning/tests/test_storage.py -k multiple_sessions (2 passed)

AI/LLM disclosure

  • AI coding tools (including Grok and/or Codex agent-assisted editing) were used to help draft or modify code and this PR description.
  • I reviewed the complete change, understand the reasoning, and ran the reported local tests before submitting.
  • This submission is original work of authorship under the project CLA / contributor terms; AI output was not pasted unreviewed.

@sankalpsthakur
sankalpsthakur force-pushed the test-1947-multi-session-same-sensor branch 3 times, most recently from d446240 to 6632b8a Compare July 22, 2026 19:03
@Flix6x
Flix6x requested a review from Ahmad-Wahid July 22, 2026 19:06
@sankalpsthakur
sankalpsthakur force-pushed the test-1947-multi-session-same-sensor branch from 6632b8a to c59ede3 Compare July 28, 2026 10:14
Comment thread flexmeasures/data/models/planning/tests/test_storage.py Outdated
Comment thread flexmeasures/data/models/planning/tests/test_storage.py Outdated
Comment thread flexmeasures/data/models/planning/tests/test_storage.py Outdated
@sankalpsthakur

Copy link
Copy Markdown
Contributor Author

switching the asset to a charge point makes sense — there's no charge point fixture in the planning conftest yet (flexible_devices has it as a todo), so i'll add one.

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.

@Ahmad-Wahid

Copy link
Copy Markdown
Contributor

Thanks for pointing to the issue. The overlapping sessions example is wrong there. We should have separate power sensors.

@Ahmad-Wahid

Copy link
Copy Markdown
Contributor

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.

@sankalpsthakur

Copy link
Copy Markdown
Contributor Author

switched to a charge point fixture with two separate connectors for the overlap case (site-power-capacity is the shared constraint across them), kept the single shared sensor for the non-overlap test since that's the actual #1947 case. pushed in 813ce6e.

@sankalpsthakur

Copy link
Copy Markdown
Contributor Author

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?

@sankalpsthakur
sankalpsthakur force-pushed the test-1947-multi-session-same-sensor branch from 813ce6e to ff465b9 Compare August 1, 2026 10:37
@sankalpsthakur

Copy link
Copy Markdown
Contributor Author

Rebased onto current main. Per #1947 and review: same-sensor non-overlap remains the regression (#1948 sum); same-sensor overlap is intentionally not added (unrealistic on one connector — corrected in the issue). Overlap coverage stays on two connectors sharing site capacity. Ready for re-review.

@sankalpsthakur

sankalpsthakur commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @Ahmad-Wahid, fixed the three points. Switched to a charge point with two connectors (ff465b9), separate sensors for the overlap case, and rebased on main on 2026-08-01 with checks green.

Kept single-sensor non-overlap as the #1947 regression. Overlap stays two-connector as in the updated issue. Let me know if you want same-sensor overlap added too.

Fixes #1947

@sankalpsthakur
sankalpsthakur force-pushed the test-1947-multi-session-same-sensor branch from 874af55 to eec4b44 Compare August 7, 2026 17:42
@sankalpsthakur

Copy link
Copy Markdown
Contributor Author

rebased onto current main with signoff, merge conflicts cleared. multi-session tests still pass locally.

@sankalpsthakur

sankalpsthakur commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

@Ahmad-Wahid ready when you are (you mentioned Monday).

eec4b44 has the earlier feedback:

  • charge point asset (not building)
  • same-sensor non-overlap kept as the sum regression
  • overlap is two connectors sharing site capacity

CI green on head.

@Ahmad-Wahid

Ahmad-Wahid commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

@Ahmad-Wahid ready for re-review when you have a moment.

I will review it on Monday.

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>
Review asked for different power sensors on a charge point, with each
connector's power-capacity decreased during the shared hours. Drop the
site-cap pin and pre-allocate those windows in the flex-models instead.

Signed-off-by: Sankalp Thakur <sankalphimself@gmail.com>
@sankalpsthakur
sankalpsthakur force-pushed the test-1947-multi-session-same-sensor branch from eec4b44 to 3d525f4 Compare August 12, 2026 21:40
@sankalpsthakur

Copy link
Copy Markdown
Contributor Author

rewrote the overlap case so each connector's power-capacity is pre-split during the shared hours (the decrease you described), instead of pinning both with site-power-capacity. same-sensor non-overlap is unchanged. 3d525f4

@Ahmad-Wahid
Ahmad-Wahid self-requested a review August 15, 2026 00:20
Comment thread flexmeasures/data/models/planning/tests/test_storage.py Outdated
Comment thread flexmeasures/data/models/planning/tests/test_storage.py Outdated
Signed-off-by: Sankalp Thakur <sankalphimself@gmail.com>
@sankalpsthakur

Copy link
Copy Markdown
Contributor Author

cut the cross-reference lines in both docstrings, kept the rest. de73133.

@Ahmad-Wahid
Ahmad-Wahid merged commit 26a0f01 into FlexMeasures:main Aug 16, 2026
9 checks passed
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.

StorageScheduler overwrites schedules when multiple sessions use the same sensor

2 participants