TRAFFIC FLOW THEORY (Greenshields Fundamental Diagram)

Built for interactive demonstration of the Greenshields Traffic Flow Model.
You may use the demonstration for teaching or research purposes, but please cite as:
Ollero, L. J. (2025). Traffic Flow Theory: Greenshields Model Interactive Visualization.
Available at: https://lesterjayollero.github.io/TrafficFlowTheory.github.io

Road animation
Vehicles move around a closed loop.
Density: — veh/km
Model parameters
Change free-flow speed & jam density
km/hr
veh/km
km
Operating density
Set the system density (vehicles per km). This controls vehicle count and operating point. Click Play to demonstrate
v = — km/hr • q = — veh/hr
Notes
- Greenshields is linear; maximum flow occurs at k = kj/2 for this model (q_max = u_f * k_j / 4).
- Vehicle animation uses u(k) converted to m/s to move vehicles on the loop. Vehicle count = round(k * L).

The Greenshields Model

The Greenshields Model is the earliest and most fundamental relationship in traffic flow theory. It assumes a linear relationship between vehicle speed and traffic density. From this assumption, we can derive the three fundamental diagrams that describe the behavior of a traffic stream.

1) Greenshields Basic Assumption

Greenshields assumed a linear relation between speed $u$ and density $k$:

$$u(k) = u_f\left(1 - \frac{k}{k_j}\right)$$

2) Flow as Function of Density

Flow (volume) is $q = k \cdot u$. Substituting the speed–density relation:

$$q(k) = u_f k \left(1 - \frac{k}{k_j}\right) = u_f k - \frac{u_f}{k_j}k^2$$

This is a concave quadratic in $k$ (a parabola opening downward). To find maximum flow:

$$\frac{dq}{dk} = u_f - 2\frac{u_f}{k_j}k = 0 \quad \Rightarrow \quad k^* = \frac{k_j}{2}$$

Thus, the critical density (density at maximum flow) is $k^* = \frac{k_j}{2}$. The speed at that point is:

$$u^* = u_f\left(1 - \frac{k^*}{k_j}\right) = \frac{u_f}{2}$$

The maximum flow is:

$$q_{\max} = \frac{u_f k_j}{4}$$

3) Flow as Function of Speed

Solve density from the linear relation:

$$k = k_j\left(1 - \frac{u}{u_f}\right)$$

Substitute into $q = k \cdot u$:

$$q(u) = k_j u \left(1 - \frac{u}{u_f}\right) = k_j\left(u - \frac{u^2}{u_f}\right)$$

This is also a concave parabola in $u$, with maximum at $u^* = \frac{u_f}{2}$ and $q_{\max} = \frac{u_f k_j}{4}$.

Summary of Fundamental Relations

1️⃣ $u(k) = u_f\left(1 - \frac{k}{k_j}\right)$
2️⃣ $q(k) = u_f k\left(1 - \frac{k}{k_j}\right)$
3️⃣ $q(u) = k_j u\left(1 - \frac{u}{u_f}\right)$

Critical points: $k^* = \frac{k_j}{2}, \; u^* = \frac{u_f}{2}, \; q_{\max} = \frac{u_f k_j}{4}$.