traci._routeprobe
1# -*- coding: utf-8 -*- 2# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo 3# Copyright (C) 2008-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 _routeprobe.py 15# @author Michael Behrisch 16# @author Lena Kalleske 17# @date 2008-10-09 18 19from __future__ import absolute_import 20from . import constants as tc 21from .domain import Domain 22 23 24class RouteProbeDomain(Domain): 25 26 def __init__(self): 27 Domain.__init__(self, "routeprobe", tc.CMD_GET_ROUTEPROBE_VARIABLE, tc.CMD_SET_ROUTEPROBE_VARIABLE, 28 tc.CMD_SUBSCRIBE_ROUTEPROBE_VARIABLE, tc.RESPONSE_SUBSCRIBE_ROUTEPROBE_VARIABLE, 29 tc.CMD_SUBSCRIBE_ROUTEPROBE_CONTEXT, tc.RESPONSE_SUBSCRIBE_ROUTEPROBE_CONTEXT) 30 31 def getEdgeID(self, probeID): 32 """getEdgeID(string) -> string 33 Returns the edge id of the given route probe 34 """ 35 return self._getUniversal(tc.VAR_ROAD_ID, probeID) 36 37 def sampleLastRouteID(self, probeID): 38 """sampleLastRouteID(string) -> string 39 Returns a random routeID from the distribution collected by this route 40 proble in the previous collectin interval 41 """ 42 return self._getUniversal(tc.VAR_SAMPLE_LAST, probeID) 43 44 def sampleCurrentRouteID(self, probeID): 45 """sampleCurrentRouteID(string) -> string 46 Returns a random routeID from the distribution collected by this route 47 proble in the current collectin interval 48 """ 49 return self._getUniversal(tc.VAR_SAMPLE_CURRENT, probeID)
class
RouteProbeDomain(traci.domain.Domain):
25class RouteProbeDomain(Domain): 26 27 def __init__(self): 28 Domain.__init__(self, "routeprobe", tc.CMD_GET_ROUTEPROBE_VARIABLE, tc.CMD_SET_ROUTEPROBE_VARIABLE, 29 tc.CMD_SUBSCRIBE_ROUTEPROBE_VARIABLE, tc.RESPONSE_SUBSCRIBE_ROUTEPROBE_VARIABLE, 30 tc.CMD_SUBSCRIBE_ROUTEPROBE_CONTEXT, tc.RESPONSE_SUBSCRIBE_ROUTEPROBE_CONTEXT) 31 32 def getEdgeID(self, probeID): 33 """getEdgeID(string) -> string 34 Returns the edge id of the given route probe 35 """ 36 return self._getUniversal(tc.VAR_ROAD_ID, probeID) 37 38 def sampleLastRouteID(self, probeID): 39 """sampleLastRouteID(string) -> string 40 Returns a random routeID from the distribution collected by this route 41 proble in the previous collectin interval 42 """ 43 return self._getUniversal(tc.VAR_SAMPLE_LAST, probeID) 44 45 def sampleCurrentRouteID(self, probeID): 46 """sampleCurrentRouteID(string) -> string 47 Returns a random routeID from the distribution collected by this route 48 proble in the current collectin interval 49 """ 50 return self._getUniversal(tc.VAR_SAMPLE_CURRENT, probeID)
def
getEdgeID(self, probeID):
32 def getEdgeID(self, probeID): 33 """getEdgeID(string) -> string 34 Returns the edge id of the given route probe 35 """ 36 return self._getUniversal(tc.VAR_ROAD_ID, probeID)
getEdgeID(string) -> string Returns the edge id of the given route probe
def
sampleLastRouteID(self, probeID):
38 def sampleLastRouteID(self, probeID): 39 """sampleLastRouteID(string) -> string 40 Returns a random routeID from the distribution collected by this route 41 proble in the previous collectin interval 42 """ 43 return self._getUniversal(tc.VAR_SAMPLE_LAST, probeID)
sampleLastRouteID(string) -> string Returns a random routeID from the distribution collected by this route proble in the previous collectin interval
def
sampleCurrentRouteID(self, probeID):
45 def sampleCurrentRouteID(self, probeID): 46 """sampleCurrentRouteID(string) -> string 47 Returns a random routeID from the distribution collected by this route 48 proble in the current collectin interval 49 """ 50 return self._getUniversal(tc.VAR_SAMPLE_CURRENT, probeID)
sampleCurrentRouteID(string) -> string Returns a random routeID from the distribution collected by this route proble in the current collectin interval