NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
July 29, 2014, 09:31:36 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Discovery consists of seeing what everybody has seen and thinking what nobody has thought. ..."Albert von Szent-Gyorgyi(1893-1986, 1937 Nobel Prize for Medicine, Lived to 93)"
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: Ejs version of traffic control simulation  (Read 56266 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
: 1 users think this message is good
1 Ejs version of traffic control simulation
«
Embed this message
on: May 15, 2006, 04:27:10 pm »

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

This simulation is similar to the traffic light contril I have created many years ago.
But I rewrited it with ejs.

Each square represent a car. It could be painted with three different color depends on it's acceleration a.
1. a>0 (yellow): when there is no car in front of it or the car in front is far away (the distance is more than dmin) and the street light is not red.
2. a=0 (green): it will keep move with the same speed when it reach maximum speed.
3. a<0 (red): when the street light turn red or the car in front is too close (distance < dmin).

dmin= v* treaction time, where treaction time is the reaction time of the driver.

You can click the +/- sign to change the time delay between traffic lights.



acceleration=m/s2 (modify value and hit return to change acceleration)
reaction time=s


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
Logged
chef
Newbie
*
Offline Offline

Posts: 3

: 1 users think this message is good
2 topic365
«
Embed this message
Reply #1 on: May 21, 2006, 04:45:33 am »

cool you know a lot about java
Logged
combiz
Newbie
*
Offline Offline

Posts: 1

«
Embed this message
Reply #2 on: March 09, 2007, 10:32:59 am »

Could you please send me the source code for traffic control.
Thanks
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #3 on: March 09, 2007, 02:46:01 pm » posted from:Taipei,T'ai-pei,Taiwan

If you click the button "load ejs as signed applet".
You can see the source code/modified it and save it to your disk. (EJS source is saved in XML format)
You will find variables defined, relations between variables ...
It is the same for all the simulations created with EJS shown in the web site.
Logged
bardha
Newbie
*
Offline Offline

Posts: 1

«
Embed this message
Reply #4 on: April 18, 2007, 03:06:12 pm »

Can this program be considered as a real-time system application program?

Please,if it's possible send me the documentation of this application,because i don't understand it very well.

Thank you.
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #5 on: April 19, 2007, 01:09:58 am »

Yes. I believe many "one way traffic light system" did implement it to control the traffic in real life.

If you want to discuss about it, please write down what you know and what you think you do not understand.
Logged
revage06
Newbie
*
Offline Offline

Posts: 1

«
Embed this message
Reply #6 on: April 24, 2007, 08:03:13 pm »

Dear Sir,
it's cool simulation, could you please send me the source code for traffic control.
Thanks & regards
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #7 on: April 28, 2007, 04:21:26 pm »

The EJS will be installed into your browser if you clieck "load ejs as signed applets" for the first time. And the applets source will be loaded into ejs as well.
You can see all the source(variables,equations...), modify it or save it(click save button).
You can even generate new simulation after you modify the code.
Logged
crazyboyrs
Newbie
*
Offline Offline

Posts: 1

«
Embed this message
Reply #8 on: May 31, 2007, 01:32:57 am »

I've seen the previous version code.But i dun understand how to code the program in EJS.Is it simpler or more complicated?Got any sources?the EJS manual din help much
Logged
joel123
Newbie
*
Offline Offline

Posts: 1

«
Embed this message
Reply #9 on: July 25, 2007, 03:46:21 am »

Mr Fu-Kwun Hwang i hope that you be fine, im from mexico and  im really interested in your simulation applet because im developing one simulator for my simultaion class and i think that your source code could help me to complete my project. please answer me to  my email as soon as posible thank you. ill be waiting for you answer bye
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #10 on: July 25, 2007, 08:45:19 am »

The EJS will be loaded into your browser(with your permission) and you will be able to save/modify the ejs source code, if you clicked the above button (right under the simulation) labeled as "load ejs as signed applet".

Actually, it is the same for all the simulations created with EJS on our server.
So, please click the button. And you will find out how the ariables are defined, what are the relations used. You can save it if you click the save button in the EJS and you can even modify the code and generate new simulation (click green triangle).
Logged
serkan3123
Newbie
*
Offline Offline

Posts: 2

«
Embed this message
Reply #11 on: November 11, 2007, 04:14:35 am »

Can you send me source code?

serkan3123@gmail.com
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #12 on: November 11, 2007, 10:04:35 am »

You will get the EJS source code, if you clicked down ejs source link (just under the java simulation).
It is an xml file. You can open it if you install EJS or you can click load ejs as signed applet to load ejs into your browser(about 2M) and you can see the source automatically.
Logged
yeek01
Newbie
*
Offline Offline

Posts: 2

«
Embed this message
Reply #13 on: March 18, 2009, 05:48:29 am »

Sir, i find error when i try to run it using EJS.

The following are the errors:

Warning. Syntax error or custom page updatelight:
  Parse error at line 1, column 41.  Encountered: [
Warning. Syntax error or custom page updatecar:
  Parse error at line 1, column 42.  Encountered: [
File successfully read trafficcontrol.xml
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #14 on: March 18, 2009, 07:23:04 am » posted from:Taipei,T'ai-pei,Taiwan

Please download it again. It should work fine now.
The following line has been changed from
public void updatelight (double tlight[],java.lang.Object clr[],String slight[]) {
to
public void updatelight (double[] tlight,java.lang.Object[] clr,String[] slight) {
Logged
arnanbd
Newbie
*
Offline Offline

Posts: 7


«
Embed this message
Reply #15 on: August 16, 2009, 02:05:18 am » posted from:Ramat Gan,Tel Aviv,Israel

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

Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #16 on: August 16, 2009, 07:45:27 am » posted from:Taipei,T\'ai-pei,Taiwan

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!
Logged
arnanbd
Newbie
*
Offline Offline

Posts: 7


«
Embed this message
Reply #17 on: August 16, 2009, 02:44:22 pm » posted from:Tel Aviv,Tel Aviv,Israel

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/ ?
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #18 on: August 16, 2009, 10:32:49 pm » posted from:Taipei,T\'ai-pei,Taiwan

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. 
Logged
arnanbd
Newbie
*
Offline Offline

Posts: 7


«
Embed this message
Reply #19 on: August 17, 2009, 05:47:26 pm » posted from:Tel Aviv,Tel Aviv,Israel

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?
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #20 on: August 17, 2009, 09:54:55 pm » posted from:Taipei,T\'ai-pei,Taiwan

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).
Logged
arnanbd
Newbie
*
Offline Offline

Posts: 7


«
Embed this message
Reply #21 on: August 18, 2009, 04:18:15 pm » posted from:Tel Aviv,Tel Aviv,Israel

It's not the same. In the original there is an ability to control acceleration and delay.
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #22 on: August 18, 2009, 04:38:58 pm » posted from:Taipei,T'ai-pei,Taiwan

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.
Logged
arnanbd
Newbie
*
Offline Offline

Posts: 7


«
Embed this message
Reply #23 on: August 19, 2009, 05:49:58 am » posted from:Caesarea,Hefa,Israel

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.
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #24 on: August 19, 2009, 08:14:38 am » posted from:Taipei,T\'ai-pei,Taiwan

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
Logged
arnanbd
Newbie
*
Offline Offline

Posts: 7


«
Embed this message
Reply #25 on: August 19, 2009, 04:25:02 pm » posted from:Tel Aviv,Tel Aviv,Israel

Thank you Hwang.
I have tried to change the acceleration and dealy parameters but it looks like it does not do anything.
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #26 on: August 19, 2009, 06:31:11 pm » posted from:Taipei,T\'ai-pei,Taiwan

You need to hit ENTER after you change your value.
For example: try acceleration =1.0 m/s2and reaction time=2.0 s
Logged
srinivas2828
Newbie
*
Offline Offline

Posts: 1

«
Embed this message
Reply #27 on: January 28, 2010, 08:20:10 pm » posted from:Hyderabad,Andhra Pradesh,India

its awesome may i get a copy of source code if you dont mind -*-
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3053



WWW
«
Embed this message
Reply #28 on: January 28, 2010, 08:47:18 pm » posted from:Taipei,T\'ai-pei,Taiwan

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.
Logged
Pages: [1]   Go Up
  Print  
Discovery consists of seeing what everybody has seen and thinking what nobody has thought. ..."Albert von Szent-Gyorgyi(1893-1986, 1937 Nobel Prize for Medicine, Lived to 93)"
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Traffic Control
Comment about this web site!
go2mmusa 2 13159 Last post August 24, 2010, 10:20:58 am
by JerriHain
Traffic Light Simulation (Java)
Request for physics Simulations
null404 9 24482 Last post April 22, 2008, 08:59:13 am
by Fu-Kwun Hwang
Ejs version of traffic control simulation
kinematics
ahmedelshfie 1 3152 Last post September 27, 2010, 05:46:30 pm
by ahmedelshfie
High way traffic simulation
Kinematics
Fu-Kwun Hwang 1 9127 Last post March 27, 2014, 03:01:57 pm
by Fu-Kwun Hwang
Mesoscopic traffic light simulation
Simulations from other web sites
Ifeanyi 2 10296 Last post December 09, 2011, 07:14:35 am
by Ifeanyi
Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.117 seconds with 23 queries.since 2011/06/15