Highway traffic - 2D ring road and jam waves

Cars on a ring road follow four simple rules; congestion appears out of nowhere when drivers brake at random.

Switch to 3D

Presets

Playback

Road and drivers

Raise the density, add random braking, or tap a car to make it stop and watch the jam wave travel backwards.

Layers

Model checks

The science

The model

Nagel and Schreckenberg (1992) update every car in parallel each second: (1) accelerate, v → min(v+1, vmax); (2) brake to the free gap ahead, v → min(v, gap); (3) with probability p slow down by one, v → v-1; (4) move v cells. One cell is 7.5 m and one step one second, so one cell/step is 27 km/h.

Flow and density

Flow is q = ρ ⟨v⟩. For p = 0 the steady state is exactly q = min(vmax ρ, 1 - ρ): free flow rises linearly until ρ = 1/(vmax+1), then the road is limited by the gaps. With p > 0 the peak drops and above a critical density spontaneous "phantom" jams form without any obstacle; they move against the traffic, which is the diagonal streaks in the space-time diagram.

Honest simplifications: single lane, no overtaking, no lane changes, identical cars and drivers, discrete cells, a closed ring with no on-ramps. The model reproduces the qualitative shape of the real fundamental diagram, not a calibrated road.

What to try
  • "Perfect drivers": p = 0 gives smooth flow with no jams, and the dots lie exactly on the orange line in the first graph.
  • "Phantom jams": the red diagonal streaks in the space-time diagram appear without any obstacle.
  • Press "Sweep fundamental diagram" to draw the whole curve for the current speed limit and p.
  • Tap a car on the ring to stop it and trace the shock wave.
Flow versus density (fundamental diagram)
Mean speed over time
Speed distribution of cars