| |
- builtins.object
-
- Constraint
- Logic
- traci.domain.Domain(builtins.object)
-
- TrafficLightDomain
class Constraint(builtins.object) |
|
Constraint(signalId, tripId, foeId, foeSignal, limit, type, mustWait, active=True, param={})
|
|
Methods defined here:
- __init__(self, signalId, tripId, foeId, foeSignal, limit, type, mustWait, active=True, param={})
- Initialize self. See help(type(self)) for accurate signature.
- __repr__(self)
- Return repr(self).
- getParameter(self, key, default=None)
- getParameters(self)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Logic(builtins.object) |
|
Logic(programID, type, currentPhaseIndex, phases=None, subParameter=None)
|
|
Methods defined here:
- __init__(self, programID, type, currentPhaseIndex, phases=None, subParameter=None)
- Constructs a new Logic object with the following arguments:
programID (string) - arbitrary
type (integer) - one of
tc.TRAFFICLIGHT_TYPE_STATIC
tc.TRAFFICLIGHT_TYPE_ACTUATED
tc.TRAFFICLIGHT_TYPE_NEMA
tc.TRAFFICLIGHT_TYPE_DELAYBASED
currentPhaseIndex (integer) - must be in range [0, len(phases) - 1]
phases (list of Phase objects)
subParameter (dictl) - corresponds to generic <param> objects
- __repr__(self)
- Return repr(self).
- getParameter(self, key, default=None)
- getParameters(self)
- getPhases(self)
- getSubID(self)
- getType(self)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class TrafficLightDomain(traci.domain.Domain) |
|
TrafficLightDomain(name='trafficlight', deprecatedFor=None)
|
|
- Method resolution order:
- TrafficLightDomain
- traci.domain.Domain
- builtins.object
Methods defined here:
- __init__(self, name='trafficlight', deprecatedFor=None)
- Initialize self. See help(type(self)) for accurate signature.
- addConstraint(self, tlsID, tripId, foeSignal, foeId, type=0, limit=0)
- addConstraint(string, string, string, string, int, int) -> None
Add the given constraint.
- getAllProgramLogics(self, tlsID)
- getAllProgramLogics(string) -> list(Logic)
Returns a list of Logic objects.
Each Logic encodes a traffic light program for the given tlsID.
- getBlockingVehicles(self, tlsID, linkIndex)
- getBlockingVehicles(string, int) -> int
Returns the list of vehicles that are blocking the subsequent block for
the given tls-linkIndex
- getCompleteRedYellowGreenDefinition = getAllProgramLogics(self, tlsID)
- getAllProgramLogics(string) -> list(Logic)
Returns a list of Logic objects.
Each Logic encodes a traffic light program for the given tlsID.
- getConstraints(self, tlsID, tripId='')
- getConstraints(string, string) -> list(Constraint)
Returns the list of rail signal constraints for the given rail signal.
If tripId is not "", only constraints with the given tripId are
returned. Otherwise, all constraints are returned
- getConstraintsByFoe(self, foeSignal, foeId='')
- getConstraintsByFoe(string, string) -> list(Constraint)
Returns the list of rail signal constraints that have the given rail
signal id as their foeSignal.
If foeId is not "", only constraints with the given foeId are
returned. Otherwise, all constraints are returned
- getControlledLanes(self, tlsID)
- getControlledLanes(string) -> c
Returns the list of lanes which are controlled by the named traffic light.
- getControlledLinks(self, tlsID)
- getControlledLinks(string) -> list(list(list(string)))
Returns the links controlled by the traffic light, sorted by the signal index and described by giving
the incoming, outgoing, and via lane.
- getNemaPhaseCalls(self, tlsID)
- getNemaPhaseCalls(string) -> list(string)
Get the vehicle calls for the phases.
The output is vehicle calls (coming from the detectors) for the phases.
- getNextSwitch(self, tlsID)
- getNextSwitch(string) -> double
Returns the absolute simulation time at which the traffic light is
schedule to switch to the next phase (in seconds).
- getPhase(self, tlsID)
- getPhase(string) -> integer
Returns the index of the current phase within the list of all phases of
the current program.
- getPhaseDuration(self, tlsID)
- getPhaseDuration(string) -> double
Returns the total duration of the current phase (in seconds). This value
is not affected by the elapsed or remaining duration of the current phase.
- getPhaseName(self, tlsID)
- getPhaseName(string) -> string
Returns the name of the current phase.
- getPriorityVehicles(self, tlsID, linkIndex)
- getPriorityVehicles(string, int) -> int
Returns the list of vehicles that also wish to enter the subsequent block for
the given tls-linkIndex (only those with higher priority)
- getProgram(self, tlsID)
- getProgram(string) -> string
Returns the id of the current program.
- getRedYellowGreenState(self, tlsID)
- getRedYellowGreenState(string) -> string
Returns the named tl's state as a tuple of light definitions from
rugGyYoO, for red, yed-yellow, green, yellow, off, where lower case letters mean that the stream
has to decelerate.
- getRivalVehicles(self, tlsID, linkIndex)
- getRivalVehicles(string, int) -> int
Returns the list of vehicles that also wish to enter the subsequent block for
the given tls-linkIndex (regardless of priority)
- getServedPersonCount(self, tlsID, index)
- getServedPersonCount(string, int) -> int
Returns the number of persons that would be served in the given phase
- getSpentDuration(self, tlsID)
- getSpentDuration(string) -> double
Returns the time in seconds for which the current phase has been active
- removeConstraints(self, tlsID, tripId, foeSignal, foeId)
- removeConstraints(string, string, string, string)
remove constraints with the given values. Any combination of inputs may
be set to "" to act as a wildcard filter
- setCompleteRedYellowGreenDefinition = setProgramLogic(self, tlsID, logic)
- setProgramLogic(string, Logic) -> None
Sets a new program for the given tlsID from a Logic object.
See getAllProgramLogics which returns a list of Logic objects.
- setLinkState(self, tlsID, tlsLinkIndex, state)
- setLinkState(string, string, int, string) -> None
Sets the state for the given tls and link index. The state must be one
of rRgGyYoOu for red, red-yellow, green, yellow, off, where lower case letters mean that the stream has
to decelerate.
The link index is shown in the GUI when setting the appropriate junction
visualization option.
- setNemaCycleLength(self, tlsID, cycleLength)
- setNemaCycleLength(string, double) -> None
Set a new cycle length to the given NEMA-controller.
This function is only effective for NEMA type of controllers.
The new cycle length will be implemented in the next cycle of the control.
This function should be used with setNemaSplits or setNemaMaxGreen.
- setNemaMaxGreens(self, tlsID, maxGreens)
- setNemaMaxGreens(string, list(string)) -> None
Set a new set of splits to the given NEMA-controller.
This function is only effective for NEMA type of controllers.
The new max green will be implemented in the next cycle of the control.
The value must be a space-separated list of 8 numbers with each number
being the time in seconds for NEMA-phases 1 to 8.
Time 0 must be used of the phase does not exists.
Example: “11.0 34.0 15.0 20.0 11.0 34.0 15.0 20.0"
- setNemaOffset(self, tlsID, offset)
- setNemaOffset(string, double) -> None
Set a new offset to the given NEMA-controller.
This function is only effective for NEMA type controllers when operating under coordinated mode.
The new offset will be implemented in the next cycle of the control by adjusting
the actual green time of the coordinated phase.
There is no transition implemented in the NEMA-controller for changing the offset.
It’s expected that the users will control the change of the offset in each cycle
to implement their own transition algorithm.
- setNemaSplits(self, tlsID, splits)
- setNemaSplits(string, list(string)) -> None
Set a new set of splits to the given NEMA-controller.
This function is only effective for NEMA type of controllers.
The new splits will be implemented in the next cycle of the control.
The value must be a space-separated list of 8 numbers with each number
being the time in seconds for NEMA-phases 1 to 8.
Time 0 must be used of the phase does not exists.
Example: “11.0 34.0 15.0 20.0 11.0 34.0 15.0 20.0" (gives total cycle length of 80s)
- setPhase(self, tlsID, index)
- setPhase(string, integer) -> None
Switches to the phase with the given index in the list of all phases for
the current program.
- setPhaseDuration(self, tlsID, phaseDuration)
- setPhaseDuration(string, double) -> None
Set the remaining phase duration of the current phase in seconds.
This value has no effect on subsquent repetitions of this phase.
- setPhaseName(self, tlsID, name)
- setPhaseName(string, string) -> None
Sets the name of the current phase within the current program
- setProgram(self, tlsID, programID)
- setProgram(string, string) -> None
Switches to the program with the given programID. The program must have
been loaded earlier. The special value 'off' can always be used to
switch off the traffic light.
- setProgramLogic(self, tlsID, logic)
- setProgramLogic(string, Logic) -> None
Sets a new program for the given tlsID from a Logic object.
See getAllProgramLogics which returns a list of Logic objects.
- setRedYellowGreenState(self, tlsID, state)
- setRedYellowGreenState(string, string) -> None
Sets the named tl's state as a tuple of light definitions from
rugGyYuoO, for red, red-yellow, green, yellow, off, where lower case letters mean that the stream has
to decelerate.
- swapConstraints(self, tlsID, tripId, foeSignal, foeId)
- swapConstraints(string, string, string, string) -> list(Constraint)
Reverse the given constraint and return list of new constraints that
were created (by swapping) to avoid deadlock.
- updateConstraints(self, vehID, tripId='')
- getConstraints(string, string)
Removes all constraints that can no longer be met because the route of
vehID does not pass traffic light of the constraint with the given tripId.
This includes constraints on tripId as well as constraints where tripId
is the foeId.
If tripId is "", the current tripId of vehID is used.
Data and other attributes defined here:
- Logic = <class 'traci._trafficlight.Logic'>
- Phase = <class 'sumolib.net.Phase'>
Methods inherited from traci.domain.Domain:
- getAllContextSubscriptionResults(self)
- getAllSubscriptionResults(self)
- getAllSubscriptionResults() -> dict(string: dict(integer: <value_type>))
Returns the subscription results for the last time step and all objects of the domain.
It is not possible to retrieve older subscription results than the ones
from the last time step.
- getContextSubscriptionResults(self, objectID)
- getIDCount(self)
- getIDCount() -> integer
Returns the number of currently loaded objects.
- getIDList(self)
- getIDList() -> list(string)
Returns a list of all objects in the network.
- getParameter(self, objectID, key)
- getParameter(string, string) -> string
Returns the value of the given parameter for the given objectID
- getParameterWithKey(self, objectID, key)
- getParameterWithKey(string, string) -> (string, string)
Returns the (key, value) tuple of the given parameter for the given objectID
- getSubscriptionResults(self, objectID)
- getSubscriptionResults(string) -> dict(integer: <value_type>)
Returns the subscription results for the last time step and the given object.
If the object id is unknown or the subscription did for any reason return no data,
'None' is returned.
It is not possible to retrieve older subscription results than the ones
from the last time step.
- setParameter(self, objectID, key, value)
- setParameter(string, string, string) -> None
Sets the value of the given parameter to value for the given objectID
- subscribe(self, objectID, varIDs=None, begin=-1073741824.0, end=-1073741824.0, parameters=None)
- subscribe(string, list(integer), double, double, map(string->tuple)) -> None
Subscribe to one or more object values for the given interval.
- subscribeContext(self, objectID, domain, dist, varIDs=None, begin=-1073741824.0, end=-1073741824.0, parameters=None)
- subscribeContext(string, int, double, list(integer), double, double) -> None
Subscribe to objects of the given domain (specified as domain=traci.constants.CMD_GET_<DOMAIN>_VARIABLE),
which are closer than dist to the object specified by objectID.
- subscribeParameterWithKey(self, objectID, key, begin=-1073741824.0, end=-1073741824.0)
- subscribeParameterWithKey(string, string) -> None
Subscribe for a generic parameter with the given key.
- unsubscribe(self, objectID)
- unsubscribe(string) -> None
Unsubscribe from receiving object values.
- unsubscribeContext(self, objectID, domain, dist)
Data descriptors inherited from traci.domain.Domain:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |