traci._overheadwire
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 _overheadwire.py 15# @author Jakob Erdmann 16# @date 2020-06-02 17 18from __future__ import absolute_import 19from . import constants as tc 20from .domain import Domain 21 22 23class OverheadWireDomain(Domain): 24 25 def __init__(self): 26 Domain.__init__(self, "overheadwire", tc.CMD_GET_OVERHEADWIRE_VARIABLE, tc.CMD_SET_OVERHEADWIRE_VARIABLE, 27 tc.CMD_SUBSCRIBE_OVERHEADWIRE_VARIABLE, tc.RESPONSE_SUBSCRIBE_OVERHEADWIRE_VARIABLE, 28 tc.CMD_SUBSCRIBE_OVERHEADWIRE_CONTEXT, tc.RESPONSE_SUBSCRIBE_OVERHEADWIRE_CONTEXT) 29 30 def getLaneID(self, stopID): 31 """getLaneID(string) -> string 32 Returns the lane of this calibrator (if it applies to a single lane) 33 """ 34 return self._getUniversal(tc.VAR_LANE_ID, stopID) 35 36 def getStartPos(self, stopID): 37 """getStartPos(string) -> double 38 39 The starting position of the stop along the lane measured in m. 40 """ 41 return self._getUniversal(tc.VAR_POSITION, stopID) 42 43 def getEndPos(self, stopID): 44 """getEndPos(string) -> double 45 46 The end position of the stop along the lane measured in m. 47 """ 48 return self._getUniversal(tc.VAR_LANEPOSITION, stopID) 49 50 def getName(self, stopID): 51 """getName(string) -> string 52 53 Returns the name of this stop 54 """ 55 return self._getUniversal(tc.VAR_NAME, stopID) 56 57 def getVehicleCount(self, stopID): 58 """getVehicleCount() -> integer 59 Get the total number of vehicles stopped at the named overhead wire. 60 """ 61 return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_NUMBER, stopID) 62 63 def getVehicleIDs(self, stopID): 64 """getVehicleIDs() -> tuple(string) 65 Get the IDs of vehicles stopped at the named overhead wire. 66 """ 67 return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_IDS, stopID)
class
OverheadWireDomain(traci.domain.Domain):
24class OverheadWireDomain(Domain): 25 26 def __init__(self): 27 Domain.__init__(self, "overheadwire", tc.CMD_GET_OVERHEADWIRE_VARIABLE, tc.CMD_SET_OVERHEADWIRE_VARIABLE, 28 tc.CMD_SUBSCRIBE_OVERHEADWIRE_VARIABLE, tc.RESPONSE_SUBSCRIBE_OVERHEADWIRE_VARIABLE, 29 tc.CMD_SUBSCRIBE_OVERHEADWIRE_CONTEXT, tc.RESPONSE_SUBSCRIBE_OVERHEADWIRE_CONTEXT) 30 31 def getLaneID(self, stopID): 32 """getLaneID(string) -> string 33 Returns the lane of this calibrator (if it applies to a single lane) 34 """ 35 return self._getUniversal(tc.VAR_LANE_ID, stopID) 36 37 def getStartPos(self, stopID): 38 """getStartPos(string) -> double 39 40 The starting position of the stop along the lane measured in m. 41 """ 42 return self._getUniversal(tc.VAR_POSITION, stopID) 43 44 def getEndPos(self, stopID): 45 """getEndPos(string) -> double 46 47 The end position of the stop along the lane measured in m. 48 """ 49 return self._getUniversal(tc.VAR_LANEPOSITION, stopID) 50 51 def getName(self, stopID): 52 """getName(string) -> string 53 54 Returns the name of this stop 55 """ 56 return self._getUniversal(tc.VAR_NAME, stopID) 57 58 def getVehicleCount(self, stopID): 59 """getVehicleCount() -> integer 60 Get the total number of vehicles stopped at the named overhead wire. 61 """ 62 return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_NUMBER, stopID) 63 64 def getVehicleIDs(self, stopID): 65 """getVehicleIDs() -> tuple(string) 66 Get the IDs of vehicles stopped at the named overhead wire. 67 """ 68 return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_IDS, stopID)
def
getLaneID(self, stopID):
31 def getLaneID(self, stopID): 32 """getLaneID(string) -> string 33 Returns the lane of this calibrator (if it applies to a single lane) 34 """ 35 return self._getUniversal(tc.VAR_LANE_ID, stopID)
getLaneID(string) -> string Returns the lane of this calibrator (if it applies to a single lane)
def
getStartPos(self, stopID):
37 def getStartPos(self, stopID): 38 """getStartPos(string) -> double 39 40 The starting position of the stop along the lane measured in m. 41 """ 42 return self._getUniversal(tc.VAR_POSITION, stopID)
getStartPos(string) -> double
The starting position of the stop along the lane measured in m.
def
getEndPos(self, stopID):
44 def getEndPos(self, stopID): 45 """getEndPos(string) -> double 46 47 The end position of the stop along the lane measured in m. 48 """ 49 return self._getUniversal(tc.VAR_LANEPOSITION, stopID)
getEndPos(string) -> double
The end position of the stop along the lane measured in m.
def
getName(self, stopID):
51 def getName(self, stopID): 52 """getName(string) -> string 53 54 Returns the name of this stop 55 """ 56 return self._getUniversal(tc.VAR_NAME, stopID)
getName(string) -> string
Returns the name of this stop
def
getVehicleCount(self, stopID):
58 def getVehicleCount(self, stopID): 59 """getVehicleCount() -> integer 60 Get the total number of vehicles stopped at the named overhead wire. 61 """ 62 return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_NUMBER, stopID)
getVehicleCount() -> integer Get the total number of vehicles stopped at the named overhead wire.
def
getVehicleIDs(self, stopID):
64 def getVehicleIDs(self, stopID): 65 """getVehicleIDs() -> tuple(string) 66 Get the IDs of vehicles stopped at the named overhead wire. 67 """ 68 return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_IDS, stopID)
getVehicleIDs() -> tuple(string) Get the IDs of vehicles stopped at the named overhead wire.