Author Topic: Ejs version of traffic control simulation  (Read 84098 times)

arnanbd

  • Newbie
  • *
  • Posts: 7
Re: Ejs version of traffic control simulation
« Reply #15 on: August 16, 2009, 03:05:18 am »
Dear Hwang

I have found your simulations very interesting. I was looking for such simulation because I had an argument with a friend regarding the optimal traffic light timing. You have some simulations but I was looking for a simulation with the following features:

  • One junction only.
    Ability to control also the acceleration and delay time.
    Ability to set a timer so that the simulation will take only the predefined timer.
    Longer range for the lights durations.
Do you have such simulation?



Regards


Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: Ejs version of traffic control simulation
« Reply #16 on: August 16, 2009, 08:45:27 am »
There is a one junction simulation: Time duration for the yellow traffic light.

You can change the delay time, however, the maxmimum speed of each car is chosen  randomly.
Light duration for green and yellow light can be adjusted with slider.
You can download it and modify the code to fit with your need!

arnanbd

  • Newbie
  • *
  • Posts: 7
Re: Ejs version of traffic control simulation
« Reply #17 on: August 16, 2009, 03:44:22 pm »
Thank you Hwang

This "yellow light simulation" is very nice, the only thing I miss is the car count and the ratio as you did in other simulations.
Unfortunatly I don't have the skils of dealing with Java codes.
By the way, are you familiar with this simulation: http://www.traffic-simulation.de/ ?

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: Ejs version of traffic control simulation
« Reply #18 on: August 16, 2009, 11:32:49 pm »
As I have mentioned at that post:
The maximum speed and maximum acceleration for each car is randomly selected in the simulation, so the number of cars passing the juntcton is not the same even with all the same parameters.

Please write down what is the problem you are working on and what is the purpose of your work.
May be there are better way to do it.

I did check out the simulation.
It is a nice simulation. I think it was designed for other purpose : what are the factors which will cause the traffic jam. 

arnanbd

  • Newbie
  • *
  • Posts: 7
Re: Ejs version of traffic control simulation
« Reply #19 on: August 17, 2009, 06:47:26 pm »
The problem is to optimized trafic light timings.
There is a simulation made by you that does not run fast. http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=139
This one can help me. Can you transform it to EJS?

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: Ejs version of traffic control simulation
« Reply #20 on: August 17, 2009, 10:54:55 pm »
The simulation at the top of this topic (the first message) is the EJS version of that simulation (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=139).

arnanbd

  • Newbie
  • *
  • Posts: 7
Re: Ejs version of traffic control simulation
« Reply #21 on: August 18, 2009, 05:18:15 pm »
It's not the same. In the original there is an ability to control acceleration and delay.

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: Ejs version of traffic control simulation
« Reply #22 on: August 18, 2009, 05:38:58 pm »
You can change the delay by clicking the +/- sign in the simulation.
I will add the change of acceleration later.

I just added a text field for user to enter new maximum acceleration for the car.
You can enter new value and hit RETURN to change the maximum acceleration in the simulation.
However, it will be the same acceleration (but with minus sign) when the brake is applied to the car.

arnanbd

  • Newbie
  • *
  • Posts: 7
Re: Ejs version of traffic control simulation
« Reply #23 on: August 19, 2009, 06:49:58 am »
Thank you very much Hwang.
Can you add also a delay for the cars i.e. the human response time to the green light or to the moving of the cars when the car in front of them started moving?
I know i'm asking a lot so I will understand what ever you will do.

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: Ejs version of traffic control simulation
« Reply #24 on: August 19, 2009, 09:14:38 am »
I just added another text field for you to change reaction time.

If you click the link VIEW (just below the simulation). Another web page will show up. And you will find an interface similar to EJS (the tool I used to create the simulation).
In the Model -> Variable tab: You will find all the variables defined in EJS.
For example: reaction time is defined in view sub-tab. the initial value is 0.5 (unit s).

What I just did was add another html command:

reaction time=<input type=text name=reactionTime value="0.5" onChange="document.trafficcontrol._model.reactionTime=parseFloat(this.value);" size=3>s

arnanbd

  • Newbie
  • *
  • Posts: 7
Re: Ejs version of traffic control simulation
« Reply #25 on: August 19, 2009, 05:25:02 pm »
Thank you Hwang.
I have tried to change the acceleration and dealy parameters but it looks like it does not do anything.

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: Ejs version of traffic control simulation
« Reply #26 on: August 19, 2009, 07:31:11 pm »
You need to hit ENTER after you change your value.
For example: try acceleration =1.0 m/s2and reaction time=2.0 s

srinivas2828

  • Newbie
  • *
  • Posts: 1
Re: Ejs version of traffic control simulation
« Reply #27 on: January 28, 2010, 09:20:10 pm »
its awesome may i get a copy of source code if you dont mind -*-

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: Ejs version of traffic control simulation
« Reply #28 on: January 28, 2010, 09:47:18 pm »
The above simulation is created with EJS. You can download EJS xml source by click the link just below the simulation.
If you have download EJS and download the jar file. You can right click in the simulation and select open EJS model to view the source.