Rolling horizon: option to pin storage SoC at window seams
Maintainer antworten meist innerhalb von 2 Tagen
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
Start with optimize_with_rolling_horizon() in abstract.py and read the existing rolling-horizon example and water-value example (#1492). The issue describes the desired seam calculation, option behavior, and prototype tests, but asks whether the feature belongs in the API and whether to wait for related changes (#1973, #1987, #1934). Confirm that direction with maintainers before implementing; done means seam SoC is pinned while overlap remains free and existing settings are restored even if a solve raises.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Note: AI-assisted. Claims about the current behaviour and the prototype were machine-checked: the upstream code was read at
e74a67ee, and the numbers below come from running the prototype branch with HiGHS.
Describe the feature you'd like to see
optimize_with_rolling_horizon() has no foresight past the end of a window. When a window is shorter than the natural storage cycle, energy left in storage at the end of the window has no value to the LP, so it tends to discharge it. The next window then starts with storage that is too low.
The water-value example (#1492) fixes this by giving the store a time-varying marginal_cost taken from a perfect-foresight run. That works well, but it needs the perfect-foresight run first, which is exactly what rolling horizon is meant to avoid on large models.
I'd like a cheaper option: fix the state of charge at each window seam to a fraction of capacity. Every window then behaves as a closed cycle that ends where the next one starts.
n.optimize.optimize_with_rolling_horizon(
horizon=24, overlap=6, pin_terminal_soc=True, boundary_soc=0.5
)
The pin goes on the last snapshot a window commits (start + horizon - overlap - 1), not on the last snapshot of the window, so the overlap stays free as lookahead. It uses the existing state_of_charge_set and e_set, temporarily switches off cyclic_state_of_charge / e_cyclic, and restores both flags and set points after the run, also when a solve raises.
Users can do this today by computing the seams themselves and filling e_set, but it's easy to get wrong with overlap > 0. My own first version pinned the window end instead of the seam, and the store still drained at every seam.
I have a working prototype with tests on my fork: MaykThewessen/PyPSA@feat/rolling-horizon-closed-cycle (+112/-27 lines in abstract.py, plus tests).
Two questions before I open a PR:
- Is this something you want in
optimize_with_rolling_horizon(), or would you rather see it as a short recipe in the rolling-horizon example next to the water values? - If it goes in, should I wait until #1973 / #1987 land? Both change the same function. I also see #1934 moving storage to
Store, so I could restrict it to stores only if that fits the plan better.
Prototype details (AI-generated summary)
boundary_socis a float in [0, 1], applied as a fraction ofp_nom * max_hours(StorageUnit) ore_nom(Store).- Existing user set points in
state_of_charge_set/e_setare kept; the frames are reindexed, not rebuilt. - Probe with horizon 8, overlap 3, 24 snapshots and one 10 MW / 4 h battery against a sinusoidal price: with the pin on the window end instead of the seam, SoC at the seams (snapshots 4, 9, 14, 19) was 0, 30, 30, 0 MWh; with seam pinning it is 20 MWh (50 %) at each.
- Tests: pin holds at the seams for overlap 0 and 3, with StorageUnit and Store alone and together; user set points survive; flags and set points are restored after success and after a raised solve; out-of-range
boundary_socraises.
- Vorherrschende Sprache
- Python
- Sterne
- 2.2k
- Forks
- 732
- Ø Merge
- 3 T. 59 Min.
- Gemergte PRs (30 T.)
- 58
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus PyPSA/PyPSA
-
n.lpf_contingency() returns AttributeError: 'DataFrame' object has no attribute 'to_frame'Evtl. vergeben @Blizzeq hat das vor 6 Tagen übernommen. Offenneeds triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
PyPSA/PyPSA#2082 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
get_switchable_as_dense ignores order of inds and silently drops unknown namesEvtl. vergeben @musaaero hat das vor 7 Tagen übernommen. Offenbreaking components API data validation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
PyPSA/PyPSA#1977 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
gap optimization
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
Maintainer antworten meist innerhalb von 2 Tagen
-
Reserve and adequacy constraintsEvtl. vergeben @FabianHofmann hat das vor 5 Tagen übernommen. Offengap optimization reliability & uncertainty
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
PyPSA/PyPSA#2096 · 3 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 2 Tagen
-
AC power flow gap
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
PyPSA/PyPSA#2095 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 2 Tagen
Ähnliche Issues
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug documentation good first issue help wanted testing
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
Maintainer antworten meist innerhalb von 1 Tag
-
Show evidence time and supersede warnings in the memory inspectorEvtl. vergeben @Sinchanak-212 hat das heute übernommen. Offenarea: ux good first issue priority: medium
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 86/100
daniel-ospina/tortoise#11649 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 86/100
ComposioHQ/awesome-claude-skills#2438 ·
Maintainer antworten meist innerhalb von 15 Tagen