traci._multientryexit

  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    _multientryexit.py
 15# @author  Michael Behrisch
 16# @date    2011-03-16
 17
 18from __future__ import absolute_import
 19from .domain import Domain
 20from . import constants as tc
 21
 22
 23class MultiEntryExitDomain(Domain):
 24
 25    def __init__(self):
 26        Domain.__init__(self, "multientryexit",
 27                        tc.CMD_GET_MULTIENTRYEXIT_VARIABLE, tc.CMD_SET_MULTIENTRYEXIT_VARIABLE,
 28                        tc.CMD_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE, tc.RESPONSE_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE,
 29                        tc.CMD_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT, tc.RESPONSE_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT,
 30                        subscriptionDefault=(tc.LAST_STEP_VEHICLE_NUMBER,))
 31
 32    def getEntryLanes(self, detID):
 33        """getEntryLanes(string) -> tuple(string)
 34
 35        Returns the tuple of ids of the detector's entry lanes.
 36        """
 37        return self._getUniversal(tc.VAR_LANES, detID)
 38
 39    def getExitLanes(self, detID):
 40        """getExitLanes(string) -> tuple(string)
 41
 42        Returns the tuple of ids of the detector's exit lanes.
 43        """
 44        return self._getUniversal(tc.VAR_EXIT_LANES, detID)
 45
 46    def getEntryPositions(self, detID):
 47        """getEntryPositions(string) -> tuple(double)
 48
 49        Returns the tuple of positions of the detector's entry lanes.
 50        """
 51        return self._getUniversal(tc.VAR_POSITION, detID)
 52
 53    def getExitPositions(self, detID):
 54        """getExitPositions(string) -> tuple(double)
 55
 56        Returns the tuple of positions of the detector's exit lanes.
 57        """
 58        return self._getUniversal(tc.VAR_EXIT_POSITIONS, detID)
 59
 60    def getLastStepVehicleNumber(self, detID):
 61        """getLastStepVehicleNumber(string) -> integer
 62
 63        Returns the number of vehicles that have been within the named multi-entry/multi-exit detector within the
 64        last simulation step.
 65        """
 66        return self._getUniversal(tc.LAST_STEP_VEHICLE_NUMBER, detID)
 67
 68    def getLastStepMeanSpeed(self, detID):
 69        """getLastStepMeanSpeed(string) -> double
 70
 71        Returns the mean speed in m/s of vehicles that have been within the named multi-entry/multi-exit detector
 72        within the last simulation step.
 73        """
 74        return self._getUniversal(tc.LAST_STEP_MEAN_SPEED, detID)
 75
 76    def getLastStepVehicleIDs(self, detID):
 77        """getLastStepVehicleIDs(string) -> tuple(string)
 78
 79        Returns the tuple of ids of vehicles that have been within the named multi-entry/multi-exit detector in the
 80        last simulation step.
 81        """
 82        return self._getUniversal(tc.LAST_STEP_VEHICLE_ID_LIST, detID)
 83
 84    def getLastStepHaltingNumber(self, detID):
 85        """getLastStepHaltingNumber(string) -> integer
 86
 87        Returns the number of vehicles which were halting during the last time step.
 88        """
 89        return self._getUniversal(tc.LAST_STEP_VEHICLE_HALTING_NUMBER, detID)
 90
 91    def getLastIntervalMeanTravelTime(self, detID):
 92        """getLastIntervalMeanTravelTime(string) -> double
 93
 94        Returns the average travel time of vehicles that passed the detector in
 95        the previous completed measurement interval
 96        """
 97        return self._getUniversal(tc.VAR_LAST_INTERVAL_TRAVELTIME, detID)
 98
 99    def getLastIntervalMeanHaltsPerVehicle(self, detID):
