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 getMaxSpeed(self, edgeID):
127        """getMaxSpeed(string) -> double
128
129        Returns the maximum speed (in m/s) of the first lane of the edge.
130        """
131        return self._getUniversal(tc.VAR_MAXSPEED, edgeID)
132
133    def getLastStepOccupancy(self, edgeID):
134        """getLastStepOccupancy(string) -> double
135
136        Returns the net occupancy (excluding inter-vehicle gaps) in % for the last time step on the given edge.
137        """
138        return self._getUniversal(tc.LAST_STEP_OCCUPANCY, edgeID)
139
140    def getLastStepLength(self, edgeID):
141        """getLastStepLength(string) -> double
142
143        Returns the mean vehicle length in m for the last time step on the given edge.
144        """
145        return self._getUniversal(tc.LAST_STEP_LENGTH, edgeID)
146
147    def getLaneNumber(self, edgeID):
148        """getLaneNumber(string) -> int
149
150        Returns the number of lanes of this edge
151        """
152        return self._getUniversal(tc.VAR_LANE_INDEX, edgeID)
153
154    def getStreetName(self, edgeID):
155        """getStreetName(string) -> string
156
157        Returns the street name of this edge
158        """
159        return self._getUniversal(tc.VAR_NAME, edgeID)
160
161    def getTraveltime(self, edgeID):
162        """getTraveltime(string) -> double
163
164        Returns the estimated travel time in s for the last time step on the given edge.
165        """
166        return self._getUniversal(tc.VAR_CURRENT_TRAVELTIME, edgeID)
167
168    def getLastStepVehicleNumber(self, edgeID):
169        """getLastStepVehicleNumber(string) -> integer
170
171        Returns the total number of vehicles for the last time step on the given edge.
172        """
173        return self._getUniversal(tc.LAST_STEP_VEHICLE_NUMBER, edgeID)
174
175    def getLastStepHaltingNumber(self, edgeID):
176        """getLastStepHaltingNumber(string) -> integer
177
178        Returns the total number of halting vehicles for the last time step on the given edge.
179        A speed of less than 0.1 m/s is considered a halt.
180        """
181        return self._getUniversal(tc.LAST_STEP_VEHICLE_HALTING_NUMBER, edgeID)
182
183    def getLastStepVehicleIDs(self, edgeID):
184        """getLastStepVehicleIDs(string) -> tuple(string)
185
186        Returns the ids of the vehicles for the last time step on the given edge.
187        """
188        return self._getUniversal(tc.LAST_STEP_VEHICLE_ID_LIST, edgeID)
189
190    def getLastStepPersonIDs(self, edgeID):
191        """getLastStepPersonIDs(string) -> tuple(string)
192
193        Returns the ids of the persons on the given edge during the last time step.
194        """
195        return self._getUniversal(tc.LAST_STEP_PERSON_ID_LIST, edgeID)
196
197    def getPendingVehicles(self, edgeID):
198        """getPendingVehicles(string) -> tuple(string)
199        Returns a tuple of all vehicle ids waiting for insertion on this edge (with depart delay)
200        """
201        return self._getUniversal(tc.VAR_PENDING_VEHICLES, edgeID)
202
203    def getAngle(self, edgeID, relativePosition=tc.INVALID_DOUBLE_VALUE):
204        """getAngle(string, double) -> double
205        Returns the heading of the straight line segment formed by the first lane of the edge at the given position.
206        If the given position equals TraCI constant INVALID_DOUBLE_VALUE, it returns the total angle
207        formed by the edge, from its start point to its end point. If the edge doesn't have any lanes,
208        then INVALID_DOUBLE_VALUE is returned.
209        """
210        return self._getUniversal(tc.VAR_ANGLE, edgeID, "d", relativePosition)
211
212    def getFromJunction(self, edgeID):
213        """getFromJunction(string) -> string
214
215        Returns the id of the junction at the start of this edge
216        """
217        return self._getUniversal(tc.FROM_JUNCTION, edgeID)
218
219    def getToJunction(self, edgeID):
220        """getToJunction(string) -> string
221
222        Returns the id of the junction at the end of this edge
223        """
224        return self._getUniversal(tc.TO_JUNCTION, edgeID)
225
226    def getBidiEdge(self, edgeID):
227        """getBidiEdge(string) -> string
228
229        Returns the id of the bidi edge or ""
230        """
231        return self._getUniversal(tc.VAR_BIDI, edgeID)
232
233    def adaptTraveltime(self, edgeID, time, begin=None, end=None):
234        """adaptTraveltime(string, double, double, double) -> None
235
236        Adapt the travel time value (in s) used for (re-)routing for the given edge.
237
238        When setting begin time and end time (in seconds), the changes only
239        apply to that time range. Otherwise they apply all the time
240        """
241        if begin is None and end is None:
242            self._setCmd(tc.VAR_EDGE_TRAVELTIME, edgeID, "td", 1, time)
243        elif begin is not None and end is not None:
244            self._setCmd(tc.VAR_EDGE_TRAVELTIME, edgeID, "tddd", 3, begin, end, time)
245        else:
246            raise TraCIException("Both, begin time and end time must be specified")
247
248    def setEffort(self, edgeID, effort, begin=None, end=None):
249        """setEffort(string, double, double, double) -> None
250
251        Adapt the effort value used for (re-)routing for the given edge.
252
253        When setting begin time and end time (in seconds), the changes only
254        apply to that time range. Otherwise they apply all the time.
255        """
256        if begin is None and end is None:
257            self._setCmd(tc.VAR_EDGE_EFFORT, edgeID, "td", 1, effort)
258        elif begin is not None and end is not None:
259            self._setCmd(tc.VAR_EDGE_EFFORT, edgeID, "tddd", 3, begin, end, effort)
260        else:
261            raise TraCIException("Both, begin time and end time must be specified")
262
263    def setAllowed(self, edgeID, allowedClasses):
264        """setAllowed(string, list) -> None
265
266        Sets a list of allowed vehicle classes. Setting an empty list means all vehicles are allowed.
267        """
268        if isinstance(allowedClasses, str):
269            allowedClasses = [allowedClasses]
270        self._setCmd(tc.LANE_ALLOWED, edgeID, "l", allowedClasses)
271
272    def setDisallowed(self, edgeID, disallowedClasses):
273        """setDisallowed(string, list) -> None
274
275        Sets a list of disallowed vehicle classes.
276        """
277        if isinstance(disallowedClasses, str):
278            disallowedClasses = [disallowedClasses]
279        self._setCmd(tc.LANE_DISALLOWED, edgeID, "l", disallowedClasses)
280
281    def setMaxSpeed(self, edgeID, speed):
282        """setMaxSpeed(string, double) -> None
283
284        Set a new maximum speed (in m/s) for all lanes of the edge.
285        """
286        self._setCmd(tc.VAR_MAXSPEED, edgeID, "d", speed)
287
288    def setFriction(self, edgeID, friction):
289        """setFriction(string, double) -> None
290
291        Set a new friction value [0..1] for all lanes of the edge.
292        """
293        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 getMaxSpeed(self, edgeID):
128        """getMaxSpeed(string) -> double
129
130        Returns the maximum speed (in m/s) of the first lane of the edge.
131        """
132        return self._getUniversal(tc.VAR_MAXSPEED, edgeID)
133
134    def getLastStepOccupancy(self, edgeID):
135        """getLastStepOccupancy(string) -> double
136
137        Returns the net occupancy (excluding inter-vehicle gaps) in % for the last time step on the given edge.
138        """
139        return self._getUniversal(tc.LAST_STEP_OCCUPANCY, edgeID)
140
141    def getLastStepLength(self, edgeID):
142        """getLastStepLength(string) -> double
143
144        Returns the mean vehicle length in m for the last time step on the given edge.
145        """
146        return self._getUniversal(tc.LAST_STEP_LENGTH, edgeID)
147
148    def getLaneNumber(self, edgeID):
149        """getLaneNumber(string) -> int
150
151        Returns the number of lanes of this edge
152        """
153        return self._getUniversal(tc.VAR_LANE_INDEX, edgeID)
154
155    def getStreetName(self, edgeID):
156        """getStreetName(string) -> string
157
158        Returns the street name of this edge
159        """
160        return self._getUniversal(tc.VAR_NAME, edgeID)
161
162    def getTraveltime(self, edgeID):
163        """getTraveltime(string) -> double
164
165        Returns the estimated travel time in s for the last time step on the given edge.
166        """
167        return self._getUniversal(tc.VAR_CURRENT_TRAVELTIME, edgeID)
168
169    def getLastStepVehicleNumber(self, edgeID):
170        """getLastStepVehicleNumber(string) -> integer
171
172        Returns the total number of vehicles for the last time step on the given edge.
173        """
174        return self._getUniversal(tc.LAST_STEP_VEHICLE_NUMBER, edgeID)
175
176    def getLastStepHaltingNumber(self, edgeID):
177        """getLastStepHaltingNumber(string) -> integer
178
179        Returns the total number of halting vehicles for the last time step on the given edge.
180        A speed of less than 0.1 m/s is considered a halt.
181        """
182        return self._getUniversal(tc.LAST_STEP_VEHICLE_HALTING_NUMBER, edgeID)
183
184    def getLastStepVehicleIDs(self, edgeID):
185        """getLastStepVehicleIDs(string) -> tuple(string)
186
187        Returns the ids of the vehicles for the last time step on the given edge.
188        """
189        return self._getUniversal(tc.LAST_STEP_VEHICLE_ID_LIST, edgeID)
190
191    def getLastStepPersonIDs(self, edgeID):
192        """getLastStepPersonIDs(string) -> tuple(string)
193
194        Returns the ids of the persons on the given edge during the last time step.
195        """
196        return self._getUniversal(tc.LAST_STEP_PERSON_ID_LIST, edgeID)
197
198    def getPendingVehicles(self, edgeID):
199        """getPendingVehicles(string) -> tuple(string)
200        Returns a tuple of all vehicle ids waiting for insertion on this edge (with depart delay)
201        """
202        return self._getUniversal(tc.VAR_PENDING_VEHICLES, edgeID)
203
204    def getAngle(self, edgeID, relativePosition=tc.INVALID_DOUBLE_VALUE):
205        """getAngle(string, double) -> double
206        Returns the heading of the straight line segment formed by the first lane of the edge at the given position.
207        If the given position equals TraCI constant INVALID_DOUBLE_VALUE, it returns the total angle
208        formed by the edge, from its start point to its end point. If the edge doesn't have any lanes,
209        then INVALID_DOUBLE_VALUE is returned.
210        """
211        return self._getUniversal(tc.VAR_ANGLE, edgeID, "d", relativePosition)
212
213    def getFromJunction(self, edgeID):
214        """getFromJunction(string) -> string
215
216        Returns the id of the junction at the start of this edge
217        """
218        return self._getUniversal(tc.FROM_JUNCTION, edgeID)
219
220    def getToJunction(self, edgeID):
221        """getToJunction(string) -> string
222
223        Returns the id of the junction at the end of this edge
224        """
225        return self._getUniversal(tc.TO_JUNCTION, edgeID)
226
227    def getBidiEdge(self, edgeID):
228        """getBidiEdge(string) -> string
229
230        Returns the id of the bidi edge or ""
231        """
232        return self._getUniversal(tc.VAR_BIDI, edgeID)
233
234    def adaptTraveltime(self, edgeID, time, begin=None, end=None):
235        """adaptTraveltime(string, double, double, double) -> None
236
237        Adapt the travel time value (in s) used for (re-)routing for the given edge.
238
239        When setting begin time and end time (in seconds), the changes only
240        apply to that time range. Otherwise they apply all the time
241        """
242        if begin is None and end is None:
243            self._setCmd(tc.VAR_EDGE_TRAVELTIME, edgeID, "td", 1, time)
244        elif begin is not None and end is not None:
245            self._setCmd(tc.VAR_EDGE_TRAVELTIME, edgeID, "tddd", 3, begin, end, time)
246        else:
247            raise TraCIException("Both, begin time and end time must be specified")
248
249    def setEffort(self, edgeID, effort, begin=None, end=None):
250        """setEffort(string, double, double, double) -> None
251
252        Adapt the effort value used for (re-)routing for the given edge.
253
254        When setting begin time and end time (in seconds), the changes only
255        apply to that time range. Otherwise they apply all the time.
256        """
257        if begin is None and end is None:
258            self._setCmd(tc.VAR_EDGE_EFFORT, edgeID, "td", 1, effort)
259        elif begin is not None and end is not None:
260            self._setCmd(tc.VAR_EDGE_EFFORT, edgeID, "tddd", 3, begin, end, effort)
261        else:
262            raise TraCIException("Both, begin time and end time must be specified")
263
264    def setAllowed(self, edgeID, allowedClasses):
265        """setAllowed(string, list) -> None
266
267        Sets a list of allowed vehicle classes. Setting an empty list means all vehicles are allowed.
268        """
269        if isinstance(allowedClasses, str):
270            allowedClasses = [allowedClasses]
271        self._setCmd(tc.LANE_ALLOWED, edgeID, "l", allowedClasses)
272
273    def setDisallowed(self, edgeID, disallowedClasses):
274        """setDisallowed(string, list) -> None
275
276        Sets a list of disallowed vehicle classes.
277        """
278        if isinstance(disallowedClasses, str):
279            disallowedClasses = [disallowedClasses]
280        self._setCmd(tc.LANE_DISALLOWED, edgeID, "l", disallowedClasses)
281
282    def setMaxSpeed(self, edgeID, speed):
283        """setMaxSpeed(string, double) -> None
284
285        Set a new maximum speed (in m/s) for all lanes of the edge.
286        """
287        self._setCmd(tc.VAR_MAXSPEED, edgeID, "d", speed)
288
289    def setFriction(self, edgeID, friction):
290        """setFriction(string, double) -> None
291
292        Set a new friction value [0..1] for all lanes of the edge.
293        """
294        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 getMaxSpeed(self, edgeID):
127    def getMaxSpeed(self, edgeID):
128        """getMaxSpeed(string) -> double
129
130        Returns the maximum speed (in m/s) of the first lane of the edge.
131        """
132        return self._getUniversal(tc.VAR_MAXSPEED, edgeID)

