traci._simulation
index
/home/delphi/gcc/sumo/tools/traci/_simulation.py

# -*- coding: utf-8 -*-
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
# Copyright (C) 2011-2024 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
warnings

 
Classes
       
builtins.object
Collision
Stage
traci.domain.Domain(builtins.object)
SimulationDomain

 
class Collision(builtins.object)
    Collision(collider, victim, colliderType, victimType, colliderSpeed, victimSpeed, collisionType, lane, pos)
 

 
  Methods defined here:
__attr_repr__(self, attrname, default='')
__init__(self, collider, victim, colliderType, victimType, colliderSpeed, victimSpeed, collisionType, lane, pos)
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 SimulationDomain(traci.domain.Domain)
    
Method resolution order:
SimulationDomain
traci.domain.Domain
builtins.object

Methods defined here:
__init__(self)
Initialize self.  See help(type(self)) for accurate signature.
clearPending(self, routeID='')
convert2D(self, edgeID, pos, laneIndex=0, toGeo=False)
convert3D(self, edgeID, pos, laneIndex=0, toGeo=False)
convertGeo(self, x, y, fromGeo=False)
convertRoad(self, x, y, isGeo=False, vClass='ignoring')
executeMove(self)
executeMove() -> None
Make "half" a simulation step.
findIntermodalRoute(self, fromEdge, toEdge, modes='', depart=-1.0, routingMode=0, speed=-1.0, walkFactor=-1.0, departPos=0.0, arrivalPos=-1073741824.0, departPosLat=0.0, pType='', vType='', destStop='')
findIntermodalRoute(string, string, string, double, int, double,
double, double, double, double, string, string, string) -> Stage
Computes the fastest intermoal route between the given edges for the
given combination of transport modes (i.e. "car public" may result in
driving to the train station and then riding the train).
Returns a list of Stage objects that correspond to the sequence of walks
and rides to reach the destination.
When the depart time is not set, the travel times at the current time will be used.
The routing mode may be ROUTING_MODE_DEFAULT (loaded or
default speeds) and ROUTING_MODE_AGGREGATED (averaged historical speeds)
pType defines the pedestrian type (for walking speed) and defaults to
DEFAULT_PEDTYPE.
walkFactor is a multiplier for the walking speed to
account for delays due to intersections and other traffic when
determining the feasibility of using a particular public transport
vehicle.
vType is an optional vehicle type to use for private car routing.
destStop can be used as an alternative to 'toEdge' to define the edge
and position of the specified public transport stop as the destination
findRoute(self, fromEdge, toEdge, vType='', depart=-1.0, routingMode=0)
findRoute(string, string, string, double, int) -> Stage
Computes the fastest route between the given edges for the given vehicle
type (defaults to DEFAULT_VEHTYPE)
Returns a Stage object that holds the edge list and the travel time
When the depart time is not set, the travel times at the current time
will be used. The routing mode may be ROUTING_MODE_DEFAULT (loaded or
default speeds) and ROUTING_MODE_AGGREGATED (averaged historical speeds)
getArrivedIDList(self)
getArrivedIDList() -> list(string)
 
Returns a list of ids of vehicles which arrived (have reached their destination and are removed from the road
network) in this time step.
getArrivedNumber(self)
getArrivedNumber() -> integer
 
Returns the number of vehicles which arrived (have reached their destination and are removed from the road
network) in this time step.
getArrivedPersonIDList(self)
getArrivedPersonIDList() -> list(string)
 
Returns a list of ids of persons which arrived (have reached their destination and are removed from the road
network) in this time step.
getArrivedPersonNumber(self)
getArrivedPersonNumber() -> integer
 
Returns the number of persons which arrived (have reached their destination and are removed from the road
network) in this time step.
getBusStopIDList(self)
getBusStopWaiting(self, stopID)
getBusStopWaiting() -> integer
Get the total number of waiting persons at the named bus stop.
getBusStopWaitingIDList(self, stopID)
getBusStopWaiting() -> list(string)
Get the IDs of waiting persons at the named bus stop.
getCollidingVehiclesIDList(self)
getCollidingVehiclesIDList() -> list(string)
Return Ids of vehicles involved in a collision (typically 2 per
collision).
getCollidingVehiclesNumber(self)
getCollidingVehiclesNumber() -> integer
Return number of vehicles involved in a collision (typically 2 per
collision).
getCollisions(self)
getCollisions() -> list(Collision)
Returns a list of collision objects
getCurrentTime(self)
getCurrentTime() -> integer
 
Returns the current simulation time in ms.
getDeltaT(self)
getDeltaT() -> double
Returns the length of one simulation step in seconds
getDepartedIDList(self)
getDepartedIDList() -> list(string)
 
Returns a list of ids of vehicles which departed (were inserted into the road network) in this time step.
getDepartedNumber(self)
getDepartedNumber() -> integer
 
Returns the number of vehicles which departed (were inserted into the road network) in this time step.
getDepartedPersonIDList(self)
getDepartedPersonIDList() -> list(string)
 
Returns a list of ids of persons which departed (were inserted into the road network) in this time step.
getDepartedPersonNumber(self)
getDepartedPersonNumber() -> integer
 
Returns the number of persons which departed (were inserted into the road network) in this time step.
getDistance2D(self, x1, y1, x2, y2, isGeo=False, isDriving=False)
getDistance2D(double, double, double, double, boolean, boolean) -> double
 
Returns the distance between the two coordinate pairs (x1,y1) and (x2,y2)
 
If isGeo=True, coordinates are interpreted as longitude and latitude rather
than cartesian coordinates in meters.
 
