Traffic Simulator Applet

I wrote this traffic simulation, following the article "Und nun die Stauvorhersage" of the German Magazine Die Zeit, June 7, 1996. The article describes the work of Professor Michael Schreckenberger of the University of Duisburg and unnamed collaborators at the University of Cologne and Los Alamos National Laboratory. These researchers model traffic flow according to simple rules, such as the following:

This applet models these rules. Each line shows an image of the same stretch of road. Each square denotes one car. The first scrollbar lets you adjust the probability that some cars slow down. If the slider is all the way to the left, no car slows down. If it is all the way to the right, every car slows down one unit. A typical setting is that 10% - 20% of the cars slow down. The second slider controls the arrival rate of the cars. When it is all the way to the left, no new cars enter the freeway. If it is all the way to the right, a new car enters the freeway every time interval, provided the freeway entrance is not blocked.

Try out the following experiments. Decrease the probability of slowdown to 0. Crank up the arrival rate to 1. That means, every time unit, a new car enters the road. Note how the road can carry this load.

Now crank up the probability that some cars slow down. Note how traffic jams occur almost immediately.

The moral is: If it wasn't for the rubberneckers, the cellular phone users and the makeup-appliers who can't keep up a constant speed, we'd all get to work more quickly.

Notice how the traffic jam is stationary or even moves backwards, even though the individual cars are still moving. In fact, the first car causing the jam has long left the scene by the time the jam gets bad.

Following a suggestion by Marty Rabens, every tenth vehicle is colored red to make it easier to follow the progress of individual vehicles.

The source for the applet.

This applet is kept alive thanks to CheerpJ.