getMaxSpeed(string) -> double

Returns the maximum speed (in m/s) of the first lane of the edge.

def getLastStepOccupancy(self, edgeID):
134    def getLastStepOccupancy(self, edgeID):
135        """getLastStepOccupancy(string) -> double
136
137        Returns the net occupancy (excluding inter-vehicle gaps) in % for the last time step on the given edge.
138        """
139        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):
141    def getLastStepLength(self, edgeID):
142        """getLastStepLength(string) -> double
143
144        Returns the mean vehicle length in m for the last time step on the given edge.
145        """
146        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):
148    def getLaneNumber(self, edgeID):
149        """getLaneNumber(string) -> int
150
151        Returns the number of lanes of this edge
152        """
153        return self._getUniversal(tc.VAR_LANE_INDEX, edgeID)

getLaneNumber(string) -> int

Returns the number of lanes of this edge

def getStreetName(self, edgeID):
155    def getStreetName(self, edgeID):
156        """getStreetName(string) -> string
157
158        Returns the street name of this edge
159        """
160        return self._getUniversal(tc.VAR_NAME, edgeID)

getStreetName(string) -> string

Returns the street name of this edge

def getTraveltime(self, edgeID):
162    def getTraveltime(self, edgeID):
163        """getTraveltime(string) -> double
164
165        Returns the estimated travel time in s for the last time step on the given edge.
166        """
167        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):
169    def getLastStepVehicleNumber(self, edgeID):
170        """getLastStepVehicleNumber(string) -> integer
171
172        Returns the total number of vehicles for the last time step on the given edge.
173        """
174        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):
176    def getLastStepHaltingNumber(self, edgeID):
177        """getLastStepHaltingNumber(string) -> integer
178
179        Returns the total number of halting vehicles for the last time step on the given edge.
180        A speed of less than 0.1 m/s is considered a halt.
181        """
182        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):
184    def getLastStepVehicleIDs(self, edgeID):
185        """getLastStepVehicleIDs(string) -> tuple(string)
186
187        Returns the ids of the vehicles for the last time step on the given edge.
188        """
189        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):
191    def getLastStepPersonIDs(self, edgeID):
192        """getLastStepPersonIDs(string) -> tuple(string)
193
194        Returns the ids of the persons on the given edge during the last time step.
195        """
196        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):
198    def getPendingVehicles(self, edgeID):
199        """getPendingVehicles(string) -> tuple(string)
200        Returns a tuple of all vehicle ids waiting for insertion on this edge (with depart delay)
201        """
202        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):
204    def getAngle(self, edgeID, relativePosition=tc.INVALID_DOUBLE_VALUE):
205        """getAngle(string, double) -> double
206        Returns the heading of the straight line segment formed by the first lane of the edge at the given position.
207        If the given position equals TraCI constant INVALID_DOUBLE_VALUE, it returns the total angle
208        formed by the edge, from its start point to its end point. If the edge doesn't have any lanes,
209        then INVALID_DOUBLE_VALUE is returned.
210        """
211        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):
213    def getFromJunction(self, edgeID):
214        """getFromJunction(string) -> string
215
216        Returns the id of the junction at the start of this edge
217        """
218        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):
220    def getToJunction(self, edgeID):
221        """getToJunction(string) -> string
222
223        Returns the id of the junction at the end of this edge
224        """
225        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):
227    def getBidiEdge(self, edgeID):
228        """getBidiEdge(string) -> string
229
230        Returns the id of the bidi edge or ""
231        """
232        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):
234    def adaptTraveltime(self, edgeID, time, begin=None, end=None):
235        """adaptTraveltime(string, double, double, double) -> None
236
237        Adapt the travel time value (in s) used for (re-)routing for the given edge.
238
239        When setting begin time and end time (in seconds), the changes only
240        apply to that time range. Otherwise they apply all the time
241        """
242        if begin is None and end is None:
243            self._setCmd(tc.VAR_EDGE_TRAVELTIME, edgeID, "td", 1, time)
244        elif begin is not None and end is not None:
245            self._setCmd(tc.VAR_EDGE_TRAVELTIME, edgeID, "tddd", 3, begin, end, time)
246        else:
247            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):
249    def setEffort(self, edgeID, effort, begin=None, end=None):
250        """setEffort(string, double, double, double) -> None
251
252        Adapt the effort value used for (re-)routing for the given edge.
253
254        When setting begin time and end time (in seconds), the changes only
255        apply to that time range. Otherwise they apply all the time.
256        """
257        if begin is None and end is None:
258            self._setCmd(tc.VAR_EDGE_EFFORT, edgeID, "td", 1, effort)
259        elif begin is not None and end is not None:
260            self._setCmd(tc.VAR_EDGE_EFFORT, edgeID, "tddd", 3, begin, end, effort)
261        else:
262            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):
264    def setAllowed(self, edgeID, allowedClasses):
265        """setAllowed(string, list) -> None
266
267        Sets a list of allowed vehicle classes. Setting an empty list means all vehicles are allowed.
268        """
269        if isinstance(allowedClasses, str):
270            allowedClasses = [allowedClasses]
271        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):
273    def setDisallowed(self, edgeID, disallowedClasses):
274        """setDisallowed(string, list) -> None
275
276        Sets a list of disallowed vehicle classes.
277        """
278        if isinstance(disallowedClasses, str):
279            disallowedClasses = [disallowedClasses]
280        self._setCmd(tc.LANE_DISALLOWED, edgeID, "l", disallowedClasses)

setDisallowed(string, list) -> None

Sets a list of disallowed vehicle classes.

def setMaxSpeed(self, edgeID, speed):
282    def setMaxSpeed(self, edgeID, speed):
283        """setMaxSpeed(string, double) -> None
284
285        Set a new maximum speed (in m/s) for all lanes of the edge.
286        """
287        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):
289    def setFriction(self, edgeID, friction):
290        """setFriction(string, double) -> None
291
292        Set a new friction value [0..1] for all lanes of the edge.
293        """
294        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.