If isDriving=True, the coordinates are mapped onto the road network and the
length of the shortest route in the network is returned. Otherwise, the
straight-line distance is returned.
getDistanceRoad(self, edgeID1, pos1, edgeID2, pos2, isDriving=False)
getDistanceRoad(string, double, string, double, boolean) -> double
 
Reads two positions on the road network and an indicator whether the air or the driving distance shall be
computed. Returns the according distance.
getEmergencyStoppingVehiclesIDList(self)
getEmergencyStoppingVehiclesIDList() -> list(string)
Return Ids of vehicles that peformed an emergency stop in the last step
getEmergencyStoppingVehiclesNumber(self)
getEmergencyStoppingVehiclesNumber() -> integer
Return number of vehicles that performed an emergency stop in the last step
getEndTime(self)
getEndTime() -> double
 
Returns the configured end time of the simulation in s or -1
getEndingTeleportIDList(self)
getEndingTeleportIDList() -> list(string)
 
Returns a list of ids of vehicles which ended to be teleported in this time step.
getEndingTeleportNumber(self)
getEndingTeleportNumber() -> integer
 
Returns the number of vehicles which ended to be teleported in this time step.
getLoadedIDList(self)
getLoadedIDList() -> list(string)
 
Returns a list of ids of vehicles which were loaded in this time step.
getLoadedNumber(self)
getLoadedNumber() -> integer
 
Returns the number of vehicles which were loaded in this time step.
getMinExpectedNumber(self)
getMinExpectedNumber() -> integer
Returns the number of all active vehicles and persons which are in the net plus the
ones still waiting to start. Vehicles and persons currently stopped with a
'trigger' are excluded from this number (if only triggered objects
remain, the trigger condition cannot be fulfilled and all objects remain
stopped without user intervention).
The returned number may also be smaller than
the actual number of vehicles still to come because of delayed
route file parsing. If the number is 0 however, it is
guaranteed that all route files have been parsed completely.
getNetBoundary(self)
getNetBoundary() -> ((double, double), (double, double))
 
The boundary box of the simulation network.
getOption(self, option)
getOption(string) -> string
 
Returns the value of the given SUMO option
getParkingEndingVehiclesIDList(self)
getParkingEndingVehiclesIDList() -> list(string)
 
.
getParkingEndingVehiclesNumber(self)
getParkingEndingVehiclesNumber() -> integer
 
.
getParkingStartingVehiclesIDList(self)
getParkingStartingVehiclesIDList() -> list(string)
 
.
getParkingStartingVehiclesNumber(self)
getParkingStartingVehiclesNumber() -> integer
 
.
getPendingVehicles(self)
getPendingVehicles() -> list(string)
Returns a list of all vehicle ids waiting for insertion (with depart delay)
getScale(self)
getScale() -> double
 
Returns the traffic scaling factor
getStartingTeleportIDList(self)
getStartingTeleportIDList() -> list(string)
 
Returns a list of ids of vehicles which started to teleport in this time step.
getStartingTeleportNumber(self)
getStartingTeleportNumber() -> integer
 
Returns the number of vehicles which started to teleport in this time step.
getStopEndingVehiclesIDList(self)
getStopEndingVehiclesIDList() -> list(string)
 
.
getStopEndingVehiclesNumber(self)
getStopEndingVehiclesNumber() -> integer
 
.
getStopStartingVehiclesIDList(self)
getStopStartingVehiclesIDList() -> list(string)
 
.
getStopStartingVehiclesNumber(self)
getStopStartingVehiclesNumber() -> integer
 
.
getSubscriptionResults(self)
getSubscriptionResults() -> dict(integer: <value_type>)
 
Returns the subscription results for the last time step.
It is not possible to retrieve older subscription results than the ones
from the last time step.
getTime(self)
getTime() -> double
 
Returns the current simulation time in s.
loadState(self, fileName)
saveState(self, fileName)
setScale(self, value)
setScale(value) -> None
 
Sets the traffic scaling factor
step(self, time=0.0)
step(double) -> None
Make a simulation step and simulate up to the given sim time (in seconds).
If the given value is 0 or absent, exactly one step is performed.
Values smaller than or equal to the current sim time result in no action.
subscribe(self, varIDs=(116,), begin=0, end=2147483647)
subscribe(list(integer), double, double) -> None
 
Subscribe to one or more simulation values for the given interval.
writeMessage(self, msg)

Static methods defined here:
walkingStage(edges, arrivalPos, destStop='', description='')

Data and other attributes defined here:
Stage = <class 'traci._simulation.Stage'>

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
setParameter(self, objectID, key, value)
setParameter(string, string, string) -> None
 
Sets the value of the given parameter to value for the given objectID
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)

 
class Stage(builtins.object)
    Stage(type=-1073741824, vType='', line='', destStop='', edges=[], travelTime=-1073741824.0, cost=-1073741824.0, length=-1073741824.0, intended='', depart=-1073741824.0, departPos=-1073741824.0, arrivalPos=-1073741824.0, description='')
 

 
  Methods defined here:
__attr_repr__(self, attrname, default='')
__init__(self, type=-1073741824, vType='', line='', destStop='', edges=[], travelTime=-1073741824.0, cost=-1073741824.0, length=-1073741824.0, intended='', depart=-1073741824.0, departPos=-1073741824.0, arrivalPos=-1073741824.0, description='')
Initialize self.  See help(type(self)) for accurate signature.
__repr__(self)
Return repr(self).
toXML(self, firstStage=True, isPerson=True, extra=[])
write stage as xml element.
If firstStage=False, the from-attribute is omitted since sumo derives it from the prior stage.
If extra is a list of (attrname, value) these will be added to the xml element

Data descriptors defined here:
__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)