Expand description
Fixed-dwell timetable for closed-loop topologies.
LoopSchedule — fixed-dwell timetable for LineKind::Loop groups.
Where crate::dispatch::LoopSweepDispatch lets each Loop car
carry whatever per-car door_open_ticks the config specified
(so dwell tracks the rider load at each stop), LoopSchedule
overrides every Loop car in the group to a single
dwell_ticks value. The resulting timetable is predictable —
every car spends the same amount of time at every stop on every
lap — which is what people-mover lines, gondolas, and timetabled
shuttle services want.
§What this strategy does
- Fixed dwell: every Loop car in the group has its
door_open_ticksrewritten to the schedule’sdwell_ticksonce per pass viapre_dispatch. Idempotent — the same value is written unconditionally each tick, so re-applying the strategy leaves car state unchanged. - Hold-recovery: when a car arrives at a stop sooner than
target_headway_ticksafter the preceding car arrived at the same stop, the strategy issues aDoorCommand::HoldOpenextending the dwell bymin(target_headway_ticks - gap, hold_cap_ticks). This pushes the bunched follower back to its schedule slot rather than letting it tailgate the leader.- The cap prevents indefinite hold if the leader is stuck (e.g.
stopped indefinitely for heavy boarding) — the follower waits
at most
hold_cap_ticksextra per stop, then resumes patrol. - Crucially, hold-recovery never speeds a car up: an early-arriving follower can only delay itself, never overtake.
- A leader that runs late is not held — only followers running ahead of their schedule are held.
- The cap prevents indefinite hold if the leader is stuck (e.g.
stopped indefinitely for heavy boarding) — the follower waits
at most
- Snapshot round-trip:
builtin_idreturnsBuiltinStrategy::LoopScheduleandsnapshot_config/restore_configcarry all three tunable fields. Per-pass bookkeeping (last-arrival ticks, in-loading set) is#[serde(skip)]— restored sims rebuild it on the first tick where each car next enters Loading.
Bunching under heavy load is largely mitigated by hold-recovery
but not eliminated: a leader that takes an unusually long time to
board may exceed hold_cap_ticks of follower hold, and the
follower then catches up before recovering. Tune hold_cap_ticks
to the worst-case boarding burst your line expects.
Structs§
- Loop
Schedule Dispatch - Dispatch strategy that holds Loop cars to a uniform dwell at every stop, with hold-recovery to keep the timetable stable under load.
Constants§
- DEFAULT_
HOLD_ CAP_ TICKS - Default hold-recovery cap.