What is traffic-sim?
traffic-sim is a free, open-source simulator that runs the Intelligent Driver Model on a one-lane circular road entirely in your browser. You set the traffic density, the IDM parameters and the driver-noise model, then watch whether the ring settles into uniform flow or breaks into stop-and-go waves. There is nothing to install, and no data leaves your machine.
Why do traffic jams form on a ring road with no bottleneck?
Because dense car-following is unstable. Each driver reacts to the car ahead with a delay and with imperfect precision, so a small speed fluctuation is amplified rather than damped as it travels back through the queue. Past a critical density the amplification wins and the disturbance grows into a stopped cluster that moves backwards against the traffic — a phantom jam. Sugiyama and colleagues demonstrated exactly this with real drivers on a real circular track in 2008. Press Perturb to seed one here.
What is the Intelligent Driver Model (IDM)?
The IDM is a microscopic car-following model published by Treiber, Hennecke and Helbing in 2000. It gives every vehicle a continuous acceleration derived from only its own speed, the gap to the vehicle ahead and the rate of approach, using five interpretable parameters: desired speed v₀, safe time headway T, minimum gap s₀, maximum acceleration a and comfortable braking b. It is collision-free by construction and is the standard deterministic baseline in traffic-flow research. The models page gives the equations.
What is driver noise, and why does its colour matter?
Driver noise is the acceleration residual that is left over after a deterministic model has been fitted to a real trajectory — everything the equation does not explain. Measured on HighD data that residual has a standard deviation of roughly 0.2 m/s² and stays correlated for several seconds, so it is not white noise. The colour matters because a car-following chain behaves like a low-pass amplifier: white noise is mostly high-frequency jitter that averages out along the platoon, whereas correlated noise puts the same variance into the low frequencies the chain amplifies into jams.
What is the difference between MA-IDM, DR-IDM and B-IDM?
All three add a random residual to the same IDM acceleration and differ only in the process that generates it. B-IDM uses independent Gaussian noise with no memory. DR-IDM uses an AR(p) process, so the residual is a weighted sum of its own recent past plus a fresh innovation. MA-IDM uses a Gaussian process with a stationary kernel, so memory is governed smoothly by a lengthscale of about 1.4 s rather than by a fixed number of lags. The compare page runs all three side-by-side on identical rings.
Can I reproduce or share an exact run?
Yes. The Copy link button writes every control into the URL fragment, so the link reopens the simulator with the same scenario. Add seed=<integer> (non-zero) to that URL and the random-number stream is seeded as well, which makes the run reproducible bit for bit.
Does this reproduce the results in the papers?
No, and it is not meant to. It is a research-inspired teaching demo. Every driver here shares one parameter vector, whereas both papers’ ring experiments draw heterogeneous per-driver parameters from a joint posterior that was never published. Integration is semi-implicit Euler rather than the papers’ ballistic update, the Gaussian process is approximated with 32 random Fourier features instead of conditional Gaussian sampling, and flow is computed as density × space-mean speed rather than from detector crossings. The README lists every deviation.
What do I need to run it?
Any modern browser with JavaScript and HTML5 canvas. There is no build step, no framework and no dependency — the simulator is a handful of plain JavaScript files. You can also clone the repository and open index.html straight from disk, or serve the folder with python -m http.server.
How should I cite it?
Cite the two underlying papers — the BibTeX is in the Citation card above, and CITATION.cff in the repository carries the same metadata in machine-readable form: Zhang & Sun (2024), Bayesian Calibration of the Intelligent Driver Model, IEEE T-ITS, doi:10.1109/TITS.2024.3354102; and Zhang, Wang & Sun (2024), Calibrating Car-Following Models via Bayesian Dynamic Regression, Transportation Research Part C, doi:10.1016/j.trc.2024.104719.