100        """getLastIntervalMeanHaltsPerVehicle(string) -> double
101
102        Returns the average number of halts of vehicles that passed the detector in
103        the previous completed measurement interval
104        """
105        return self._getUniversal(tc.VAR_LAST_INTERVAL_MEAN_HALTING_NUMBER, detID)
106
107    def getLastIntervalMeanTimeLoss(self, detID):
108        """getLastIntervalMeanTimeLoss(string) -> double
109
110        Returns the average time loss of vehicles that passed the detector in
111        the previous completed measurement interval
112        """
113        return self._getUniversal(tc.VAR_TIMELOSS, detID)
114
115    def getLastIntervalVehicleSum(self, detID):
116        """getLastIntervalVehicleSum(string) -> integer
117
118        Returns the number of vehicles that passed the detector in
119        the previous completed measurement interval
120        """
121        return self._getUniversal(tc.VAR_LAST_INTERVAL_VEHICLE_NUMBER, detID)
class MultiEntryExitDomain(traci.domain.Domain):
 24class MultiEntryExitDomain(Domain):
 25
 26    def __init__(self):
 27        Domain.__init__(self, "multientryexit",
 28                        tc.CMD_GET_MULTIENTRYEXIT_VARIABLE, tc.CMD_SET_MULTIENTRYEXIT_VARIABLE,
 29                        tc.CMD_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE, tc.RESPONSE_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE,
 30                        tc.CMD_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT, tc.RESPONSE_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT,
 31                        subscriptionDefault=(tc.LAST_STEP_VEHICLE_NUMBER,))
 32
 33    def getEntryLanes(self, detID):
 34        """getEntryLanes(string) -> tuple(string)
 35
 36        Returns the tuple of ids of the detector's entry lanes.
 37        """
 38        return self._getUniversal(tc.VAR_LANES, detID)
 39
 40    def getExitLanes(self, detID):
 41        """getExitLanes(string) -> tuple(string)
 42
 43        Returns the tuple of ids of the detector's exit lanes.
 44        """
 45        return self._getUniversal(tc.VAR_EXIT_LANES, detID)
 46
 47    def getEntryPositions(self, detID):
 48        """getEntryPositions(string) -> tuple(double)
 49
 50        Returns the tuple of positions of the detector's entry lanes.
 51        """
 52        return self._getUniversal(tc.VAR_POSITION, detID)
 53
 54    def getExitPositions(self, detID):
 55        """getExitPositions(string) -> tuple(double)
 56
 57        Returns the tuple of positions of the detector's exit lanes.
 58        """
 59        return self._getUniversal(tc.VAR_EXIT_POSITIONS, detID)
 60
 61    def getLastStepVehicleNumber(self, detID):
 62        """getLastStepVehicleNumber(string) -> integer
 63
 64        Returns the number of vehicles that have been within the named multi-entry/multi-exit detector within the
 65        last simulation step.
 66        """
 67        return self._getUniversal(tc.LAST_STEP_VEHICLE_NUMBER, detID)
 68
 69    def getLastStepMeanSpeed(self, detID):
 70        """getLastStepMeanSpeed(string) -> double
 71
 72        Returns the mean speed in m/s of vehicles that have been within the named multi-entry/multi-exit detector
 73        within the last simulation step.
 74        """
 75        return self._getUniversal(tc.LAST_STEP_MEAN_SPEED, detID)
 76
 77    def getLastStepVehicleIDs(self, detID):
 78        """getLastStepVehicleIDs(string) -> tuple(string)
 79
 80        Returns the tuple of ids of vehicles that have been within the named multi-entry/multi-exit detector in the
 81        last simulation step.
 82        """
 83        return self._getUniversal(tc.LAST_STEP_VEHICLE_ID_LIST, detID)
 84
 85    def getLastStepHaltingNumber(self, detID):
 86        """getLastStepHaltingNumber(string) -> integer
 87
 88        Returns the number of vehicles which were halting during the last time step.
 89        """
 90        return self._getUniversal(tc.LAST_STEP_VEHICLE_HALTING_NUMBER, detID)
 91
 92    def getLastIntervalMeanTravelTime(self, detID):
 93        """getLastIntervalMeanTravelTime(string) -> double
 94
 95        Returns the average travel time of vehicles that passed the detector in
 96        the previous completed measurement interval
 97        """
 98        return self._getUniversal(tc.VAR_LAST_INTERVAL_TRAVELTIME, detID)
 99
100    def getLastIntervalMeanHaltsPerVehicle(self, detID):
101        """getLastIntervalMeanHaltsPerVehicle(string) -> double
102
103        Returns the average number of halts of vehicles that passed the detector in
104        the previous completed measurement interval
105        """
106        return self._getUniversal(tc.VAR_LAST_INTERVAL_MEAN_HALTING_NUMBER, detID)
107
108    def getLastIntervalMeanTimeLoss(self, detID):
109        """getLastIntervalMeanTimeLoss(string) -> double
110
111        Returns the average time loss of vehicles that passed the detector in
112        the previous completed measurement interval
113        """
114        return self._getUniversal(tc.VAR_TIMELOSS, detID)
115
116    def getLastIntervalVehicleSum(self, detID):
117        """getLastIntervalVehicleSum(string) -> integer
118
119        Returns the number of vehicles that passed the detector in
120        the previous completed measurement interval
121        """
122        return self._getUniversal(tc.VAR_LAST_INTERVAL_VEHICLE_NUMBER, detID)
def getEntryLanes(self, detID):
33    def getEntryLanes(self, detID):
34        """getEntryLanes(string) -> tuple(string)
35
36        Returns the tuple of ids of the detector's entry lanes.
37        """
38        return self._getUniversal(tc.VAR_LANES, detID)

getEntryLanes(string) -> tuple(string)

Returns the tuple of ids of the detector's entry lanes.

def getExitLanes(self, detID):
40    def getExitLanes(self, detID):
41        """getExitLanes(string) -> tuple(string)
42
43        Returns the tuple of ids of the detector's exit lanes.
44        """
45        return self._getUniversal(tc.VAR_EXIT_LANES, detID)

getExitLanes(string) -> tuple(string)

Returns the tuple of ids of the detector's exit lanes.

