Traffic Light System

Would you like to engineer the traffic light system for a one-way street that consists of several lanes along which rush-hour traffic flows?

How would you time the onset of green lights at the various intersection? How to promote the traffic flow? This java applet let you play with it.

How to play it:

  1. The traffic lights at interactions are for cars moving from left to right. The traffic on the perpendicular streets can only move when light is RED.
  2. You can change the period of each light
    1. clicking the traffic light at the top-left cornor
    2. the number near each color is the period for that particular light (second)
    3. left/right mouse click will decrease/increase one second
  3. parameter controls
  4. each click to the arrow at left/right of the number will decrease/increase the parameter by 1 unit.
    1. delay time control near the traffic light controls the delay of the onset of green light at the interaction relative to that at prevous intersection.
    2. max Velocity control represents the speed limitˇ]Vmin=5, Vmax= 50ˇ^
    3. acceleration control represents the acceleration for the car when it speeds up.ˇ]Amin=1 , Amax=20ˇ^
  5. TextField values
    1. TˇGtime in second after pressing the start button
    2. N1/N2/flow rateˇG total number of cars passes intersection (N1:left-right/N2:up-down)
    3. flow rate=(N1+N2/3.)/T
    4. n1/n2/flow rateˇG number of cars passes intersection during last minute.
    5. flow rate=(n1+n2/3.)/60
  6. Color code for car
    1. yellow: accelerating (A>0.)
    2. green: moving with constant speed (include stopped) A=0.
    3. red: stopping (A<0.)
  7. Velocity of each car is represented by a blue dot.
  8. A new function has been added to help you determine the delay time between traffic lights.
  9. Click the right mouse button to suspend (the animation).
    The time intervals (for the first car ) during which the signals are green/yellow/red
      are represented by thin (colored)lines at one side of the road.( sample )
    A curve(color=cyan) represent x-t (displacement verse time) for the first car is shown.
    Use that curve with those color intervals to adjust the delay time between traffic lights.
    Click the right mouse button again to resume.


  1. Suppose a platoon is stopped at interaction. When the green light comes on, there is a "start-up wave" travels from the leader along the length of the platoon at a speed vs.
  2. How to adjust parameters to increase the traffic flow?
    1. adjust timing of each light
    2. adjust delay time control
    3. adjust Vmax
    4. adjust A(acceleration)

Think of it! Play with it! I hope you do learn some physics from this applet.

Suggestions are highly welcomed! Please click

related java applet

other java applets(my home page)

URLs refer to this page

Last modified :