traci._edge

  1# -*- coding: utf-8 -*-
  2# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
  3# Copyright (C) 2011-2026 German Aerospace Center (DLR) and others.
  4# This program and the accompanying materials are made available under the
  5# terms of the Eclipse Public License 2.0 which is available at
  6# https://www.eclipse.org/legal/epl-2.0/
  7# This Source Code may also be made available under the following Secondary
  8# Licenses when the conditions for such availability set forth in the Eclipse
  9# Public License 2.0 are satisfied: GNU General Public License, version 2
 10# or later which is available at
 11# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
 12# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
 13
 14# @file    _edge.py
 15# @author  Michael Behrisch
 16# @author  Jakob Erdmann
 17# @date    2011-03-17
 18
 19from __future__ import absolute_import
 20from . import constants as tc
 21from .domain import Domain
 22from .exceptions import TraCIException
 23
 24
 25class EdgeDomain(Domain):
 26
 27    def __init__(self):
 28        Domain.__init__(self, "edge", tc.CMD_GET_EDGE_VARIABLE, tc.CMD_SET_EDGE_VARIABLE,
 29                        tc.CMD_SUBSCRIBE_EDGE_VARIABLE, tc.RESPONSE_SUBSCRIBE_EDGE_VARIABLE,
 30                        tc.CMD_SUBSCRIBE_EDGE_CONTEXT, tc.RESPONSE_SUBSCRIBE_EDGE_CONTEXT,
 31                        subscriptionDefault=(tc.LAST_STEP_VEHICLE_NUMBER,))
 32
 33    def getAdaptedTraveltime(self, edgeID, time):
 34        """getAdaptedTraveltime(string, double) -> double
 35
 36        Returns the travel time value (in s) used for (re-)routing
 37        which is valid on the edge at the given time.
 38        """
 39        return self._getUniversal(tc.VAR_EDGE_TRAVELTIME, edgeID, "d", time)
 40
 41    def getWaitingTime(self, edgeID):
 42        """getWaitingTime(string) -> double
 43        Returns the sum of the waiting time of all vehicles currently on
 44        that edge (see traci.vehicle.getWaitingTime).
 45        """
 46        return self._getUniversal(tc.VAR_WAITING_TIME, edgeID)
 47
 48    def getEffort(self, edgeID, time):
 49        """getEffort(string, double) -> double
 50
 51        Returns the effort value used for (re-)routing
 52        which is valid on the edge at the given time.
 53        """
 54        return self._getUniversal(tc.VAR_EDGE_EFFORT, edgeID, "d", time)
 55
 56    def getCO2Emission(self, edgeID):
 57        """getCO2Emission(string) -> double
 58
 59        Returns the CO2 emission in mg for the last time step on the given edge.
 60        """
 61        return self._getUniversal(tc.VAR_CO2EMISSION, edgeID)
 62
 63    def getCOEmission(self, edgeID):
 64        """getCOEmission(string) -> double
 65
 66        Returns the CO emission in mg for the last time step on the given edge.
 67        """
 68        return self._getUniversal(tc.VAR_COEMISSION, edgeID)
 69
 70    def getHCEmission(self, edgeID):
 71        """getHCEmission(string) -> double
 72
 73        Returns the HC emission in mg for the last time step on the given edge.
 74        """
 75        return self._getUniversal(tc.VAR_HCEMISSION, edgeID)
 76
 77    def getPMxEmission(self, edgeID):
 78        """getPMxEmission(string) -> double
 79
 80        Returns the particular matter emission in mg for the last time step on the given edge.
 81        """
 82        return self._getUniversal(tc.VAR_PMXEMISSION, edgeID)
 83
 84    def getNOxEmission(self, edgeID):
 85        """getNOxEmission(string) -> double
 86
 87        Returns the NOx emission in mg for the last time step on the given edge.
 88        """
 89        return self._getUniversal(tc.VAR_NOXEMISSION, edgeID)
 90
 91    def getFuelConsumption(self, edgeID):
 92        """getFuelConsumption(string) -> double
 93
 94        Returns the fuel consumption in ml for the last time step on the given edge.
 95        """
 96        return self._getUniversal(tc.VAR_FUELCONSUMPTION, edgeID)
 97
 98    def getNoiseEmission(self, edgeID):
 99        """getNoiseEmission(string) -> double
100
101        Returns the noise emission in db for the last time step on the given edge.
102        """
103        return self._getUniversal(tc.VAR_NOISEEMISSION, edgeID)
104
105    def getElectricityConsumption(self, edgeID):
106        """getElectricityConsumption(string) -> double
107
108        Returns the electricity consumption in ml for the last time step.
109        """
110        return self._getUniversal(tc.VAR_ELECTRICITYCONSUMPTION, edgeID)
111
112    def getLastStepMeanSpeed(self, edgeID):
113        """getLastStepMeanSpeed(string) -> double
114
115        Returns the average speed in m/s for the last time step on the given edge.
116        """
117        return self._getUniversal(tc.LAST_STEP_MEAN_SPEED, edgeID)
118
119    def getMeanFriction(self, edgeID):
120        """getMeanFriction(string) -> double
121
122        Returns the average friction [0..1] for the last time step over all lanes on the given edge.
123        """
124        return self._getUniversal(tc.VAR_FRICTION, edgeID)
125
126    def getLastStepOccupancy(self, edgeID):
127        """getLastStepOccupancy(string) -> double
128
129        Returns the net occupancy (excluding inter-vehicle gaps) in % for the last time step on the given edge.
130        """
131        return self._getUniversal(tc.LAST_STEP_OCCUPANCY, edgeID)
132
133    def getLastStepLength(self, edgeID):
134        """getLastStepLength(string) -> double
135
136        Returns the mean vehicle length in m for the last time step on the given edge.
137        """
138        return self._getUniversal(tc.LAST_STEP_LENGTH, edgeID)
139
140    def getLaneNumber(self, edgeID):
141        """getLaneNumber(string) -> int
142
143        Returns the number of lanes of this edge
144        """
145        return self._getUniversal(tc.VAR_LANE_INDEX, edgeID)
146
147    def getStreetName(self, edgeID):
148        """getStreetName(string) -> string
149
150        Returns the street name of this edge
151        """
152        return self._getUniversal(tc.VAR_NAME, edgeID)
153
154    def getTraveltime(self, edgeID):
155        """getTraveltime(string) -> double
156
157        Returns the estimated travel time in s for the last time step on the given edge.
158        """
159        return self._getUniversal(tc.VAR_CURRENT_TRAVELTIME, edgeID)
160
161    def getLastStepVehicleNumber(self, edgeID):
162        """getLastStepVehicleNumber(string) -> integer
163
164        Returns the total number of vehicles for the last time step on the given edge.
165        """
166        return self._getUniversal(tc.LAST_STEP_VEHICLE_NUMBER, edgeID)
167
168    def getLastStepHaltingNumber(self, edgeID):
169        """getLastStepHaltingNumber(string) -> integer
170
171        Returns the total number of halting vehicles for the last time step on the given edge.
172        A speed of less than 0.1 m/s is considered a halt.
173        """
174        return self._getUniversal(tc.LAST_STEP_VEHICLE_HALTING_NUMBER, edgeID)
175
176    def getLastStepVehicleIDs(self, edgeID):
177        """getLastStepVehicleIDs(string) -> tuple(string)
178
179        Returns the ids of the vehicles for the last time step on the given edge.
180        """
181        return self._getUniversal(tc.LAST_STEP_VEHICLE_ID_LIST, edgeID)
182
183    def getLastStepPersonIDs(self, edgeID):
184        """getLastStepPersonIDs(string) -> tuple(string)
185
186        Returns the ids of the persons on the given edge during the last time step.
187        """
188        return self._getUniversal(tc.LAST_STEP_PERSON_ID_LIST, edgeID)
189
190    def getPendingVehicles(self, edgeID):
191        """getPendingVehicles(string) -> tuple(string)
192        Returns a tuple of all vehicle ids waiting for insertion on this edge (with depart delay)
193        """
194        return self._getUniversal(tc.VAR_PENDING_VEHICLES, edgeID)
195
196    def getAngle(self, edgeID, relativePosition=tc.INVALID_DOUBLE_VALUE):
197        """getAngle(string, double) -> double
198        Returns the heading of the straight line segment formed by the first lane of the edge at the given position.
199        If the given position equals TraCI constant INVALID_DOUBLE_VALUE, it returns the total angle
200        formed by the edge, from its start point to its end point. If the edge doesn't have any lanes,
201        then INVALID_DOUBLE_VALUE is returned.
202        """
203        return self._getUniversal(tc.VAR_ANGLE, edgeID, "d", relativePosition)
204
205    def getFromJunction(self, edgeID):
206        """getFromJunction(string) -> string
207
208        Returns the id of the junction at the start of this edge
209        """
210        return self._getUniversal(tc.FROM_JUNCTION, edgeID)
211
212    def getToJunction(self, edgeID):
213        """getToJunction(string) -> string
214
215        Returns the id of the junction at the end of this edge
216        """
217        return self._getUniversal(tc.TO_JUNCTION, edgeID)
218
219    def getBidiEdge(self, edgeID):
220        """getBidiEdge(string) -> string
221
222        Returns the id of the bidi edge or ""
223        """
224        return self._getUniversal(tc.VAR_BIDI, edgeID)
225
226    def adaptTraveltime(self, edgeID, time, begin=None, end=None):
227        """adaptTraveltime(string, double, double, double) -> None
228
229        Adapt the travel time value (in s) used for (re-)routing for the given edge.
230
231        When setting begin time and end time (in seconds), the changes only
232        apply to that time range. Otherwise they apply all the time
233        """
234        if begin is None and end is None:
235            self._setCmd(tc.VAR_EDGE_TRAVELTIME, edgeID, "td", 1, time)
236        elif begin is not None and end is not None:
237            self._setCmd(tc.VAR_EDGE_TRAVELTIME, edgeID, "tddd", 3, begin, end, time)
238        else:
239            raise TraCIException("Both, begin time and end time must be specified")
240
241    def setEffort(self, edgeID, effort, begin=None, end=None):
242        """setEffort(string, double, double, double) -> None
243
244        Adapt the effort value used for (re-)routing for the given edge.
245
246        When setting begin time and end time (in seconds), the changes only
247        apply to that time range. Otherwise they apply all the time.
248        """
249        if begin is None and end is None:
250            self._setCmd(tc.VAR_EDGE_EFFORT, edgeID, "td", 1, effort)
251        elif begin is not None and end is not None:
252            self._setCmd(tc.VAR_EDGE_EFFORT, edgeID, "tddd", 3, begin, end, effort)
253        else:
254            raise TraCIException("Both, begin time and end time must be specified")
255
256    def setAllowed(self, edgeID, allowedClasses):
257        """setAllowed(string, list) -> None
258
259        Sets a list of allowed vehicle classes. Setting an empty list means all vehicles are allowed.
260        """
261        if isinstance(allowedClasses, str):
262            allowedClasses = [allowedClasses]
263        self._setCmd(tc.LANE_ALLOWED, edgeID, "l", allowedClasses)
264
265    def setDisallowed(self, edgeID, disallowedClasses):
266        """setDisallowed(string, list) -> None
267
268        Sets a list of disallowed vehicle classes.
269        """
270        if isinstance(disallowedClasses, str):
271            disallowedClasses = [disallowedClasses]
272        self._setCmd(tc.LANE_DISALLOWED, edgeID, "l", disallowedClasses)
273
274    def setMaxSpeed(self, edgeID, speed):
275        """setMaxSpeed(string, double) -> None
276
277        Set a new maximum speed (in m/s) for all lanes of the edge.
278        """
279        self._setCmd(tc.VAR_MAXSPEED, edgeID, "d", speed)
280
281    def setFriction(self, edgeID, friction):
282        """setFriction(string, double) -> None
283
284        Set a new friction value [0..1] for all lanes of the edge.
285        """
286        self._setCmd(tc.VAR_FRICTION, edgeID, "d", friction)
class EdgeDomain(traci.domain.Domain):
 26class EdgeDomain(Domain):
 27
 28    def __init__(self):
 29        Domain.__init__(self, "edge", tc.CMD_GET_EDGE_VARIABLE, tc.CMD_SET_EDGE_VARIABLE,
 30                        tc.CMD_SUBSCRIBE_EDGE_VARIABLE, tc.RESPONSE_SUBSCRIBE_EDGE_VARIABLE,
 31                        tc.CMD_SUBSCRIBE_EDGE_CONTEXT, tc.RESPONSE_SUBSCRIBE_EDGE_CONTEXT,
 32                        subscriptionDefault=(tc.LAST_STEP_VEHICLE_NUMBER,))
 33
 34    def getAdaptedTraveltime(self, edgeID, time):
 35        """getAdaptedTraveltime(string, double) -> double
 36
 37        Returns the travel time value (in s) used for (re-)routing
 38        which is valid on the edge at the given time.
 39        """
 40        return self._getUniversal(tc.VAR_EDGE_TRAVELTIME, edgeID, "d", time)
 41
 42    def getWaitingTime(self, edgeID):
 43        """getWaitingTime(string) -> double
 44        Returns the sum of the waiting time of all vehicles currently on
 45        that edge (see traci.vehicle.getWaitingTime).
 46        """
 47        return self._getUniversal(tc.VAR_WAITING_TIME, edgeID)
 48
 49    def getEffort(self, edgeID, time):
 50        """getEffort(string, double) -> double
 51
 52        Returns the effort value used for (re-)routing
 53        which is valid on the edge at the given time.
 54        """
 55        return self._getUniversal(tc.VAR_EDGE_EFFORT, edgeID, "d", time)
 56
 57    def getCO2Emission(self, edgeID):
 58        """getCO2Emission(string) -> double
 59
 60        Returns the CO2 emission in mg for the last time step on the given edge.
 61        """
 62        return self._getUniversal(tc.VAR_CO2EMISSION, edgeID)
 63
 64    def getCOEmission(self, edgeID):
 65        """getCOEmission(string) -> double
 66
 67        Returns the CO emission in mg for the last time step on the given edge.
 68        """
 69        return self._getUniversal(tc.VAR_COEMISSION, edgeID)
 70
 71    def getHCEmission(self, edgeID):
 72        """getHCEmission(string) -> double
 73
 74        Returns the HC emission in mg for the last time step on the given edge.
 75        """
 76        return self._getUniversal(tc.VAR_HCEMISSION, edgeID)
 77
 78    def getPMxEmission(self, edgeID):
 79        """getPMxEmission(string) -> double
 80
 81        Returns the particular matter emission in mg for the last time step on the given edge.
 82        """
 83        return self._getUniversal(tc.VAR_PMXEMISSION, edgeID)
 84
 85    def getNOxEmission(self, edgeID):
 86        """getNOxEmission(string) -> double
 87
 88        Returns the NOx emission in mg for the last time step on the given edge.
 89        """
 90        return self._getUniversal(tc.VAR_NOXEMISSION, edgeID)
 91
 92    def getFuelConsumption(self, edgeID):
 93        """getFuelConsumption(string) -> double
 94
 95        Returns the fuel consumption in ml for the last time step on the given edge.
 96        """
 97        return self._getUniversal(tc.VAR_FUELCONSUMPTION, edgeID)
 98
 99    def getNoiseEmission(self, edgeID):
