traci._busstop

 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    _busstop.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 BusStopDomain(Domain):
24
25    def __init__(self):
26        Domain.__init__(self, "busstop", tc.CMD_GET_BUSSTOP_VARIABLE, tc.CMD_SET_BUSSTOP_VARIABLE,
27                        tc.CMD_SUBSCRIBE_BUSSTOP_VARIABLE, tc.RESPONSE_SUBSCRIBE_BUSSTOP_VARIABLE,
28                        tc.CMD_SUBSCRIBE_BUSSTOP_CONTEXT, tc.RESPONSE_SUBSCRIBE_BUSSTOP_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(string) -> integer
59        Get the total number of vehicles stopped at the named bus stop.
60        """
61        return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_NUMBER, stopID)
62
63    def getVehicleIDs(self, stopID):
64        """getVehicleIDs(stopID) -> tuple(string)
65        Get the IDs of vehicles stopped at the named bus stop.
66        """
67        return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_IDS, stopID)
68
69    def getPersonCount(self, stopID):
70        """getPersonCount(string) -> integer
71        Get the total number of waiting persons at the named bus stop.
72        """
73        return self._getUniversal(tc.VAR_BUS_STOP_WAITING, stopID)
74
75    def getPersonIDs(self, stopID):
76        """getPersonIDs(string) -> tuple(string)
77        Get the IDs of waiting persons at the named bus stop.
78        """
79        return self._getUniversal(tc.VAR_BUS_STOP_WAITING_IDS, stopID)
class BusStopDomain(traci.domain.Domain):
24class BusStopDomain(Domain):
25
26    def __init__(self):
27        Domain.__init__(self, "busstop", tc.CMD_GET_BUSSTOP_VARIABLE, tc.CMD_SET_BUSSTOP_VARIABLE,
28                        tc.CMD_SUBSCRIBE_BUSSTOP_VARIABLE, tc.RESPONSE_SUBSCRIBE_BUSSTOP_VARIABLE,
29                        tc.CMD_SUBSCRIBE_BUSSTOP_CONTEXT, tc.RESPONSE_SUBSCRIBE_BUSSTOP_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(string) -> integer
60        Get the total number of vehicles stopped at the named bus stop.
61        """
62        return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_NUMBER, stopID)
63
64    def getVehicleIDs(self, stopID):
65        """getVehicleIDs(stopID) -> tuple(string)
66        Get the IDs of vehicles stopped at the named bus stop.
67        """
68        return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_IDS, stopID)
69
70    def getPersonCount(self, stopID):
71        """getPersonCount(string) -> integer
72        Get the total number of waiting persons at the named bus stop.
73        """
74        return self._getUniversal(tc.VAR_BUS_STOP_WAITING, stopID)
75
76    def getPersonIDs(self, stopID):
77        """getPersonIDs(string) -> tuple(string)
78        Get the IDs of waiting persons at the named bus stop.
79        """
80        return self._getUniversal(tc.VAR_BUS_STOP_WAITING_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(string) -> integer
60        Get the total number of vehicles stopped at the named bus stop.
61        """
62        return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_NUMBER, stopID)

getVehicleCount(string) -> integer Get the total number of vehicles stopped at the named bus stop.

def getVehicleIDs(self, stopID):
64    def getVehicleIDs(self, stopID):
65        """getVehicleIDs(stopID) -> tuple(string)
66        Get the IDs of vehicles stopped at the named bus stop.
67        """
68        return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_IDS, stopID)

getVehicleIDs(stopID) -> tuple(string) Get the IDs of vehicles stopped at the named bus stop.

def getPersonCount(self, stopID):
70    def getPersonCount(self, stopID):
71        """getPersonCount(string) -> integer
72        Get the total number of waiting persons at the named bus stop.
73        """
74        return self._getUniversal(tc.VAR_BUS_STOP_WAITING, stopID)

getPersonCount(string) -> integer Get the total number of waiting persons at the named bus stop.

def getPersonIDs(self, stopID):
76    def getPersonIDs(self, stopID):
77        """getPersonIDs(string) -> tuple(string)
78        Get the IDs of waiting persons at the named bus stop.
79        """
80        return self._getUniversal(tc.VAR_BUS_STOP_WAITING_IDS, stopID)

getPersonIDs(string) -> tuple(string) Get the IDs of waiting persons at the named bus stop.