What you just saw
Vehicles arrive at each approach as a Poisson process, queue at the stop bar, and clear when the light turns green. When arrival rate exceeds the capacity of a phase, queues grow without bound — the classic failure mode of under-timed signals. The average wait time is sensitive to both arrival rate and green-phase duration, and the optimum depends on both approaches together.
The science behind it
Microscopic traffic simulation dates back to the 1950s. The per-lane Poisson arrival + fixed-time signal model here is the simplest useful version, underlying the Webster (1958) delay formula still taught in transportation engineering. Modern operational tools (VISSIM, AIMSUN, SUMO) add car-following dynamics, lane-changing, and turning movements, but the queue-growth intuition from this model carries over.
Try these experiments
1. Balanced demand
Settings: arrival_rate_ns=0.2 arrival_rate_ew=0.2
What to look for: Both queues clear each cycle. Average wait sits near the half-cycle time.
2. Mismatched signal
Settings: arrival_rate_ns=0.4 arrival_rate_ew=0.1 green_duration_ns=20
What to look for: NS queue grows without bound. Classic signal mis-timing failure mode.
3. Rush hour
Settings: arrival_rate_ns=0.6 arrival_rate_ew=0.5
What to look for: Both approaches saturate. No signal timing makes the intersection work — you need more capacity.
Run this at 100x scale
Traffic intersection runs in your browser up to 1 intersection agents. With SimLab, the same model runs on GPU at city-wide network, with ensemble parameter sweeps and publication-ready output.
from scirouter import SciRouter
client = SciRouter(api_key="sk-sci-...")
result = client.simulation.run(
model="intersection",
params={"arrival_rate_ns": 0.3, "arrival_rate_ew": 0.2,
"green_duration_ns": 30, "green_duration_ew": 25},
steps=3600, seed=42,
)
print(result.metrics["average_wait"])Related simulations
Bus Route Simulator
Passengers arrive, buses cycle, dwell times accumulate. Test new frequencies and fleet sizes; watch bus bunching form on its own.
Boids Flocking Simulator
Reynolds' three-rule boids model. Thousands of birds, three simple rules, emergent murmurations. The visual payoff of ABM.
Schelling Segregation Simulator
Watch neighborhoods self-segregate from mild individual preferences. Drag the tolerance slider and see the 1971 model come alive.
SEIR Epidemic Simulator
Simulate a pandemic in your browser. Tune R₀, vaccination rate, and mobility to see how interventions change the curve.
Frequently asked questions
Can I plan a real intersection with this?›
For teaching and quick back-of-envelope sizing, yes. For operational planning, use VISSIM or SUMO with real turning counts, gap acceptance, pedestrian phases, and emergency pre-emption.
Where does the saturation flow rate come from?›
The model assumes a fixed per-lane service rate during green. Real-world saturation flow varies by lane geometry, grade, and vehicle mix — typically 1700–2000 vehicles per hour per lane.