Draw fundamental diagrams in real time with the Greenshields, Greenberg and Underwood models. Three-tab graphs plus a moving-vehicle animation make traffic congestion mechanisms easy to grasp.
Speed-Density Model
Road Parameters
Free-Flow Speed uf
km/h
Jam Density kj
veh/km
Current Traffic State
Current Density k
veh/km
Results
—
Maximum Flow [veh/h]
—
Optimal Density [veh/km]
—
Current Speed [km/h]
—
Current Flow [veh/h]
Qk
Flow q [veh/h] vs density k [veh/km](● current operating point)
Uk
Velocity u [km/h] vs density k [veh/km](● current operating point)
Uq
Velocity u [km/h] vs Flow q [veh/h](● current operating point)
Anim
Vehicle animation: higher density shortens spacing and lowers speed.
Theory & Key Formulas
u = uf (1 − k/kj)
q = k · u
qmax @ k = kj/2
What is a Traffic Flow Simulator (LWR Fundamental Diagram)?
🙋
What is the "LWR fundamental diagram"? Is it a diagram of road congestion?
🎓
Roughly speaking, it's a relationship diagram that represents the "state" of traffic using three quantities: density, speed, and flow. As density (congestion) increases, speed drops, and the graph shows how flow (number of vehicles passing per hour) changes, allowing you to see at a glance whether the road is smooth or on the verge of congestion. Try slowly moving the "Current Density k" slider to the right in this simulator. You'll see the operating point move along the curve, and once the flow exceeds the peak (maximum flow), it starts to decrease.
🙋
When I switch the "speed-density model," the shape of the curve changes completely. Which one is correct?
🎓
Actually, there is no single "absolute" correct answer. Greenshields' linear model is easy to calculate but loses accuracy in the medium-to-high density range. Greenberg's logarithmic model excels at representing congested (high-density) states, while Underwood's exponential model is better for low-to-medium density flow. In practice, the optimal model is selected by fitting it to actual observed data from the road.
🙋
I see "maximum flow" displayed—is this the road capacity?
🎓
Exactly! It's the theoretical limit beyond which no more vehicles can flow. In the Greenshields model, it's given by $q_{max} = u_f k_j / 4$, and the optimal density is $k_{opt} = k_j / 2$. Try increasing the "Free Flow Speed uf" from 80 to 100 km/h. You'll see the maximum flow jump up, right? This simulates how relaxing speed limits increases capacity. Conversely, lowering the "Jam Density kj" (narrower road) decreases the maximum flow.
🙋
The curve in the "speed-flow" tab has an interesting shape. It's not a normal parabola but looks like a loop.
🎓
Sharp observation! This shows the "duality" of traffic. For the same flow, there are two states: free-flow (few cars moving fast) and congested (many cars crawling). The upper half of the curve corresponds to free flow, and the lower half to congestion. Whether the operating point is on the upper (fast) or lower (slow) part tells you the current traffic state. This is the structural root of the "instability" of traffic congestion.
🙋
In the animation below, it's realistic how increasing density makes the cars bunch up and slow down.
🎓
Yes! The car speed in the animation is updated in real time using the calculated "current speed u." The "sag congestion" (natural congestion at the transition from downhill to uphill) often seen in real traffic occurs when the density-speed relationship is in the unstable region (near optimal density), and a slight braking action propagates upstream as a wave. This is called a shockwave (congestion wave).
Physical Model & Key Equations
LWR theory treats traffic as a continuum. Density $k$, speed $u$, and flow $q$ obey the following fundamental relationship.
$$q = k \cdot u$$
The density conservation law in space and time is expressed by this partial differential equation.
It follows from the physical statement that the change in vehicles inside a road segment equals inflow minus outflow.
Three common models define how speed $u$ depends on density $k$.
$$\text{Greenshields:} \quad u = u_f \left(1 - \frac{k}{k_j}\right)$$
$$\text{Greenberg:} \quad u = u_m \ln\left(\frac{k_j}{k}\right)$$
$$\text{Underwood:} \quad u = u_f \exp\left(-\frac{k}{k_m}\right)$$
$u_f$: free-flow speed at zero density, and $k_j$: jam density at complete standstill. In the Greenshields model, $q_{max} = u_f k_j / 4$ and the optimal density is $k_{opt} = k_j / 2$.
Frequently Asked Questions
The propagation speed of the boundary between two traffic states (density $k_1$, flow $q_1$ and $k_2$, $q_2$) is given by the Rankine-Hugoniot condition $w = (q_2 - q_1)/(k_2 - k_1)$. Typically, the tail of congestion propagates at a negative speed (upstream). In the Greenshields model, it is approximately $-u_f/2$ at maximum.
Greenshields is easy to calculate and suitable for basic learning (low accuracy in high-density regions). Greenberg fits well with observed data in congested (high-density) areas but behaves unnaturally at low densities. Underwood has high reproducibility in low-to-medium density ranges. In practice, the most suitable model is selected by fitting to locally observed speed-density data.
Ultrasonic sensors or loop coils installed on the road measure vehicle passages, and flow and density (or speed) are calculated from 5-minute or 15-minute aggregated data. Capacity is estimated by statistically analyzing the data points near the peak of the fundamental diagram. Typical capacity of Japanese expressways is about 2,200 to 2,400 vehicles/hour/lane.
Since LWR assumes speed is a function only of density (equilibrium speed-density relationship), it cannot reproduce transient acceleration/deceleration phenomena or some unstable phenomena like "phantom traffic jams" (spontaneous congestion). To handle these, higher-order models (e.g., Payne-Whitham model) that include an acceleration term are needed. Additionally, local phenomena such as lane changes or toll booths are handled by cell transmission models (CTM) or microsimulation.
Autonomous vehicles have shorter reaction times than humans and can maintain constant headways, so the jam density $k_j$ is expected to increase (allowing more vehicles to flow). In cooperative driving (platooning), density can be significantly increased while maintaining free-flow speed, shifting the peak of the fundamental diagram to the upper right and greatly increasing road capacity. However, instability during the mixed period (human-driven and autonomous vehicles coexisting) remains a challenge.
This is because for the same flow (e.g., 1500 veh/h), there are two traffic states: a free-flow state with few vehicles moving fast and a congested state with many vehicles crawling. On the speed-flow curve, these correspond to the free-flow region (upper side) and the congested region (lower side). When the operating point is on the free-flow side, it is stable, but when on the congested side, it is unstable, and even a small disturbance risks worsening the congestion.
Real-World Applications
Industry Use Cases
In transportation engineering, LWR fundamental diagrams are used to estimate road capacity at highway merge points and tunnel entrances. Applications include optimizing ETC gantry placement, developing headway control algorithms for autonomous vehicles, and screening congestion risk in road design before committing to detailed 3D simulations.
Education & Research
Traffic engineering courses use tools like this to let students manipulate Greenshields, Greenberg, and Underwood models hands-on, building physical intuition about congestion formation. In research, stability analyses of traffic flow and evaluation of variable speed limit strategies rely on fundamental diagram theory as a foundation.
CAE Workflow Integration
This simulator serves as a pre-processing tool before large-scale traffic simulations (SUMO, Vissim, etc.). Road design consultants use it for rapid initial screening of intersection improvement proposals, identifying bottleneck risks from the flow-density curve shape before investing in detailed microsimulation runs.
Common Misconceptions and Points of Caution
A common misconception is that the fundamental diagram shape is fixed for a given road. In reality, the curve changes significantly depending on model parameters (free-flow speed, jam density). Even on the same road, the effective parameters shift with time of day and weather, so the fundamental diagram is always an approximation valid under specific conditions.
Another misconception is that congestion only occurs at high density. Under LWR theory, the same density can correspond to either a free-flow or a congested state. The speed-density graph reveals a transition zone where speed drops sharply at moderate density — small disturbances in this region can trigger rapid congestion formation.
The vehicle animation is based on a continuum (macroscopic) model and does not capture individual driver reaction times or headway variation. It accurately reflects macroscopic trends (density → speed → flow relationships) but should not be taken as a microscopic traffic simulation.