An interactive in-browser simulation comparing vehicle throughput at a signalized intersection. Two lanes receive identical vehicle arrivals and the same signal — the only difference is whether the cars coordinate via vehicle-to-vehicle (V2V) communication or react sequentially with realistic human delays.
When a light turns green, human drivers don't all start at once. The lead driver reacts in roughly one second. The next driver waits to see them move, then reacts. By the time the wave reaches the back of the queue, the light may already be yellow again.
Autonomous vehicles sharing intent over V2V can release together, with much tighter following gaps. The simulation visualizes this difference using the standard Intelligent Driver Model (IDM) for car-following, with realistic per-vehicle-type acceleration profiles.
Press Turn light green to release the queue. Watch the autonomous lane clear as a coordinated platoon while the human lane cascades. Press Turn light red to trigger a yellow phase (duration computed from approaching speed via the dilemma-zone formula t + v/(2a)) followed by red, and watch the queues build again.
The simulation uses these parameters, set in the source:
| Parameter | Autonomous | Human |
|---|---|---|
| Reaction time | 0.15 s (all cars simultaneously) | 1.0 s lead + 0.55 s cascading per car |
| Acceleration multiplier | ×ばつ human baseline | ×ばつ baseline |
| Time headway (gap) | 0.35 s | 1.5 s |
| Minimum gap | 5 m | 14 m |
Per-vehicle multipliers (applied on top of lane parameters):
| Vehicle | Acceleration | Top speed |
|---|---|---|
| Sport coupe | ×ばつ | ×ばつ |
| Sedan | ×ばつ | ×ばつ |
| EV sedan | ×ばつ | ×ばつ |
| Convertible | ×ばつ | ×ばつ |
| Minivan | ×ばつ | ×ばつ |
| Pickup | ×ばつ | ×ばつ |
| School bus | ×ばつ | ×ばつ |
| Semi truck | ×ばつ | ×ばつ |
These are tunable — feel free to fork and adjust.
No build step. Clone the repo and open index.html in a browser.
git clone https://github.com/sivaprasadakasam/TrafficSim.git cd TrafficSim open index.html # or just double-click the file
Common things to experiment with:
- Change reaction times to see how sensitive throughput is to driver attention
- Add more vehicle types (motorcycles, e-bikes, autonomous shuttles)
- Vary the arrival rate to model rush hour vs off-peak
- Add a second intersection downstream to see green-wave coordination effects
- Plot the throughput as a graph instead of a counter
The whole simulation is one self-contained index.html file — open it in any text editor and you'll find the physics in a single <script> block at the bottom.
The car-following physics use the Intelligent Driver Model (Treiber, Hennecke, Helbing 2000), the standard model in microscopic traffic simulation. The cascading-reaction delay for the human lane is calibrated to typical values found in driver-behavior literature (lead reaction ~1 s, follow-on reactions ~0.5 s per car back).
V2V coordination has been a working spec since DSRC was standardized in the early 2010s, and more recent C-V2X (cellular V2X) is being deployed in newer vehicles. The simulation idealizes this as instantaneous shared-state coordination — real V2V has latency and packet loss, so actual gains would be somewhat smaller than shown here.
MIT — see LICENSE. Use this however you'd like.
Pull requests welcome. Some areas where improvements would be especially valuable:
- Calibrating parameters against published intersection throughput data
- Adding mobile touch support and responsive layout improvements
- Adding accessibility features (keyboard controls, screen reader support)
- Implementing partial-V2V scenarios (mixed fleets of autonomous + human)