Home Download Help Resources Extensions FAQ References Contact Us Donate Models: Library Community Modeling Commons User Manuals: Web Printable Chinese Czech Japanese Spanish

NetLogo Models Library: 
If you download the NetLogo application, this model is included. (You can also run this model in your browser, but we don't recommend it; details here.) 
In this model the turtles are cars traveling through an intersection. The user has the ability to control the frequency of cars coming from each direction, the speed of the cars, and the timing of the light at the traffic intersection. Once the frequency and speed of cars is selected, the user should run the simulation and adjust the timing of the traffic light so as to minimize the amount of waiting time of cars traveling through the intersection.
The rules for each car are:
I can only go in the direction I started in, or stop.
I stop for cars in front of me and red lights, and I stop for a yellow light if I'm not already on it.
If I am moving quickly and I see that I will have to stop soon, I try to slow down enough to make sure I can stop in time, up to MAXBRAKE.
If I see that I have free space in front of me, I speed up towards the SPEEDLIMIT, up to MAXACCEL.
If I am on the same space as another car, we crash and die.
WAITTIMEOVERALL shows how many cars are waiting during the given clock tick.
WAITTIMEEASTBOUND shows how many eastbound cars are waiting during the given clock tick.
WAITTIMENORTHBOUND shows how many northbound cars are waiting during the given clock tick.
CLOCK shows how many ticks have elapsed.
Use the FREQEAST slider to select how often new eastbound cars travel on the road.
Use the FREQNORTH slider to select how often new northbound cars travel on the road.
Use the SPEEDLIMIT slider to select how fast the cars will travel.
Use the MAXACCEL slider to determine how fast the cars can accelerate.
Use the MAXBRAKE slider to determine how fast the cars can decelerate.
Use the GREENLENGTH slider to set how long the light will remain green.
Use the YELLOWLENGTH slider to set how long the light will remain yellow.
Press GO ONCE to make the cars move once.
Press GO to make the cars move continuously.
To stop the cars, press the GO button again.
Cars start out evenly spaced but over time, they form bunches. What kinds of patterns appear in the traffic flow?
Under what conditions do the cars appear to be moving backwards?
Gridlock happens when cars are unable to move because cars from the other direction are in their path. What settings cause gridlock in this model? What settings can be changed to end the gridlock?
Try to answer the following questions before running the simulations.
Record your predictions.
Compare your predicted results with the actual results.
What reasoning led you to correct predictions?
What assumptions that you made need to be revised?
Try different numbers of eastbound cars while keeping all other slider values the same.
Try different numbers of northbound cars while keeping all other slider values the same.
Try different values of SPEEDLIMIT while keeping all other slider values the same.
Try different values of MAXACCEL while keeping all other slider values the same.
Try different values of GREENLENGTH and YELLOWLENGTH while keeping all other slider values the same.
For all of the above cases, consider the following:
What happens to the waiting time of eastbound cars?
What happens to the waiting time of northbound cars?
What happens to the overall waiting time?
What generalizations can you make about the impact of each variable on the waiting time of cars?
What kind of relationship exists between the number of cars and the waiting time they experience?
What kind of relationship exists between the speed of cars and the waiting time they experience?
What kind of relationship exists between the number of ticks of green light and the waiting time cars experience?
Use your answers to the above questions to come up with a strategy for minimizing the waiting time of cars.
What factor (or combination of factors) has the most influence over the waiting time experienced by the cars?
Find a realistic way to eliminate all crashes by only changing car behavior.
Allow different light lengths for each direction in order to control wait time better.
Is there a better way to measure the efficiency of an intersection than the current number of stopped cars?
"Traffic Basic": a simple model of the movement of cars on a highway.
"Traffic Basic Utility": a version of "Traffic Basic" including a utility function for the cars.
"Traffic Basic Adaptive": a version of "Traffic Basic" where cars adapt their acceleration to try and maintain a smooth flow of traffic.
"Traffic Basic Adaptive Individuals": a version of "Traffic Basic Adaptive" where each car adapts individually, instead of all cars adapting in unison.
"Traffic 2 Lanes": a more sophisticated twolane version of the "Traffic Basic" model.
"Traffic Grid": a model of traffic moving in a city grid, with stoplights at the intersections.
"Traffic Grid Goal": a version of "Traffic Grid" where the cars have goals, namely to drive to and from work.
"Gridlock HubNet": a version of "Traffic Grid" where students control traffic lights in realtime.
"Gridlock Alternate HubNet": a version of "Gridlock HubNet" where students can enter NetLogo code to plot custom metrics.
If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.
For the model itself:
Please cite the NetLogo software as:
Copyright 1998 Uri Wilensky.
This work is licensed under the Creative Commons AttributionNonCommercialShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/byncsa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.
This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECTBASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program)  grant numbers RED #9552950 and REC #9632612.
This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORKBASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs)  grant numbers REC #9814682 and REC0126227. Converted from StarLogoT to NetLogo, 2002.
(back to the NetLogo Models Library)