This is the 2D companion to the 3D "Bus Bunching" laboratory. Both share the same underlying instability, but this version derives the target (scheduled) headway analytically from the route parameters instead of assuming it, and shows the resulting headways as a live time-series rather than a space-time diagram.
Passengers waiting when a bus arrives at a stop:
P = arrivalRate * (time since the PREVIOUS bus left that stop)
Dwell time (boarding):
D = minDwell + P * boardTime
Holding (if enabled): if the gap since the previous bus is
below the target headway H, wait the difference before departing.
Fixed-point target headway (evenly spaced buses, no holding):
H = [stops * travelTime / buses] / (1 - stops*arrivalRate*boardTime/buses)
k = stops*arrivalRate*boardTime/buses (denominator's growth term)
- Every bus's dwell time is computed only from real accumulated passengers at the stop it is currently serving — nothing is scripted to "bunch" on a timer.
- A small random traffic-light/congestion delay is added to each travel segment (as in real streets); the feedback loop then amplifies this tiny perturbation into full bunching on its own.
- When k ≥ 1 the fixed point is mathematically unstable — any perturbation, however small, grows without bound, exactly the condition derived by Newell & Potts (1964) for real transit headways.
- Holding control compares each bus's actual gap behind the one ahead of it to the analytically-derived target H and makes the bus wait if it is running short — the same strategy used by real transit agencies' GPS-based holding systems.