Intelligent Driver Model Applet

An applet for simulating traffic jams

How to use the applet

If you start the applet with the given values by pressing "Start" you will see some cars moving along a three lane road. The first cars on each lane will accelerate until they leave the screen. They will appear on the left side on the screen again due to periodic boundary conditions. During the simulation, the traffic density will vary: very dense traffic will alternate with very low traffic. For certain initial conditions, the simulation will develop a traffic jam. By pressing "Pause"the applet will freeze and show the current frame, so that a snapshot of the simulation can be investigated. The button "Reset" will initialize the cars again and after pressing the Start button, the simulation will run again. While the applet is running you can vary all sliders and this will have a direct effect on the simulation. However varying the sliders for the number of cars or trucks will reset the simulation so that new cars and trucks can be inserted. The parameters "Number of Cars" and "Number of Trucks" will make the chosen amount of cars and trucks appear on every lane. The number of vehicles on one lane is limited to 50.

It is possible to make the applet crash by choosing parameters such that the distance between the cars becomes very small. In this case the cars on the corresponding lane will disappear. Then it is recommended to reset the applet. A large change in the parameters while the applet is paused can also cause the simulation to crash, as the cars are not able to react to sudden changes. It is therefore recommended to change parameters adiabatically.

Interesting scenarios

  1. The standard initial conditions result in a traffic jam after some time. Yet, there are no trucks on the road. If the acceleration $a$ is increased, the traffic jam can be dissolved, as the standing cars are able to drive away faster than breaking cars are accumulating behind the traffic jam. This leads to a state, where there is an area of increased car density. If the acceleration is decreased, this area turns into a traffic jam again. Once the cars are homogeniously distributed, it is nearly impossible to create a traffic jam as all cars are influenced equally by the parameters.
  2. Using just ten cars will lead to stable traffic independent of the values of the parameters.
  3. If trucks are added to the simulation and the other parameters stay default, the trucks will stop the cars from reaching high speeds and the cars will accumulate behind the trucks. This will lead to longer traffic jams. If there are few cars and trucks, and the acceleration of the cars is increased, the cars will follow the trucks closely without creating traffic jams.

Applications of Car-following Models

Which velocity should vehicles have driving through a road construction site to reach the best possible flow? Would the flow be even better if the cars would be automotive? How does an automotive vehicle have to handle which kinds of influences?

These kinds of questions lead to the development of more and more complex traffic models since the 1950s. On one hand they shall simulate real traffic and on the other hand they shall help us to develop vehicles which can participate in traffic without a human driver. Car-following models represent a special class of such models. Acceleration or braking of a vehicle depends only on its own velocity and on the velocity and the position of the vehicle directly in front. One of those models is the Intelligent Driver Model (IDM), which is so the basis for this applet.

Intelligent Driver Model

General information

An important token of this model is the possibility to simulate different types of vehicles and also different types of drivers by choosing certain parameters. The IDM needs information about the current velocity of the vehicle one wants to simulate (V1) and about the distance to the vehicle in front (V2) as well as about the velocity difference of theses two vehicles. It returns the velocity of V1.

Equation and parameters

The differential equation of the Intelligent Driver Model is: $$ \begin{array}{rcl} \dfrac{dv}{dt} = a\left[ 1-\left( \dfrac{v}{v_{0}}\right)^{\delta}-\left(\dfrac{s^{*}(v,\Delta v)}{s}\right)^{2}\right] \\ \end{array} $$ $$ \begin{array}{rcl} s^{*}(v, \Delta v) = s_{0}+vT+\dfrac{v\Delta v}{2\sqrt{ab}} \end{array} $$ Where

Like already said one can characterise different vehicle and driver types with these parameters. A truck(red) is described by smaller values of $v_{0}$, $a$ and $b$ as a car would have. A careful driver is described by high $T$ whereas an aggressive driver could be characterised by high values of $v_{0}$, $a$ and $b$. $v$ is the velocity of the vehicle and $x$ is its position. $s$ is the actual distance to the vehicle in front which is calculated from the positions of the cars and their length.

In this applet the parameter $s_{0}$, $v_{0}$, $a$, $b$, $\delta$ and $T$ of the cars are variable. The parameters for the trucks are constant and have the following values:

Moreover the length of the cars is $3$m and the safety time headway for trucks is always $1.5$s. The cars always start with a velocity of $120$km/h and will accelerate or decelerate after the applet is started to reach the velocity, which is chosen by the slider. The applet uses an extended version of the IDM which does not approve negative velocities $v$. During the tests of the applet, the drivers in a traffic jam started to drive backwards in order to restore their desired minimal distance that has been undershot by spontaneous breaking. This resulted in a crash between the decellerating drivers that approached the traffic jam and the drivers backing up inside the traffic jam.

Behavior of the differential equation

The differential equation is composed of a term for the desired acceleration on a free road and of a term for the deceleration. On a nearly unused road the distance to the vehicle in front (s) is high. Therefore the term for the braking deceleration is not important. The acceleration is getting zero if a car reaches the desired velocity $v_{0}$. The deceleration term compares the desired dynamical distance $s^{*}$ with the actual distance to the vehicle in front. In the case both are the same the terms for deceleration and acceleration will chancel out and the final acceleration is getting zero. The desired distance $s^{*}$ consists of a static part ($s_{0}+Tv$) and a dynamical part. The static part is characterised by the safety time headway $T$. In the case of a traffic jam one has to add the desired minimal distance $s_{0}$. The dynamical part is a special token of the IDM. It achieves an "intelligent" braking behaviour. Caused by this term $s^{*}$ increases if the vehicle approaches a slower one and it decreases if the vehicle in front goes off. The braking term becomes dominant in the differential equation as soon as the distance to the vehicle in front is decreasing and/or the velocity of the simulated vehicle is increasing.


For the simulation the coupled differential equation is solved for every time step for every vehicle by the Runge-Kutta method. The DGL is coupled because it has in principle the following form: $$ \begin{array}{rcl} \dfrac{dx}{dt} &=& v \\ \dfrac{dv}{dt} &=& f(v) \end{array} $$

This system returns a new position and a new velocity after each time interval.


Here you find the Java Code of the Applet as zip-folder for downloading.



  1. Treiber, Martin; Helbing, Dirk: realistische Mikrosimulation von Straßenverkehr mit einem einfachen Modell, Contribution to the 16. Symposium "Simulationstechnik ASIM 2002" Rostock, 10.09 -13.09.2002
  2. Treiber, M.; Hennecke, A. und Helbing, D.: Congested traffic states in empirical observations and microscopic simulations, Physical Review E 62 (2000), pp. 1805–1824.
  3. Website Longitudinal Traffic model: The IDM
  4. Wikipedia Intelligent driver model

Legal note: We do not take any responsibility for
the content of the webPages linked here-in.