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 <namdre.sumo@xxxxxxxxxxxxxx>
Sent: Tuesday, September 19, 2017 3:55 AM
To: Lawrence Soon; Sumo project User discussions
Cc: sumo-user@xxxxxxxxxxxxxxxxxxxxx
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