Welcome to Realtime Technologies Support Forum


  Reply to this topicStart new topicStart Poll

> intersection signals, How do you control intersection signals?
Alicia
Posted: Oct 7 2009, 08:13 AM
Quote Post


Advanced Member
***

Group: Members
Posts: 38
Member No.: 65
Joined: 25-March 09



Hello!
I would like to set some of my signals to stay green in a certain direction, can I do that?

Thanks,
Alicia
PMEmail Poster
Top
hstoner
Posted: Oct 7 2009, 08:29 AM
Quote Post


SimVista Forum Moderator
***

Group: Members
Posts: 65
Member No.: 16
Joined: 5-September 06



This type of functionality was introduced in the latest version of our product (2.30). That was shipped out the week of September 21, 2009.

Some of the command that would be useful to you in this case is setDefaultTime(). There are examples of this in SystemTestScenario_34. (databaes/SystemTestScenario and databases/SystemTestScenarioScripts)

For example if you have a proximity sensor just before the intersection you can have the following code in your JavaScript that will force the traffic light to turn Green for the subject vehicle.

CODE


this.onEnter = function(entity, direction) {
// Executes when the entity's CG crosses the sensor and enters

if(entity.isSubject())
{
 a4=Scenario.Subject.getIntersectionController();
 if(a4)
 {
   if(Scenario.Subject.getDirection() == 0)
   {
    oppDirection = 1;
   }
   else
   {
    oppDirection = 0;
   }
   
   if(Scenario.Subject.getPhase() == PHASE_GREEN)
   {
    Scenario.Subject.setPhase(PHASE_GREEN, 40);
   
   }
   else
   {
    a4.setPhase(oppDirection, PHASE_YELLOW, 10);
   
   }
       
 }
}


}

this.onLeave = function(entity, direction) {
// Executes when the entity's CG crosses the sensor and leaves
if(entity.isSubject())
{
 Scenario.Subject.setPhase(PHASE_GREEN, 40);
 
}
}



PMEmail Poster
Top
Alicia
Posted: Oct 7 2009, 09:11 AM
Quote Post


Advanced Member
***

Group: Members
Posts: 38
Member No.: 65
Joined: 25-March 09



thanks!

How does getIntersectionController know which interesection to look at. Is a4 the name of the tile? Or does it always get the info from the nearest intersection?
PMEmail Poster
Top
Alicia
Posted: Nov 2 2009, 10:46 AM
Quote Post


Advanced Member
***

Group: Members
Posts: 38
Member No.: 65
Joined: 25-March 09



Hi Heather,
I'm using this exact script, but sometimes it seems to work for me and sometimes it doesn't.
What exactly is this command saying to do?
"Scenario.Subject.setPhase(PHASE_GREEN, 40);" turn the light green in 40 seconds? hold it green for 40 seconds?

I'm assuming for this line if(Scenario.Subject.getDirection() == 0), 0 is the "north" direction?

Thanks,
PMEmail Poster
Top
RichardRomano
Posted: Nov 3 2009, 07:27 AM
Quote Post


Member
**

Group: Members
Posts: 15
Member No.: 3
Joined: 2-July 04



Subject.getIntersectionController returns the intersection that the subject is approaching. Typically you have to be within 50 meters for it to work.

The setPhase(PHASE_GREEN,40) is telling the intersection controller to move to the green phase for the direction the subject is travelling and stay there for 40 seconds. How long it takes to get to the green phase is unfortunately dependent on what phase the controller is currently in. It needs to give a full yellow phase for the direction it is currently green in and then you will get the green phase you are asking for. If the controller happens to be already green in your direction when you ask for the green phase then you will get that phase to continue for another 40 seconds.

This means that you might need to take control of the intersection controller a little sooner than you think to make sure it is in the phase that you need.
PMEmail Poster
Top
Alicia
Posted: Nov 3 2009, 10:33 AM
Quote Post


Advanced Member
***

Group: Members
Posts: 38
Member No.: 65
Joined: 25-March 09



I think I placed my sensors at the begining of the tile (100 m away), so that's probably my problem. Thanks!
PMEmail Poster
Top

Topic Options Reply to this topicStart new topicStart Poll

 



[ Script Execution time: 0.0456 ]   [ 10 queries used ]   [ GZIP Enabled ]