Package de.tudresden.sumo.cmd
Class Trafficlight
java.lang.Object
de.tudresden.sumo.cmd.Trafficlight
The Class Trafficlight.
- Author:
- Mario Krumnow, Evamarie Wiessner
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic SumoCommand
Returns the complete traffic light program.static SumoCommand
getControlledJunctions
(String tlsID) Returns the junctions controlled by the traffic light.static SumoCommand
getControlledLanes
(String tlsID) Returns the list of lanes which are controlled by the named traffic light.static SumoCommand
getControlledLinks
(String tlsID) Returns the links controlled by the traffic light, sorted by the signal index and described by giving the incoming, outgoing, and via lane.static SumoCommand
getExternalState
(String tlsID) Returns the external state.static SumoCommand
Returns the number of all traffic lights in the network.static SumoCommand
Returns a list of IDs of all traffic lights within the scenario.static SumoCommand
getNextSwitch
(String tlsID) Returns the assumed time (in ms) at which the TLS changes the phase.static SumoCommand
getParameter
(String tlsID, String param) Returns the chosen parameter.static SumoCommand
Returns the index of the current phase in the current program.static SumoCommand
getPhaseDuration
(String tlsID) getPhaseDuration.static SumoCommand
getPhaseName
(String tlsID) Returns the name of the current phase in the current program.static SumoCommand
getProgram
(String tlsID) Returns the id of the current program.static SumoCommand
getRedYellowGreenState
(String tlsID) Returns the named tl's state as a tuple of light definitions from rRgGyYoO, for red, green, yellow, off, where lower case letters mean that the stream has to decelerate.static SumoCommand
setCompleteRedYellowGreenDefinition
(String tlsID, SumoTLSProgram tls) Set the complete traffic light program.static SumoCommand
setParameter
(String tlsID, String param, String value) Sets the chosen parameter.static SumoCommand
Set the index of the current phase in the current program.static SumoCommand
setPhaseDuration
(String tlsID, double phaseDuration) Set the duration of the currently active phase (in s?).static SumoCommand
setPhaseName
(String tlsID, String name) Set the name of the current phase in the current program.static SumoCommand
setProgram
(String tlsID, String programID) Set the id of the current program.static SumoCommand
setRedYellowGreenState
(String tlsID, String state) Set the named tl's state as a tuple of light definitions.
-
Constructor Details
-
Trafficlight
public Trafficlight()
-
-
Method Details
-
getCompleteRedYellowGreenDefinition
Returns the complete traffic light program.- Parameters:
tlsID
- a string identifying the traffic light- Returns:
- program definition
-
getIDCount
Returns the number of all traffic lights in the network.- Returns:
- number of traffic lights
-
getPhaseDuration
getPhaseDuration.- Parameters:
tlsID
- a string identifying the traffic light- Returns:
- phase duration
-
getControlledLanes
Returns the list of lanes which are controlled by the named traffic light.- Parameters:
tlsID
- a string identifying the traffic light- Returns:
- list of controlled lanes
-
getControlledLinks
Returns the links controlled by the traffic light, sorted by the signal index and described by giving the incoming, outgoing, and via lane.- Parameters:
tlsID
- a string identifying the traffic light- Returns:
- list of controlled links
-
getControlledJunctions
Returns the junctions controlled by the traffic light.- Parameters:
tlsID
- a string identifying the traffic light- Returns:
- list of controlled junctions
-
getExternalState
Returns the external state.- Parameters:
tlsID
- a string identifying the traffic light- Returns:
- compound of the external state
-
getIDList
Returns a list of IDs of all traffic lights within the scenario.- Returns:
- a list of IDs of all TLS
-
getNextSwitch
Returns the assumed time (in ms) at which the TLS changes the phase.- Parameters:
tlsID
- a string identifying the traffic light- Returns:
- absolute time, counting from simulation start, at which TLS may change
-
getParameter
Returns the chosen parameter.- Parameters:
tlsID
- a string identifying the traffic lightparam
- a string identifying the parameter- Returns:
- the specific parameter
-
setParameter
Sets the chosen parameter.- Parameters:
tlsID
- the tls IDparam
- a string identifying the parametervalue
- a string identifying the new value- Returns:
- SumoCommand
-
getPhase
Returns the index of the current phase in the current program.- Parameters:
tlsID
- a string identifying the traffic light- Returns:
- index of the current phase
-
getPhaseName
Returns the name of the current phase in the current program.- Parameters:
tlsID
- a string identifying the traffic light- Returns:
- name of the current phase
-
getProgram
Returns the id of the current program.- Parameters:
tlsID
- a string identifying the traffic light- Returns:
- index of the current program
-
getRedYellowGreenState
Returns the named tl's state as a tuple of light definitions from rRgGyYoO, for red, green, yellow, off, where lower case letters mean that the stream has to decelerate.- Parameters:
tlsID
- a string identifying the traffic light- Returns:
- SumoCommand
-
setCompleteRedYellowGreenDefinition
Set the complete traffic light program.- Parameters:
tlsID
- a string identifying the traffic lighttls
- complete program definition- Returns:
- SumoCommand
-
setPhase
Set the index of the current phase in the current program.- Parameters:
tlsID
- a string identifying the traffic lightindex
- an integer identifying the phase (it must be between 0 and the number of phases known to the current program of the tls - 1)- Returns:
- SumoCommand
-
setPhaseName
Set the name of the current phase in the current program.- Parameters:
tlsID
- a string identifying the traffic lightname
- a string with the phase name- Returns:
- SumoCommand
-
setPhaseDuration
Set the duration of the currently active phase (in s?).- Parameters:
tlsID
- a string identifying the traffic lightphaseDuration
- remaining duration of the current phase- Returns:
- SumoCommand
-
setProgram
Set the id of the current program.- Parameters:
tlsID
- a string identifying the traffic lightprogramID
- a string identifying the program- Returns:
- SumoCommand
-
setRedYellowGreenState
Set the named tl's state as a tuple of light definitions.- Parameters:
tlsID
- a string identifying the traffic lightstate
- as a tuple of light definitions from rRgGyYoO, for red, green, yellow, off, where lower case letters mean that the stream has to decelerate- Returns:
- SumoCommand
-