100        """getNoiseEmission(string) -> double
101
102        Returns the noise emission in db for the last time step on the given edge.
103        """
104        return self._getUniversal(tc.VAR_NOISEEMISSION, edgeID)
105
106    def getElectricityConsumption(self, edgeID):
107        """getElectricityConsumption(string) -> double
108
109        Returns the electricity consumption in ml for the last time step.
110        """
111        return self._getUniversal(tc.VAR_ELECTRICITYCONSUMPTION, edgeID)
112
113    def getLastStepMeanSpeed(self, edgeID):
114        """getLastStepMeanSpeed(string) -> double
115
116        Returns the average speed in m/s for the last time step on the given edge.
117        """
118        return self._getUniversal(tc.LAST_STEP_MEAN_SPEED, edgeID)
119
120    def getMeanFriction(self, edgeID):
121        """getMeanFriction(string) -> double
122
123        Returns the average friction [0..1] for the last time step over all lanes on the given edge.
124        """
125        return self._getUniversal(tc.VAR_FRICTION, edgeID)
126
127    def getLastStepOccupancy(self, edgeID):
128        """getLastStepOccupancy(string) -> double
129
130        Returns the net occupancy (excluding inter-vehicle gaps) in % for the last time step on the given edge.
131        """
132        return self._getUniversal(tc.LAST_STEP_OCCUPANCY, edgeID)
133
134    def getLastStepLength(self, edgeID):
135        """getLastStepLength(string) -> double
136
137        Returns the mean vehicle length in m for the last time step on the given edge.
138        """
139        return self._getUniversal(tc.LAST_STEP_LENGTH, edgeID)
140
141    def getLaneNumber(self, edgeID):
142        """getLaneNumber(string) -> int
143
144        Returns the number of lanes of this edge
145        """
146        return self._getUniversal(tc.VAR_LANE_INDEX, edgeID)
147
148    def getStreetName(self, edgeID):
149        """getStreetName(string) -> string
150
151        Returns the street name of this edge
152        """
153        return self._getUniversal(tc.VAR_NAME, edgeID)
154
155    def getTraveltime(self, edgeID):
156        """getTraveltime(string) -> double
157
158        Returns the estimated travel time in s for the last time step on the given edge.
159        """
160        return self._getUniversal(tc.VAR_CURRENT_TRAVELTIME, edgeID)
161
162    def getLastStepVehicleNumber(self, edgeID):
163        """getLastStepVehicleNumber(string) -> integer
164
165        Returns the total number of vehicles for the last time step on the given edge.
166        """
167        return self._getUniversal(tc.LAST_STEP_VEHICLE_NUMBER, edgeID)
168
169    def getLastStepHaltingNumber(self, edgeID):
170        """getLastStepHaltingNumber(string) -> integer
171
172        Returns the total number of halting vehicles for the last time step on the given edge.
173        A speed of less than 0.1 m/s is considered a halt.
174        """
175        return self._getUniversal(tc.LAST_STEP_VEHICLE_HALTING_NUMBER, edgeID)
176
177    def getLastStepVehicleIDs(self, edgeID):
178        """getLastStepVehicleIDs(string) -> tuple(string)
179
180        Returns the ids of the vehicles for the last time step on the given edge.
181        """
182        return self._getUniversal(tc.LAST_STEP_VEHICLE_ID_LIST, edgeID)
183
184    def getLastStepPersonIDs(self, edgeID):
185        """getLastStepPersonIDs(string) -> tuple(string)
186
187        Returns the ids of the persons on the given edge during the last time step.
188        """
189        return self._getUniversal(tc.LAST_STEP_PERSON_ID_LIST, edgeID)
190
191    def getPendingVehicles(self, edgeID):
192        """getPendingVehicles(string) -> tuple(string)
193        Returns a tuple of all vehicle ids waiting for insertion on this edge (with depart delay)
194        """
195        return self._getUniversal(tc.VAR_PENDING_VEHICLES, edgeID)
196
197    def getAngle(self, edgeID, relativePosition=tc.INVALID_DOUBLE_VALUE):
198        """getAngle(string, double) -> double
199        Returns the heading of the straight line segment formed by the first lane of the edge at the given position.
200        If the given position equals TraCI constant INVALID_DOUBLE_VALUE, it returns the total angle
201        formed by the edge, from its start point to its end point. If the edge doesn't have any lanes,
202        then INVALID_DOUBLE_VALUE is returned.
203        """
204        return self._getUniversal(tc.VAR_ANGLE, edgeID, "d", relativePosition)
205
206    def getFromJunction(self, edgeID):
207        """getFromJunction(string) -> string
208
209        Returns the id of the junction at the start of this edge
210        """
211        return self._getUniversal(tc.FROM_JUNCTION, edgeID)
212
213    def getToJunction(self, edgeID):
214        """getToJunction(string) -> string
215
216        Returns the id of the junction at the end of this edge
217        """
218        return self._getUniversal(tc.TO_JUNCTION, edgeID)
219
220    def getBidiEdge(self, edgeID):
221        """getBidiEdge(string) -> string
222
223        Returns the id of the bidi edge or ""
224        """
225        return self._getUniversal(tc.VAR_BIDI, edgeID)
226
227    def adaptTraveltime(self, edgeID, time, begin=None, end=None):
228        """adaptTraveltime(string, double, double, double) -> None
229
230        Adapt the travel time value (in s) used for (re-)routing for the given edge.
231
232        When setting begin time and end time (in seconds), the changes only
233        apply to that time range. Otherwise they apply all the time
234        """
235        if begin is None and end is None:
236            self._setCmd(tc.VAR_EDGE_TRAVELTIME, edgeID, "td", 1, time)
237        elif begin is not None and end is not None:
238            self._setCmd(tc.VAR_EDGE_TRAVELTIME, edgeID, "tddd", 3, begin, end, time)
239        else:
240            raise TraCIException("Both, begin time and end time must be specified")
241
242    def setEffort(self, edgeID, effort, begin=None, end=None):
243        """setEffort(string, double, double, double) -> None
244
245        Adapt the effort value used for (re-)routing for the given edge.
246
247        When setting begin time and end time (in seconds), the changes only
248        apply to that time range. Otherwise they apply all the time.
249        """
250        if begin is None and end is None:
251            self._setCmd(tc.VAR_EDGE_EFFORT, edgeID, "td", 1, effort)
252        elif begin is not None and end is not None:
253            self._setCmd(tc.VAR_EDGE_EFFORT, edgeID, "tddd", 3, begin, end, effort)
254        else:
255            raise TraCIException("Both, begin time and end time must be specified")
256
257    def setAllowed(self, edgeID, allowedClasses):
258        """setAllowed(string, list) -> None
259
260        Sets a list of allowed vehicle classes. Setting an empty list means all vehicles are allowed.
261        """
262        if isinstance(allowedClasses, str):
263            allowedClasses = [allowedClasses]
264        self._setCmd(tc.LANE_ALLOWED, edgeID, "l", allowedClasses)
265
266    def setDisallowed(self, edgeID, disallowedClasses):
267        """setDisallowed(string, list) -> None
268
269        Sets a list of disallowed vehicle classes.
270        """
271        if isinstance(disallowedClasses, str):
272            disallowedClasses = [disallowedClasses]
273        self._setCmd(tc.LANE_DISALLOWED, edgeID, "l", disallowedClasses)
274
275    def setMaxSpeed(self, edgeID, speed):
276        """setMaxSpeed(string, double) -> None
277
278        Set a new maximum speed (in m/s) for all lanes of the edge.
279        """
280        self._setCmd(tc.VAR_MAXSPEED, edgeID, "d", speed)
281
282    def setFriction(self, edgeID, friction):
283        """setFriction(string, double) -> None
284
285        Set a new friction value [0..1] for all lanes of the edge.
286        """
287        self._setCmd(tc.VAR_FRICTION, edgeID, "d", friction)
def getAdaptedTraveltime(self, edgeID, time):
34    def getAdaptedTraveltime(self, edgeID, time):
35        """getAdaptedTraveltime(string, double) -> double
36
37        Returns the travel time value (in s) used for (re-)routing
38        which is valid on the edge at the given time.
39        """
40        return self._getUniversal(tc.VAR_EDGE_TRAVELTIME, edgeID, "d", time)

