Author Topic: Traffic Light System  (Read 632192 times)

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Traffic Light System
« on: January 29, 2004, 10:48:02 am »
Registed user can get files related to this applet for offline access.
Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
If java program did not show up, please download and install latest Java RUN TIME


Traffic light control: **** click the following tabs for more information

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.

Due to java version changes, this simulation become very slow.
Please check out Ejs version of traffic control simulation


Due to so many requests from the users, source code for this applet is distributed with the ZIP files you will receive if you click get file for offline use button. It is also available as attached file. Please do not ask me to send you the source code again, help yourself-- it is just a click away!





You are welcomed to check out Ejs version of traffic control simulation,too.
  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
    4. ( for MAC user, click between light and number to the right to increase the length of time)

  3. parameter controls
    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 ntersection.
    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¡^

  4. 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)
      flow rate=(N1+N2/3.)/T
    3. n1/n2/flow rate¡G number of cars passes intersection during last minute.
      flow rate=(n1+n2/3.)/60


  5. Color code for car
    1. yellow: accelerating (A>0.)
    2. green: moving with constant speed (include stopped) A=0.
    3. red: stopping (A<0.)


  6. Velocity of each car is represented by a blue dot.

  7. A new function has been added to help you determine the delay time between traffic lights.
    Click the right mouse button to suspend (the animation).
    The time intervals (for the first car ) during which the signals are green/yellow/red
    1. are represented by thin (colored)lines at one side of the road.

    A blue curve 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.

If you click the right mouse button in the simulation, you will see a curve similar to the following figure (Hints to adjust the traffic flow) [img:ebda2bdfd4]http://www.phy.ntnu.edu.tw/ntnujava/pics/trafficControl.png[/img:ebda2bdfd4]

Applet latest updated: 2009/12/25

I have created another version of traffic light control applet with EJS and you can view how it was implemented with EJS(You can find the code).

Please download the last trafficControl.java if you want latest version code (2009 Dec. 25).


Registed user can get files related to this applet for offline access.
Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
If java program did not show up, please download and install latest Java RUN TIME

  • Guest
Reading Calipers.
« Reply #1 on: July 07, 2004, 09:09:16 pm »
Hello all,

I am on here wondering if anyone reading this know where I can find a website that will teach me how to read a caliper. I need to learn this for a job I am applying for.

Sincerely

Robert

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
about how to read a cliper
« Reply #2 on: April 17, 2005, 02:18:06 pm »
If you want to know how to read a cliper.
Please check out the following URL
http://www.phy.ntnu.edu.tw/ntnujava/viewtopic.php?t=69

xingweiping

  • Newbie
  • *
  • Posts: 1
topic139
« Reply #3 on: May 04, 2005, 01:30:35 pm »
Thanks so much for sharing the source code with us. actually we currently have a group project which is very similar to this, but we just totaly have no idea about it. until I found your site via google. what a day! your applet is very inspirational and we are so enlighted! :D :idea:

karthik_kotee

  • Newbie
  • *
  • Posts: 1
query
« Reply #4 on: September 16, 2005, 12:58:01 am »
sir could i get the source code(.java file) for the traffic system

vipin_ajmera

  • Newbie
  • *
  • Posts: 1
topic139
« Reply #5 on: September 20, 2005, 05:54:53 pm »
plz can u give me source code of traffic light system

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
topic139
« Reply #6 on: September 21, 2005, 08:19:27 am »
Both of you you have received the source code in your email account.

lopa

  • Newbie
  • *
  • Posts: 5
request for source code
« Reply #7 on: September 25, 2005, 07:45:00 pm »
Sir/mam,
plz give me the source code of this applet,using this topics,traffic light system.
ok, thanks,

primanox

  • Newbie
  • *
  • Posts: 1
Great Simulation
« Reply #8 on: September 27, 2005, 10:47:17 am »
I love this simulation. You did an excellent job! Could you please send me the source code? I would really like to see how you accomplished this. Thank you!

hadi_telkom

  • Newbie
  • *
  • Posts: 1
  • science
request
« Reply #9 on: September 30, 2005, 11:58:46 am »
your traffic simulatioin is very good
may I get it, please.............

wurakeem

  • Newbie
  • *
  • Posts: 1
topic139
« Reply #10 on: October 01, 2005, 07:34:22 am »
I like your simulation.
is it possible to have the source code?

thanks.

joe

  • Newbie
  • *
  • Posts: 1
topic139
« Reply #11 on: October 08, 2005, 01:07:08 am »
This is a very good simulation.
I like it very much.
May I take the source code please?

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
topic139
« Reply #12 on: October 18, 2005, 09:58:13 am »
Source code has been sent.

lifeline

  • Newbie
  • *
  • Posts: 1
regarding traffic simulator
« Reply #13 on: October 20, 2005, 06:42:08 am »
hi,
it was gud to see ur traffic simulator . I would like to learn how u did it . Could u plz mail me the code .

Thanks.

avir

  • Newbie
  • *
  • Posts: 1
topic139
« Reply #14 on: October 21, 2005, 07:04:19 am »
I also would like to get a copy of the source.