Rolling horizon: option to pin storage SoC at window seams
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 2.2k
- フォーク
- 732
- 平均マージ
- 3日 59分
- マージ済み PR(30日)
- 58
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PyPSA/PyPSA のほかの issue
-
n.lpf_contingency() returns AttributeError: 'DataFrame' object has no attribute 'to_frame'対応中かも @Blizzeq が 6 日前に担当しました。 オープンneeds triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 2 日以内に返信
-
get_switchable_as_dense ignores order of inds and silently drops unknown names対応中かも @musaaero が 7 日前に担当しました。 オープンbreaking components API data validation
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信
-
gap optimization
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
メンテナーはふだん 2 日以内に返信
-
Reserve and adequacy constraints対応中かも @FabianHofmann が 5 日前に担当しました。 オープンgap optimization reliability & uncertainty
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
PyPSA/PyPSA#2096 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
AC power flow gap
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
メンテナーはふだん 2 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
Successor registrant to review: Navient Holdings, Inc. (CIK 2152623), 8-K12B 0001193125-26-436899オープンsuccessor-review
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dgunning/edgartools#1889 ·
メンテナーはふだん 1 日以内に返信
-
`destroy` sans terminal répond « Aborted. » au lieu de réclamer `--yes` comme `clean` et `reset`オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
stephrobert/dsoxlab#354 ·
メンテナーはふだん 1 日以内に返信
-
hardware help wanted testing
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
mediajunkie/piper-morgan-product#2335 · コメント 1 件 ·