getAdaptedTraveltime(string, double) -> double

Returns the travel time value (in s) used for (re-)routing which is valid on the edge at the given time.

def getWaitingTime(self, edgeID):
42    def getWaitingTime(self, edgeID):
43        """getWaitingTime(string) -> double
44        Returns the sum of the waiting time of all vehicles currently on
45        that edge (see traci.vehicle.getWaitingTime).
46        """
47        return self._getUniversal(tc.VAR_WAITING_TIME, edgeID)

getWaitingTime(string) -> double Returns the sum of the waiting time of all vehicles currently on that edge (see traci.vehicle.getWaitingTime).

def getEffort(self, edgeID, time):
49    def getEffort(self, edgeID, time):
50        """getEffort(string, double) -> double
51
52        Returns the effort value used for (re-)routing
53        which is valid on the edge at the given time.
54        """
55        return self._getUniversal(tc.VAR_EDGE_EFFORT, edgeID, "d", time)

getEffort(string, double) -> double

Returns the effort value used for (re-)routing which is valid on the edge at the given time.

def getCO2Emission(self, edgeID):
57    def getCO2Emission(self, edgeID):
58        """getCO2Emission(string) -> double
59
60        Returns the CO2 emission in mg for the last time step on the given edge.
61        """
62        return self._getUniversal(tc.VAR_CO2EMISSION, edgeID)

getCO2Emission(string) -> double

Returns the CO2 emission in mg for the last time step on the given edge.

def getCOEmission(self, edgeID):
64    def getCOEmission(self, edgeID):
65        """getCOEmission(string) -> double
66
67        Returns the CO emission in mg for the last time step on the given edge.
68        """
69        return self._getUniversal(tc.VAR_COEMISSION, edgeID)

getCOEmission(string) -> double

Returns the CO emission in mg for the last time step on the given edge.

def getHCEmission(self, edgeID):
71    def getHCEmission(self, edgeID):
72        """getHCEmission(string) -> double
73
74        Returns the HC emission in mg for the last time step on the given edge.
75        """
76        return self._getUniversal(tc.VAR_HCEMISSION, edgeID)

getHCEmission(string) -> double

Returns the HC emission in mg for the last time step on the given edge.

def getPMxEmission(self, edgeID):
78    def getPMxEmission(self, edgeID):
79        """getPMxEmission(string) -> double
80
81        Returns the particular matter emission in mg for the last time step on the given edge.
82        """
83        return self._getUniversal(tc.VAR_PMXEMISSION, edgeID)

getPMxEmission(string) -> double

Returns the particular matter emission in mg for the last time step on the given edge.

def getNOxEmission(self, edgeID):
85    def getNOxEmission(self, edgeID):
86        """getNOxEmission(string) -> double
87
88        Returns the NOx emission in mg for the last time step on the given edge.
89        """
90        return self._getUniversal(tc.VAR_NOXEMISSION, edgeID)

getNOxEmission(string) -> double

Returns the NOx emission in mg for the last time step on the given edge.

def getFuelConsumption(self, edgeID):
92    def getFuelConsumption(self, edgeID):
93        """getFuelConsumption(string) -> double
94
95        Returns the fuel consumption in ml for the last time step on the given edge.
96        """
97        return self._getUniversal(tc.VAR_FUELCONSUMPTION, edgeID)

getFuelConsumption(string) -> double

Returns the fuel consumption in ml for the last time step on the given edge.

def getNoiseEmission(self, edgeID):
 99    def getNoiseEmission(self, edgeID):
100        """getNoiseEmission(string) -> double
101
102        Returns the noise emission in db for the last time step on the given edge.
103        """
104        return self._getUniversal(tc.VAR_NOISEEMISSION, edgeID)

getNoiseEmission(string) -> double

Returns the noise emission in db for the last time step on the given edge.

def getElectricityConsumption(self, edgeID):
106    def getElectricityConsumption(self, edgeID):
107        """getElectricityConsumption(string) -> double
108
109        Returns the electricity consumption in ml for the last time step.
110        """
111        return self._getUniversal(tc.VAR_ELECTRICITYCONSUMPTION, edgeID)

getElectricityConsumption(string) -> double

Returns the electricity consumption in ml for the last time step.

def getLastStepMeanSpeed(self, edgeID):
113    def getLastStepMeanSpeed(self, edgeID):
114        """getLastStepMeanSpeed(string) -> double
115
116        Returns the average speed in m/s for the last time step on the given edge.
117        """
118        return self._getUniversal(tc.LAST_STEP_MEAN_SPEED, edgeID)

getLastStepMeanSpeed(string) -> double

Returns the average speed in m/s for the last time step on the given edge.

def getMeanFriction(self, edgeID):
120    def getMeanFriction(self, edgeID):
121        """getMeanFriction(string) -> double
122
123        Returns the average friction [0..1] for the last time step over all lanes on the given edge.
124        """
125        return self._getUniversal(tc.VAR_FRICTION, edgeID)

getMeanFriction(string) -> double

Returns the average friction [0..1] for the last time step over all lanes on the given edge.

def getLastStepOccupancy(self, edgeID):
127    def getLastStepOccupancy(self, edgeID):
128        """getLastStepOccupancy(string) -> double
129
130        Returns the net occupancy (excluding inter-vehicle gaps) in % for the last time step on the given edge.
131        """
132        return self._getUniversal(tc.LAST_STEP_OCCUPANCY, edgeID)

getLastStepOccupancy(string) -> double

Returns the net occupancy (excluding inter-vehicle gaps) in % for the last time step on the given edge.

def getLastStepLength(self, edgeID):
134    def getLastStepLength(self, edgeID):
135        """getLastStepLength(string) -> double
136
137        Returns the mean vehicle length in m for the last time step on the given edge.
138        """
139        return self._getUniversal(tc.LAST_STEP_LENGTH, edgeID)

getLastStepLength(string) -> double

Returns the mean vehicle length in m for the last time step on the given edge.

def getLaneNumber(self, edgeID):
141    def getLaneNumber(self, edgeID):
142        """getLaneNumber(string) -> int
143
144        Returns the number of lanes of this edge
145        """
146        return self._getUniversal(tc.VAR_LANE_INDEX, edgeID)

getLaneNumber(string) -> int

Returns the number of lanes of this edge

def getStreetName(self, edgeID):
148    def getStreetName(self, edgeID):
149        """getStreetName(string) -> string
150
151        Returns the street name of this edge
152        """
153        return self._getUniversal(tc.VAR_NAME, edgeID)

getStreetName(string) -> string

Returns the street name of this edge

def getTraveltime(self, edgeID):
155    def getTraveltime(self, edgeID):
156        """getTraveltime(string) -> double
157
158        Returns the estimated travel time in s for the last time step on the given edge.
159        """
160        return self._getUniversal(tc.VAR_CURRENT_TRAVELTIME, edgeID)

getTraveltime(string) -> double

Returns the estimated travel time in s for the last time step on the given edge.

def getLastStepVehicleNumber(self, edgeID):
162    def getLastStepVehicleNumber(self, edgeID):
163        """getLastStepVehicleNumber(string) -> integer
164
165        Returns the total number of vehicles for the last time step on the given edge.
166        """
167        return self._getUniversal(tc.LAST_STEP_VEHICLE_NUMBER, edgeID)

getLastStepVehicleNumber(string) -> integer

Returns the total number of vehicles for the last time step on the given edge.

def getLastStepHaltingNumber(self, edgeID):
169    def getLastStepHaltingNumber(self, edgeID):
170        """getLastStepHaltingNumber(string) -> integer
171
172        Returns the total number of halting vehicles for the last time step on the given edge.
173        A speed of less than 0.1 m/s is considered a halt.
174        """
175        return self._getUniversal(tc.LAST_STEP_VEHICLE_HALTING_NUMBER, edgeID)

getLastStepHaltingNumber(string) -> integer

Returns the total number of halting vehicles for the last time step on the given edge. A speed of less than 0.1 m/s is considered a halt.

def getLastStepVehicleIDs(self, edgeID):
177    def getLastStepVehicleIDs(self, edgeID):
178        """getLastStepVehicleIDs(string) -> tuple(string)
179
180        Returns the ids of the vehicles for the last time step on the given edge.
181        """
182        return self._getUniversal(tc.LAST_STEP_VEHICLE_ID_LIST, edgeID)

getLastStepVehicleIDs(string) -> tuple(string)

Returns the ids of the vehicles for the last time step on the given edge.

def getLastStepPersonIDs(self, edgeID):
184    def getLastStepPersonIDs(self, edgeID):
185        """getLastStepPersonIDs(string) -> tuple(string)
186
187        Returns the ids of the persons on the given edge during the last time step.
188        """
189        return self._getUniversal(tc.LAST_STEP_PERSON_ID_LIST, edgeID)

getLastStepPersonIDs(string) -> tuple(string)

Returns the ids of the persons on the given edge during the last time step.

def getPendingVehicles(self, edgeID):
191    def getPendingVehicles(self, edgeID):
192        """getPendingVehicles(string) -> tuple(string)
193        Returns a tuple of all vehicle ids waiting for insertion on this edge (with depart delay)
194        """
195        return self._getUniversal(tc.VAR_PENDING_VEHICLES, edgeID)

getPendingVehicles(string) -> tuple(string) Returns a tuple of all vehicle ids waiting for insertion on this edge (with depart delay)

def getAngle(self, edgeID, relativePosition=-1073741824.0):
197    def getAngle(self, edgeID, relativePosition=tc.INVALID_DOUBLE_VALUE):
198        """getAngle(string, double) -> double
199        Returns the heading of the straight line segment formed by the first lane of the edge at the given position.
200        If the given position equals TraCI constant INVALID_DOUBLE_VALUE, it returns the total angle
201        formed by the edge, from its start point to its end point. If the edge doesn't have any lanes,
202        then INVALID_DOUBLE_VALUE is returned.
203        """
204        return self._getUniversal(tc.VAR_ANGLE, edgeID, "d", relativePosition)

getAngle(string, double) -> double Returns the heading of the straight line segment formed by the first lane of the edge at the given position. If the given position equals TraCI constant INVALID_DOUBLE_VALUE, it returns the total angle formed by the edge, from its start point to its end point. If the edge doesn't have any lanes, then INVALID_DOUBLE_VALUE is returned.

