WHAT IS IT?
-----------
This project models the movement of cars on a highway. Each
car follows a simple set of rules: it slows down if it sees
a car close ahead, and speeds up if it doesn't see a car 
ahead.

The project demonstrates how traffic jams can form even 
without any accidents, broken bridges, or overturned trucks.
No "centralized cause" is needed for a traffic jam to form.  

HOW TO USE IT
-------------
Click on the SETUP button to set up the cars. Set the NUMBER slider 
to the number of cars on the road.  

Click on DRIVE to start the cars moving.  Note that they wrap the screen as they move, so the road is like a continuous loop.  

The SPEEDUP slider controls the rate at which cars accelerate when there are no cars ahead. 

When a car sees another car right in front, it matches that car's speed and then slows down a bit more.  How much slower it goes than the car in front of it is controlled by the SLOWDOWN slider.

The SIM-DELAY slider adds a time delay for more careful viewing. 

THINGS TO NOTICE
----------------

Traffic jams can start from small "seeds."  These cars start with random positions and random speeds. If some cars are clustered together, they will move slowly, causing cars behind them to slow down, and a traffic jam forms.

Even though all of the cars are moving forward, the traffic jams tend to move backwards. This behavior is common in wave phenomena: the behavior of the group is often very different from the behavior of the individuals that make up the group.

Plotwindow 1 plots three values as the model runs:
	- the fastest speed of any car (max-of-turtles speed)  This doesn't exceed the speed limit!
	- the slowest speed of any car (min-of-turtles speed)
	- the speed of a single car (turtle 0), painted red so it can be watched.
Notice not only the maximum and minimum, but also the variability -- the "jerkiness" of one vehicle.  


THINGS TO TRY
--------------
In this model there are three variables that can affect the tendency to create traffic jams: the initial NUMBER of cars, SPEEDUP, and SLOWDOWN.  Look for patterns in how the three settings affect the traffic flow.  Which variable has the greatest effect?    Do the patterns make sense?  Do they seem to be consistent with your driving experiences?    

Set SLOWDOWN to zero.  What happens to the flow?  Gradually increase SLOWDOWN while the model runs.  At what point does the flow "break down"?   		

EXTENDING THE MODEL
------------
Try other rules for speeding up and slowing down.  Is the rule presented here realistic?   Are there other rules that are more accurate or represent better driving strategies? 

In reality, different vehicles may follow different rules.
Try giving different rules or speedup/slowdown values to some of the cars.  Can one bad driver mess things up?   

What could you change to minimize the chances of traffic jams forming?

What could you change to make traffic jams move forward rather than backward?

Make a model for two-lane traffic.

STARLOGOT FEATURES
-----------------
The turtles/cars use SPEED-AT to find out the value of the 
SPEED variable for other turtles/cars.

The plotwindow can plot both global values and the value for a single turtle, which helps one watch overall patterns and individual behavior at the same time. 

The cars have decimal speeds and positions that are updated much more often than the time it takes for a car to move one space.  Position is rounded off to deterimine which patch the car is on.   

RELATED MODELS
---------------
"Traffic" adds graphics, trucks, and a radar trap.  
"Traffic Intersection" looks at traffic at an intersection with a traffic light. 

CREDITS and REFERENCES
-----------------------
This model was adapted from the traffic model at the MIT Media Lab. See Resnick, M. (1994) "Turtles, Termites and Traffic Jams: Explorations in Massively Parallel Microworlds." Cambridge, Ma: MIT Press. Adapted to StarLogoT, 1997, as part of the Connected Mathematics Project.