3D Night Traffic: Car Following, Signals and the Green Wave

A Blender-modelled night city: cars follow the Intelligent Driver Model through fixed-time signals, with live flow, queues and a space-time diagram.

Switch to 2D

Presets

Playback

Parameters

Camera

Layers

Quality

Model check

The science

What is modelled

A grid of four east-west and four north-south streets, each with one lane per direction, wrapped into rings of 480 m so that the number of cars stays fixed. Every car follows the car in front with the Intelligent Driver Model, and every junction has a fixed-time signal. The 3D city, cars, lamps and signal heads are Blender models; the traffic itself is computed live.

Equations

  • Intelligent Driver Model: a = a0 [1 − (v/v0)4 − (s*/s)2] with the desired gap s* = s0 + vT + vΔv / (2√(a0 b)). Here v0 is the desired speed, T the time headway, s0 = 2 m the standstill gap, a0 = 1.2 m/s², b = 2 m/s², and s the bumper gap to the leader.
  • Equilibrium: when every car moves at the same speed, se(v) = (s0 + vT)/√(1 − (v/v0)4), the density is k = 1/(se + l) with car length l = 4.8 m and the flow is q = k v. The blue curve in the middle graph is this relation.
  • A red or yellow light is treated as a stopped car at the stop line. A yellow light is run when the car could not stop at 4 m/s². A stopped IDM car sits exactly s0 behind the line, because the acceleration is zero at v = 0 only for s = s0.
  • Signals: cycle C, east-west share φ: green φC − 5 s, yellow 3 s, all red 2 s, then the cross street. Junction (i, j) is shifted by D (i + j). With D = S / v0 (block length 120 m divided by the free speed) a platoon travelling east or south meets green at each junction, the classic green wave.
  • Queues: a queue of N cars at a red light discharges at the saturation flow, so a longer red phase or a smaller green share lengthens the wait roughly in proportion; the space-time diagram shows the stopped waves as red slanted bands.

Checks run in the page

  • A ring of N cars started at the analytic equilibrium must stay there: the simulated mean speed is compared with the solution of se(v) for three densities.
  • A car approaching a red light must stop exactly s0 before the line with moderate braking.
  • The signal timing is audited by sampling (green and yellow fractions, never two conflicting greens), and a car on a green wave crosses all four junctions without slowing.

Honest simplifications

  • Cars drive straight, there are no turns, lane changes, pedestrians or parked vehicles, and a car that leaves one end of a street re-enters at the other (the city is a torus, hidden by fog). All cars have the same IDM parameters apart from a random ±10 % desired speed.
  • The green wave works for eastbound and southbound traffic only; westbound and northbound platoons see the opposite timing, as on a real one-way-coordinated arterial.
  • Light glows are drawn as sprites. Buildings, lamps and cars are decoration; they do not take part in the physics.

What to try

  • Compare the default offset D = 0 with the Green wave preset: stops and delay drop at the same density.
  • Raise the density to 32 cars per lane (rush hour) and watch the flow leave the equilibrium curve and queues spill back to the previous junction.
  • Lower the time headway to 0.8 s: the road carries more at the same density, but the traffic becomes jerky at the signals.
  • Press Follow a car to ride along and see the signals from the driver's side.
Loading model...
Loading Blender model...
Space-time diagram of one eastbound street
Fundamental diagram: flow vs density
Mean speed and stopped share
Made with 🟠 Blender · Three.js