def getFromJunction(self, edgeID):
206    def getFromJunction(self, edgeID):
207        """getFromJunction(string) -> string
208
209        Returns the id of the junction at the start of this edge
210        """
211        return self._getUniversal(tc.FROM_JUNCTION, edgeID)

getFromJunction(string) -> string

Returns the id of the junction at the start of this edge

def getToJunction(self, edgeID):
213    def getToJunction(self, edgeID):
214        """getToJunction(string) -> string
215
216        Returns the id of the junction at the end of this edge
217        """
218        return self._getUniversal(tc.TO_JUNCTION, edgeID)

getToJunction(string) -> string

Returns the id of the junction at the end of this edge

def getBidiEdge(self, edgeID):
220    def getBidiEdge(self, edgeID):
221        """getBidiEdge(string) -> string
222
223        Returns the id of the bidi edge or ""
224        """
225        return self._getUniversal(tc.VAR_BIDI, edgeID)

getBidiEdge(string) -> string

Returns the id of the bidi edge or ""

def adaptTraveltime(self, edgeID, time, begin=None, end=None):
227    def adaptTraveltime(self, edgeID, time, begin=None, end=None):
228        """adaptTraveltime(string, double, double, double) -> None
229
230        Adapt the travel time value (in s) used for (re-)routing for the given edge.
231
232        When setting begin time and end time (in seconds), the changes only
233        apply to that time range. Otherwise they apply all the time
234        """
235        if begin is None and end is None:
236            self._setCmd(tc.VAR_EDGE_TRAVELTIME, edgeID, "td", 1, time)
237        elif begin is not None and end is not None:
238            self._setCmd(tc.VAR_EDGE_TRAVELTIME, edgeID, "tddd", 3, begin, end, time)
239        else:
240            raise TraCIException("Both, begin time and end time must be specified")

adaptTraveltime(string, double, double, double) -> None

Adapt the travel time value (in s) used for (re-)routing for the given edge.

When setting begin time and end time (in seconds), the changes only apply to that time range. Otherwise they apply all the time

def setEffort(self, edgeID, effort, begin=None, end=None):
242    def setEffort(self, edgeID, effort, begin=None, end=None):
243        """setEffort(string, double, double, double) -> None
244
245        Adapt the effort value used for (re-)routing for the given edge.
246
247        When setting begin time and end time (in seconds), the changes only
248        apply to that time range. Otherwise they apply all the time.
249        """
250        if begin is None and end is None:
251            self._setCmd(tc.VAR_EDGE_EFFORT, edgeID, "td", 1, effort)
252        elif begin is not None and end is not None:
253            self._setCmd(tc.VAR_EDGE_EFFORT, edgeID, "tddd", 3, begin, end, effort)
254        else:
255            raise TraCIException("Both, begin time and end time must be specified")

setEffort(string, double, double, double) -> None

Adapt the effort value used for (re-)routing for the given edge.

When setting begin time and end time (in seconds), the changes only apply to that time range. Otherwise they apply all the time.

def setAllowed(self, edgeID, allowedClasses):
257    def setAllowed(self, edgeID, allowedClasses):
258        """setAllowed(string, list) -> None
259
260        Sets a list of allowed vehicle classes. Setting an empty list means all vehicles are allowed.
261        """
262        if isinstance(allowedClasses, str):
263            allowedClasses = [allowedClasses]
264        self._setCmd(tc.LANE_ALLOWED, edgeID, "l", allowedClasses)

setAllowed(string, list) -> None

Sets a list of allowed vehicle classes. Setting an empty list means all vehicles are allowed.

def setDisallowed(self, edgeID, disallowedClasses):
266    def setDisallowed(self, edgeID, disallowedClasses):
267        """setDisallowed(string, list) -> None
268
269        Sets a list of disallowed vehicle classes.
270        """
271        if isinstance(disallowedClasses, str):
272            disallowedClasses = [disallowedClasses]
273        self._setCmd(tc.LANE_DISALLOWED, edgeID, "l", disallowedClasses)

setDisallowed(string, list) -> None

Sets a list of disallowed vehicle classes.

def setMaxSpeed(self, edgeID, speed):
275    def setMaxSpeed(self, edgeID, speed):
276        """setMaxSpeed(string, double) -> None
277
278        Set a new maximum speed (in m/s) for all lanes of the edge.
279        """
280        self._setCmd(tc.VAR_MAXSPEED, edgeID, "d", speed)

setMaxSpeed(string, double) -> None

Set a new maximum speed (in m/s) for all lanes of the edge.

def setFriction(self, edgeID, friction):
282    def setFriction(self, edgeID, friction):
283        """setFriction(string, double) -> None
284
285        Set a new friction value [0..1] for all lanes of the edge.
286        """
287        self._setCmd(tc.VAR_FRICTION, edgeID, "d", friction)

setFriction(string, double) -> None

Set a new friction value [0..1] for all lanes of the edge.