The Racetrack Program

Quick links

The program as an applet to run in a browser (limited capabilities)

The corresponding Netlogo source file for running with Netlogo

The Netlogo homepage for downloading the Netlogo program



This is a sample program for experimenting with factors that can upset the stability of a system of drivers on a circular track. It uses a very simple model, called a bang-bang model, for the acceleration and braking of each car. In particular, if a driver perceives that the car in front is farther away than it was at the beginning of the experiment, then he or she floors the accelerator in an attempt to catch up. On the other hand, if the driver perceives that the car in front is closer than it was at the beginning of the experiment, then he or she slams on the brakes, which is assumed to decelerate the car at a maximum rate. These models can, of course, be improved. The overall model is called an "agent-based model" because each individual driver/car is considered to be an independent agent acting on its own information.

Drivers maintain a constant control action (accelerating at the maximum rate, decelerating at the maximum rate although naturally never letting the car reverse direction, since brakes can't do that, or maintaining a constant speed) for an entire "cycle" which for computational purposes is broken into individual steps at which the cars are advanced on the screen. Because there is generally a time delay in estimating the distance to the car in front and possibly modifying the driver's action,an input value called the reaction delay identifies the step within the previous cycle at which the estimation of the distance to the car in front is made by each driver. This estimation is subject to error, modeled as a random multiplier on the actual distance with a range specified by another input parameter.

A crash is indicated when a car's shape turns to an x and motion stops.

Ideas for experimenting with the model

1. Experiment with all the input values and switches to get a feel for how to use the model and to see if you can anticipate what the effect will be of changes you make. For example, should longer cycle lengths increase or decrease the time to a crash? How about the effect of increasing the noise factor or the reaction delay?

2. Try multiple runs to see how the outcome varies from one to the other. If certain outcomes are very unlikely, remember that they will only occur on one run out of many.

3. What happens if you turn one of the two switches on and the other one off? Try it both ways and explain the results.

4. What would you expect to happen if you start a run with both switches turned on, so the cars become separated with unequal distances, but then you turn off one or both of the switches?

5. In terms of corresponding to reality, which of the two control actions, acceleration or braking, represents the greatest weakness in this program? Can you modify the program to improve upon it? If you want to do this, it might be best to offer it as an alternative control procedure within the program with a chooser button on the input screen to select one or the other of the procedures. You would need to download the NetLogo program from its website, as well as the code for this model, in order to do this of course. In the process, you may find many other very interesting NetLogo programs available in the model library set up by the code developers.

6. Do you see any patterns in behavior with the model that remind you of your own experience with traffic or even perhaps traffic accidents?

Reference and contact information

This particular model was developed by students of Prof. Charles Hadlock at Bentley University. You may contact him with any comments, suggestions, or upgrades at .

NetLogo itself has been developed and maintained by Uri Wilensky at the Center for Connected Learning (CCL) and Computer-Based Modeling at Northwestern University. The homepage for downloads and further information is .