[ Welcome to NKS - SJSU ]

                   

 Traffic Flow Simulator

Henry Jiang

 

Home | Links | Applets | Papers | Class Plan | Participants

 

   Traffic Flow Simulator

                   

  speed=0
  speed=1
  speed=2
  speed=3
  speed=4
  speed=5
  default
                   
Space
T
i
m
e
                   

 

Downloadable Source Code

 

This applet simulates traffic flow using CA rules. The CA rules are specify as follows

  • A freeway is modeled as a sequence of grid points.
  • Every car occupies one grid point. Each grid point occupies at most one car.
  • A car can have a speed of 0 - Vmax grid points per time interval.
  • A car with speed of less than Vmax increases its speed by one unit in each time interval, until it reaches the maximum speed.
  • If a car's distance to the car in front is d grid points, its speed is reduced to d-1 if necessary to avoid crashing into it.
  • With a certain probability, in each time interval some cars slow down one unit for no good reason whatsoever.
  • Each color represents different speed, if a grid point is empty, it's color is the default background color.
The above CA rules are all user defined, the user can adjust the scrollbars to experience with different rules. There's also a set of preset rules that attempts make different classes of patterns.

    Applet Controls

    • Slowdown: adjusts the probability of cars slowing dow.
    • Arrival : adjusts the rate at which cars flow into the road.
    • lamda: numeric value betwee [0,1] to specify how fast the car accelerates to catch up to speed.
    • deterministic: select this to have the ability to manipulate different rules.
    • undeterministic: select this to have rules preset.
    • pause/resume: pauses to see the state of the road.

    Future plans:

    • need to incorporate lane changing rules into the applet.
    • add a panel will contains a drag-down menu to select multiple lanes.
    • add zooming capability, although this is a priority.

 

 

 

All NKS-SJSU Applets are Open Source Shareware, Papers are Copryight to their Authors.