35 vehicles following the Intelligent Driver Model on a ring road. A single braking perturbation amplifies through the platoon, creating a backward-propagating phantom traffic jam. Cars coloured green (free flow) through red (stopped).
30 vehicles on a 120-cell periodic highway governed by the stochastic cellular automaton rules (accelerate, brake, random slowdown, move). Top panel shows real-time car positions with speed colouring; bottom panel builds up the space-time diagram revealing backward-propagating jam waves.
Godunov scheme solving the LWR hyperbolic PDE with Greenshields fundamental diagram. An initial high-density block (jam) disperses: backward shock propagates upstream while a rarefaction fan spreads downstream. Road strip colour indicates local congestion.
25 vehicles on a circular road following the Optimal Velocity Model. Initially in near-uniform free flow, a small position perturbation triggers a Hopf bifurcation — the speed bar chart on the right shows the instability growing into a full stop-and-go wave rotating around the ring.
200 vehicles navigating Aberdeen's real street network (fetched via OSMnx, 800m radius around Marischal College). Each vehicle follows IDM car-following on actual road segments, re-routing on arrival. Colour indicates speed: green = free flow, red = congested.
Aberdeen presents distinctive traffic modelling challenges:
- Limited road network: geography constrains the city between the Rivers Don and Dee, the North Sea coast, and surrounding hills, creating natural bottlenecks.
- Bridge dependence: key pinch points at the Bridge of Don, Bridge of Dee, and King Street/Market Street corridors.
- The AWPR effect: the Aberdeen Western Peripheral Route (opened 2018) rerouted strategic traffic but shifted congestion patterns.
- Tidal commuter flows: strong directional bias from residential north/south into the city centre and energy-sector business parks.
- Port and industrial traffic: heavy goods vehicles serving Aberdeen Harbour and the energy industry mix with commuter traffic.
Treat traffic as a fluid and model aggregate density, flow, and velocity.
LWR Model (Lighthill-Whitham-Richards)
The foundational first-order hyperbolic PDE:
where
Aberdeen application: model jam propagation along single-corridor routes like King Street (A956) or the A90 approach to the Bridge of Don.
Payne-Whitham (second-order) Model
Adds a momentum equation with an anticipation/pressure term:
where
Aberdeen application: model the oscillatory congestion on the A90/A96 merge zones where drivers react to downstream queues.
Simulate individual vehicle dynamics; useful for detailed intersection and merge studies.
Intelligent Driver Model (IDM)
where
Aberdeen application: simulate individual vehicle behaviour at the Anderson Drive / A90 junction or roundabouts like the Haudagain.
Optimal Velocity Model (Bando)
Simple but captures spontaneous jam formation via Hopf bifurcation when sensitivity
Aberdeen's road network as a directed graph
Static Traffic Assignment (Wardrop Equilibrium)
Find link flows
Solved via convex optimisation (Beckmann formulation):
subject to flow conservation and non-negativity. Link cost functions typically follow the BPR formula:
Aberdeen application: evaluate how closing or upgrading a single link (e.g., Union Street bus gates) redistributes flow across the entire network. Quantify the Braess paradox potential in Aberdeen's constrained topology.
Dynamic Traffic Assignment (DTA)
Extends the above to time-varying demands and link travel times; models rush-hour wave propagation across the network.
Nagel-Schreckenberg Model
Discrete space-time-velocity model on a 1D lattice. At each time step:
-
Acceleration:
$v \leftarrow \min(v+1,, v_{\max})$ -
Braking:
$v \leftarrow \min(v,, d-1)$ where$d$ is gap to next car -
Randomisation: with probability
$p$ ,$v \leftarrow \max(v-1,, 0)$ -
Movement: advance
$v$ cells
Aberdeen application: fast simulation of phantom jam emergence on long stretches (A90 dual carriageway). Easy to extend to multi-lane with lane-changing rules. The stochastic element captures realistic driver variability.
Model intersections and bottlenecks as queueing systems.
M/D/1 or M/G/1 queues for signalised junctions: vehicles arrive as a Poisson process (rate
where
Tandem / network queues: chain multiple intersections (e.g., the sequence of traffic lights along Union Street or King Street) as a Jackson network to analyse spillback and blocking.
Aberdeen application: optimise signal timings along the Market Street / Guild Street corridor; quantify delays at the Beach Boulevard / Esplanade signals.
Mean-field game (MFG) models: each driver minimises their own cost functional coupled to the population density:
Useful for modelling route-choice equilibria with many interacting agents.
Bayesian traffic state estimation: fuse sparse sensor data (e.g., SCOOT loop detectors on Aberdeen's signal network, Google/Waze travel times) with model predictions via Kalman filtering or particle filters to estimate real-time density fields.
Machine learning surrogates: train neural networks on simulation outputs or historical data (e.g., Traffic Scotland / Aberdeen City Council open data) to provide fast traffic state prediction for scenario testing.
| Approach | Best suited for | Data needs |
|---|---|---|
| LWR / Payne-Whitham | Corridor-level jam propagation (A90, A96) | Flow-density measurements at a few points |
| IDM simulation | Junction/roundabout design (Haudagain, Bridge of Don) | Turning counts, signal plans |
| Nagel-Schreckenberg CA | Quick scenario testing, phantom jam statistics | Approximate flow rates |
| Network assignment | City-wide route redistribution, policy evaluation | OD demand matrix, link capacities |
| Queueing models | Signal optimisation on arterial corridors | Arrival rates, signal timing plans |
| MFG / data-driven | Real-time prediction, route guidance | Sensor/GPS trace data |
- Aberdeen City Council traffic count and signal data
- Traffic Scotland real-time and historical journey time data
- Transport Scotland STATS19 accident records and traffic surveys
- OpenStreetMap road network geometry for graph extraction
- Uber Movement / Google Environmental Insights travel time datasets
All models are implemented in the trafficjams/ package. Run with:
pip install -r requirements.txt
python -m simulations.run_allThe Godunov scheme resolves shockwave propagation from an initial high-density block. The upstream shock travels backward (visible as the leftward-moving density front) while a rarefaction wave fans out downstream — classic LWR behaviour matching the Greenshields fundamental diagram.
The second-order model with anticipation term captures stop-and-go oscillations near the merge zone. Unlike the first-order LWR, the momentum equation allows velocity to deviate from equilibrium, producing richer wave structures.
50 vehicles on a 1km circular road. A small initial speed perturbation on one vehicle amplifies through the platoon, producing a persistent traffic jam that propagates backward — the classic "phantom jam" phenomenon. Speed profiles show oscillatory convergence.
The Optimal Velocity Model demonstrates how uniform flow becomes unstable when the sensitivity parameter κ lies in a critical range. The mean speed drops and speed variance increases as the system evolves into stop-and-go waves.
The stochastic CA model produces realistic jam patterns on a 500-cell lattice with 100 vehicles. Backward-propagating jam waves (dark diagonal bands) emerge spontaneously from the random braking rule — a hallmark of the NaSch model.
Beckmann formulation solved with BPR cost functions on an 8-node Aberdeen-inspired network. At equilibrium, used paths have approximately equal costs (Wardrop's first principle). Path 2 (Anderson Drive) carries the most flow due to higher capacity.
Queue length and delay grow nonlinearly with utilisation, approaching infinity as ρ → 1. A 4-intersection corridor (modelling Union Street or King Street) shows how delays compound through multiple signals. The ρ = 0.85 threshold marks typical onset of severe congestion.
- Lighthill, M.J. & Whitham, G.B. (1955). On kinematic waves II: A theory of traffic flow on long crowded roads. Proc. Royal Society A, 229(1178).
- Treiber, M. & Kesting, A. (2013). Traffic Flow Dynamics. Springer.
- Nagel, K. & Schreckenberg, M. (1992). A cellular automaton model for freeway traffic. J. Phys. I France, 2(12).
- Wardrop, J.G. (1952). Some theoretical aspects of road traffic research. Proc. ICE, 1(3).





















