Hi Jakob,

I typed help traci.trafficlights yet I could not be able to find the functions 
traci.trafficlights.getPhaseDuration() and  traci.trafficlights.getDuration  in 
traci4matlab. How to get them?

Logic                          - constructs a Logic object.
Phase                          - Construct a Phase object for TraCI traffic 
lights.
getCompleteRedYellowGreenDefinition - Get the complete traffic lights 
definition.
getContextSubscriptionResults  - Get the context subscription results for the
getControlledLanes             - Get the controlled lanes.
getControlledLinks             - Get the links controlled by the traffic light.
getIDList                      - Get the IDs of the traffic lights in the 
network.
getNextSwitch                  - Returns the time in ms at which the next phase 
change will
getPhase                       - Get the phase index.
getProgram                     - Returns the id of the current program.
getRedYellowGreenState         - Get the traffic lights' state.
getSubscriptionResults         - Get the subscription results for the last time 
step.
getUniversal                   - An internal function to send the get command 
and read the
readLinks                      - Internal function to read the links controlled 
by the traffic lights.
readLogics                     - Internal function to read the complete program 
of the traffic lights.
setCompleteRedYellowGreenDefinition - Set the complete definition of the 
traffic light.
setPhase                       - Set the phase index of the traffic light.
setPhaseDuration               - Set the phase duration traffic light.
setProgram                     - Sets the id of the current program.
setRedYellowGreenState         - Set the state of the traffic lights.
subscribe                      - Subscribe to traffic lights variable.
subscribeContext               - Subscribe to a traffic lights's context 
variable.


________________________________
From: Jakob Erdmann <[email protected]>
Sent: Tuesday, September 19, 2017 3:55 AM
To: Lawrence Soon; Sumo project User discussions
Cc: [email protected]
Subject: Re: [sumo-user] How do I get the time duration of green traffic light 
on a particular edge via traci4matlab?

First you need to determine the traffic-light index which corresponds to that 
edge (or rather to the lane-to-lane connections from that edge because each 
connection has it's own index).
This is done by calling the function trafficlights.getControlledLinks.

Then you can retrieve the state with getgetRedYellowGreenState and interpret it 
using the respective index)
By calling getDuration getNextSwitch you can figure out all there is to know 
about spend and remaining duration (see the explanation at getPhaseDuration)

regards,
Jakob

2017-09-18 15:27 GMT+02:00 Lawrence Soon via sumo-user 
<[email protected]<mailto:[email protected]>>:
Hello,


I realised that in net.xml file, the trafficlight control does not specify 
which edge is the phase for, as shown below as an example:

<tlLogic id="232207810" type="static" programID="0" offset="0">
        <phase duration="36" state="GGGGGrrrrr"/>
        <phase duration="9" state="yyyyyrrrrr"/>
        <phase duration="36" state="rrrrrGGGGG"/>
        <phase duration="9" state="rrrrryyyyy"/>
</tlLogic>


and let the edge is defined this way:

<edge id="street5leftleft" from="232207810" to="233432379" priority="9" 
type="highway.primary" spreadType="center" shape="509.17,869.74 519.11,881.80 
567.57,936.91 604.90,975.02 611.28,982.15 616.33,987.82 645.59,1020.13 
664.22,1040.70">
        <lane id="street5leftleft_0" index="0" disallow="tram rail_urban rail 
rail_electric ship" speed="27.78" length="213.48" shape="517.39,874.53 
521.62,879.66 569.99,934.66 607.31,972.76 613.74,979.95 618.79,985.61 
648.04,1017.91 660.99,1032.21"/>
        <lane id="street5leftleft_1" index="1" disallow="tram rail_urban rail 
rail_electric ship" speed="27.78" length="213.48" shape="514.84,876.62 
519.11,881.80 567.57,936.91 604.90,975.02 611.28,982.15 616.33,987.82 
645.59,1020.13 658.54,1034.43"/>
        <lane id="street5leftleft_2" index="2" disallow="tram rail_urban rail 
rail_electric ship" speed="27.78" length="213.48" shape="512.30,878.72 
516.60,883.94 565.15,939.16 602.49,977.28 608.82,984.35 613.87,990.03 
643.14,1022.35 656.10,1036.64"/>
 </edge>


junction is defined as :

<junction id="232207810" type="traffic_light" x="509.17" y="869.74" 
incLanes="juncons35_0 juncons35_1 juncons35_2 juncons35_3 street3leftleft2_0 
street3leftleft2_1 street3leftleft2_2" intLanes=":232207810_0_0 :232207810_1_0 
:232207810_1_1 :232207810_1_2 :232207810_1_3 :232207810_5_0 :232207810_5_1 
:232207810_5_2 :232207810_8_0 :232207810_8_1" shape="511.06,879.74 
518.63,873.51 518.97,871.59 512.34,860.29 509.50,860.22 500.93,864.96 
500.37,867.06 506.61,878.58">
        <request index="0" response="0000000000" foes="0011100000" cont="0"/>
        <request index="1" response="0000000000" foes="1111100000" cont="0"/>
        <request index="2" response="0000000000" foes="1111100000" cont="0"/>
        <request index="3" response="0000000000" foes="1111100000" cont="0"/>
        <request index="4" response="0000000000" foes="1111100000" cont="0"/>
        <request index="5" response="0000011111" foes="0000011111" cont="0"/>
        <request index="6" response="0000011111" foes="0000011111" cont="0"/>
        <request index="7" response="0000011111" foes="0000011111" cont="0"/>
        <request index="8" response="0000011110" foes="0000011110" cont="0"/>
        <request index="9" response="0000011110" foes="0000011110" cont="0"/>
 </junction>


So how do I get the time duration of green traffic light on a particular edge 
via traci4matlab?



Thanks and have a great day!

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
sumo-user mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
[email protected]<mailto:[email protected]>
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/sumo-user

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
sumo-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sumo-user

Reply via email to