traci._trafficlight | index /home/delphi/gcc/sumo/tools/traci/_trafficlight.py

`# -*- coding: utf-8 -*-
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2011-2022 German Aerospace Center (DLR) and others.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0/
# This Source Code may also be made available under the following Secondary
# Licenses when the conditions for such availability set forth in the Eclipse
# Public License 2.0 are satisfied: GNU General Public License, version 2
# or later which is available at
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later`

Modules
`` |  |
traci.constants |  |  |

Classes
`` |  | builtins.object Constraint Logic Phase traci.domain.Domain(builtins.object) TrafficLightDomain
class Constraint(builtins.object)
`` | `Constraint(signalId, tripId, foeId, foeSignal, limit, type, mustWait, active=True)`
| Methods defined here: __init__(self, signalId, tripId, foeId, foeSignal, limit, type, mustWait, active=True) `Initialize self. See help(type(self)) for accurate signature.` __repr__(self) `Return repr(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) `Initialize self. See help(type(self)) for accurate signature.` __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 Phase(builtins.object)
`` | `Phase(duration, state, minDur=-1, maxDur=-1, next=(), name='')`
| Methods defined here: __init__(self, duration, state, minDur=-1, maxDur=-1, next=(), name='') `Initialize self. See help(type(self)) for accurate signature.` __repr__(self) `Return repr(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.` 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` 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, tls) `setProgramLogic(string, Logic) -> None Sets a new program for the given tlsID from a Logic object. See getCompleteRedYellowGreenDefinition.` 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, tls) `setProgramLogic(string, Logic) -> None Sets a new program for the given tlsID from a Logic object. See getCompleteRedYellowGreenDefinition.` 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 'traci._trafficlight.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, objID, param) `getParameter(string, string) -> string Returns the value of the given parameter for the given objID` getParameterWithKey(self, objID, param) `getParameterWithKey(string, string) -> (string, string) Returns the (key, value) tuple of the given parameter for the given objID` 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, objID, param, value) `setParameter(string, string, string) -> None Sets the value of the given parameter to value for the given objID` 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, objID, 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)`

Data
`` |  | absolute_import = _Feature((2, 5, 0, 'alpha', 1), (3, 0, 0, 'alpha', 0), 262144)