Report error for bigger timesteps
まだ誰も着手していません。
評価
調査の方向性
simba/report.pyの、report.generate内のSoCスライスと末尾値のロジック付近(275~293行あたり)から始めてください。空のスライスとNoneのみのスライスがどのように動作するかを確認し、その後、interval > 1で、1つのintervalより短いローテーションを使ったテストを追加してください。完了条件は、レポートの生成が完了し、ローテーションの最小値と到着時SoCが少なくとも1つの値から計算されることです。
索引モデルが issue の本文から書いたものです。
説明
Report crashes with IndexError if a rotation is shorter than the simulation interval
Description
With a larger simulation interval (e.g. interval = 15), the report mode aborts while
building the per-rotation SoC time series:
[ERROR] IndexError during report: list index out of range
Traceback (most recent call last):
File "simba/simulate.py", line 111, in modes_simulation
schedule, scenario = func(schedule, scenario, args, i)
File "simba/simulate.py", line 301, in report
report.generate(schedule, scenario, args)
File "simba/report.py", line 293, in generate
rotation_soc_ts[last_known_idx + 1:] = i * [rotation_soc_ts[last_known_idx]]
IndexError: list index out of range
The simulation itself finishes. Only the report is incomplete: rotation_summary,
rotation_socs, cost outputs and everything generated after this point are missing.
Cause
report.generate (simba/report.py, around lines 275–293) cuts the vehicle SoC time series to
the rotation:
start_idx = (rotation.departure_time - sim_start_time) // interval
end_idx = start_idx + ((rotation.arrival_time - rotation.departure_time) // interval)
...
rotation_soc_ts = vehicle_soc[start_idx:end_idx]
for i, soc in enumerate(reversed(rotation_soc_ts)):
if soc is not None:
break
last_known_idx = len(rotation_soc_ts) - 1 - i
rotation_soc_ts[last_known_idx + 1:] = i * [rotation_soc_ts[last_known_idx]]
If a rotation is shorter than one interval, end_idx == start_idx and rotation_soc_ts is
empty. Then:
- the
forloop does not run, soikeeps its value from a previous rotation (or is undefined
for the first rotation, which gives aNameError), last_known_idxbecomes negative,rotation_soc_ts[last_known_idx]on the empty list raisesIndexError.
A related edge case: if all values in the slice are None, the loop ends without break and
last_known_idx is -1. The trailing values are then filled from the last element (None),
so no crash, but no meaningful SoC either.
With interval = 1 this practically never happens. With interval = 15 short rotations
(e.g. a 10-minute empty run between two depots) are common.
Steps to reproduce
- Use a schedule that contains a rotation shorter than 15 minutes.
- Set
interval = 15andmode = ["sim", "report"]. - Run SimBA. The report aborts with the
IndexErrorabove.
Expected behaviour
The report is generated for any interval. A rotation shorter than one interval gets at least
one SoC value (e.g. the value at the step containing its departure), and its Minimum_SOC /
SOC_at_arrival are computed from that.
Possible fix
- Make the slice contain at least one step, e.g.
end_idx = max(end_idx, start_idx + 1)
(round the arrival up to the next step instead of down). - Handle an empty or all-
Noneslice explicitly instead of relying on the loop variablei
after the loop. - Add a test with
interval > 1and a rotation shorter than one interval.
Related observation
Larger intervals also change the simulation results systematically: arrivals and departures are
handled at full time steps, so vehicles with short standing times lose charging time. In a
comparison of interval = 1 vs. interval = 15 on the same schedule, the number of rotations
with negative SoC increased several-fold, while charged energy (±0.2 %) and peak power of large
depots (±3 %) barely changed. This is a modelling limitation rather than a bug, but could be
mentioned in the docs for interval.
- 主要言語
- Python
- スター
- 4
- フォーク
- 1
- 平均マージ
- 2日 21時間
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rl-institut/SimBA のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
rl-institut/SimBA#246 ·
-
selection of wrong vehicle type対応中かも @j-brendel が 6 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
rl-institut/SimBA#248 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
rl-institut/SimBA#238 ·
-
rename rotation -> block再び着手できるかも @stefansc1 が 764 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
rl-institut/SimBA#215 · 担当者 1 名 ·
-
wontfix
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
rl-institut/SimBA#207 · コメント 1 件 ·
rl-institut/SimBA の issue をすべて見る
似ている issue
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 74/100
BrainLesion/BraTS#200 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
OpenHands/extensions#970 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
rl-institut/enetra#91 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
huggingface/datasets#9100 ·
メンテナーはふだん 1 日以内に返信
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
NVIDIA/garak#2486 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信