Traffic Network Simulator: Congestion & Signal Optimization

simulator intermediate ~12 min
Loading simulation...
Moderate traffic on a 5×5 grid with 150 vehicles

With 150 vehicles on a 5×5 grid, traffic flows at moderate congestion. Increasing vehicles beyond road capacity triggers a phase transition to stop-and-go traffic, demonstrating the fundamental diagram of traffic flow.

Formula

Congestion Index = Actual Travel Time / Free-Flow Travel Time
Flow = Density × Speed (fundamental relation)
BPR Function: t = t₀ × (1 + α(V/C)^β) where α=0.15, β=4

Traffic as a Complex System

Urban traffic is a classic example of a complex system where individual decisions create emergent collective behavior. Each driver independently chooses a route to minimize their own travel time, yet these selfish decisions interact to produce system-wide patterns — congestion waves, spontaneous gridlock, and the paradoxical result that adding roads can make traffic worse. Understanding these dynamics requires modeling traffic as a flow system governed by fluid-like equations.

The Fundamental Diagram

Traffic engineers describe road behavior using the fundamental diagram, which plots the relationship between density (vehicles per km), flow (vehicles per hour), and speed. At low density, cars travel at free-flow speed and flow increases linearly with density. At critical density, flow reaches maximum capacity. Beyond this point, the system enters the congested regime where adding more vehicles actually decreases both speed and throughput — the counterintuitive phenomenon every commuter experiences during rush hour.

Signal Timing and Network Coordination

Traffic signals are the primary control mechanism for urban road networks. The signal cycle length, green split ratios, and coordination between adjacent intersections dramatically affect network performance. This simulation models fixed-time signals where you can adjust the cycle length. Shorter cycles reduce waiting time at light traffic but may not clear queues during heavy traffic. The optimal cycle length depends on the volume-to-capacity ratio of the intersection approaches.

From Congestion to Gridlock

Congestion and gridlock are qualitatively different phenomena. Congestion is a gradual increase in travel time as density rises — annoying but functional. Gridlock is a phase transition: a catastrophic state where intersecting queues block each other in a deadlock. The transition is sudden and hysteretic — once gridlock sets in, traffic must drop well below the triggering level before flow recovers. Watch how increasing vehicle count past the critical threshold causes the gridlock percentage to spike nonlinearly.

FAQ

What is the fundamental diagram of traffic flow?

The fundamental diagram relates traffic density, flow (vehicles per hour), and speed. At low density, vehicles move at free-flow speed. As density increases, flow rises until reaching capacity. Beyond critical density, both speed and flow drop — the congested regime where adding more cars actually reduces throughput.

What is Braess's paradox?

Braess's paradox shows that adding a new road to a congested network can actually increase travel times for all drivers. This counterintuitive result occurs because selfish route choices by individual drivers don't optimize the system as a whole. It was demonstrated mathematically by Dietrich Braess in 1968.

How do traffic signals affect congestion?

Properly timed traffic signals can increase intersection throughput by 20-30%. Adaptive signal control systems that respond to real-time traffic conditions outperform fixed-time signals. Green waves — coordinated signals along a corridor — allow platoons of vehicles to pass through multiple intersections without stopping.

What causes gridlock?

Gridlock occurs when vehicles block intersections, preventing cross-traffic from moving. This creates a deadlock where no direction can proceed. It typically starts when traffic volume exceeds about 90% of road capacity, and a single blocked intersection can cascade through the entire grid network.

Sources

Embed

<iframe src="https://homo-deus.com/lab/urban-planning/traffic-network/embed" width="100%" height="400" frameborder="0"></iframe>
View source on GitHub