def getEntryPositions(self, detID):
47    def getEntryPositions(self, detID):
48        """getEntryPositions(string) -> tuple(double)
49
50        Returns the tuple of positions of the detector's entry lanes.
51        """
52        return self._getUniversal(tc.VAR_POSITION, detID)

getEntryPositions(string) -> tuple(double)

Returns the tuple of positions of the detector's entry lanes.

def getExitPositions(self, detID):
54    def getExitPositions(self, detID):
55        """getExitPositions(string) -> tuple(double)
56
57        Returns the tuple of positions of the detector's exit lanes.
58        """
59        return self._getUniversal(tc.VAR_EXIT_POSITIONS, detID)

getExitPositions(string) -> tuple(double)

Returns the tuple of positions of the detector's exit lanes.

def getLastStepVehicleNumber(self, detID):
61    def getLastStepVehicleNumber(self, detID):
62        """getLastStepVehicleNumber(string) -> integer
63
64        Returns the number of vehicles that have been within the named multi-entry/multi-exit detector within the
65        last simulation step.
66        """
67        return self._getUniversal(tc.LAST_STEP_VEHICLE_NUMBER, detID)

getLastStepVehicleNumber(string) -> integer

Returns the number of vehicles that have been within the named multi-entry/multi-exit detector within the last simulation step.

def getLastStepMeanSpeed(self, detID):
69    def getLastStepMeanSpeed(self, detID):
70        """getLastStepMeanSpeed(string) -> double
71
72        Returns the mean speed in m/s of vehicles that have been within the named multi-entry/multi-exit detector
73        within the last simulation step.
74        """
75        return self._getUniversal(tc.LAST_STEP_MEAN_SPEED, detID)

getLastStepMeanSpeed(string) -> double

Returns the mean speed in m/s of vehicles that have been within the named multi-entry/multi-exit detector within the last simulation step.

def getLastStepVehicleIDs(self, detID):
77    def getLastStepVehicleIDs(self, detID):
78        """getLastStepVehicleIDs(string) -> tuple(string)
79
80        Returns the tuple of ids of vehicles that have been within the named multi-entry/multi-exit detector in the
81        last simulation step.
82        """
83        return self._getUniversal(tc.LAST_STEP_VEHICLE_ID_LIST, detID)

getLastStepVehicleIDs(string) -> tuple(string)

Returns the tuple of ids of vehicles that have been within the named multi-entry/multi-exit detector in the last simulation step.

def getLastStepHaltingNumber(self, detID):
85    def getLastStepHaltingNumber(self, detID):
86        """getLastStepHaltingNumber(string) -> integer
87
88        Returns the number of vehicles which were halting during the last time step.
89        """
90        return self._getUniversal(tc.LAST_STEP_VEHICLE_HALTING_NUMBER, detID)

getLastStepHaltingNumber(string) -> integer

Returns the number of vehicles which were halting during the last time step.

def getLastIntervalMeanTravelTime(self, detID):
92    def getLastIntervalMeanTravelTime(self, detID):
93        """getLastIntervalMeanTravelTime(string) -> double
94
95        Returns the average travel time of vehicles that passed the detector in
96        the previous completed measurement interval
97        """
98        return self._getUniversal(tc.VAR_LAST_INTERVAL_TRAVELTIME, detID)

getLastIntervalMeanTravelTime(string) -> double

Returns the average travel time of vehicles that passed the detector in the previous completed measurement interval

def getLastIntervalMeanHaltsPerVehicle(self, detID):
100    def getLastIntervalMeanHaltsPerVehicle(self, detID):
101        """getLastIntervalMeanHaltsPerVehicle(string) -> double
102
103        Returns the average number of halts of vehicles that passed the detector in
104        the previous completed measurement interval
105        """
106        return self._getUniversal(tc.VAR_LAST_INTERVAL_MEAN_HALTING_NUMBER, detID)

getLastIntervalMeanHaltsPerVehicle(string) -> double

Returns the average number of halts of vehicles that passed the detector in the previous completed measurement interval

def getLastIntervalMeanTimeLoss(self, detID):
108    def getLastIntervalMeanTimeLoss(self, detID):
109        """getLastIntervalMeanTimeLoss(string) -> double
110
111        Returns the average time loss of vehicles that passed the detector in
112        the previous completed measurement interval
113        """
114        return self._getUniversal(tc.VAR_TIMELOSS, detID)

getLastIntervalMeanTimeLoss(string) -> double

Returns the average time loss of vehicles that passed the detector in the previous completed measurement interval

def getLastIntervalVehicleSum(self, detID):
116    def getLastIntervalVehicleSum(self, detID):
117        """getLastIntervalVehicleSum(string) -> integer
118
119        Returns the number of vehicles that passed the detector in
120        the previous completed measurement interval
121        """
122        return self._getUniversal(tc.VAR_LAST_INTERVAL_VEHICLE_NUMBER, detID)

getLastIntervalVehicleSum(string) -> integer

Returns the number of vehicles that passed the detector in the previous completed measurement interval