traci._chargingstation
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 _chargingstation.py 15# @author Jakob Erdmann 16# @author Mirko Barthauer 17# @date 2020-06-02 18 19from __future__ import absolute_import 20from . import constants as tc 21from .domain import Domain 22 23 24class ChargingStationDomain(Domain): 25 26 def __init__(self): 27 Domain.__init__(self, "chargingstation", 28 tc.CMD_GET_CHARGINGSTATION_VARIABLE, tc.CMD_SET_CHARGINGSTATION_VARIABLE, 29 tc.CMD_SUBSCRIBE_CHARGINGSTATION_VARIABLE, tc.RESPONSE_SUBSCRIBE_CHARGINGSTATION_VARIABLE, 30 tc.CMD_SUBSCRIBE_CHARGINGSTATION_CONTEXT, tc.RESPONSE_SUBSCRIBE_CHARGINGSTATION_CONTEXT) 31 32 def getLaneID(self, stopID): 33 """getLaneID(string) -> string 34 35 Returns the lane of this calibrator (if it applies to a single lane) 36 """ 37 return self._getUniversal(tc.VAR_LANE_ID, stopID) 38 39 def getStartPos(self, stopID): 40 """getStartPos(string) -> double 41 42 The starting position of the stop along the lane measured in m. 43 """ 44 return self._getUniversal(tc.VAR_POSITION, stopID) 45 46 def getEndPos(self, stopID): 47 """getEndPos(string) -> double 48 49 The end position of the stop along the lane measured in m. 50 """ 51 return self._getUniversal(tc.VAR_LANEPOSITION, stopID) 52 53 def getName(self, stopID): 54 """getName(string) -> string 55 56 Returns the name of this stop 57 """ 58 return self._getUniversal(tc.VAR_NAME, stopID) 59 60 def getVehicleCount(self, stopID): 61 """getVehicleCount(string) -> integer 62 63 Get the total number of vehicles stopped at the named charging station. 64 """ 65 return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_NUMBER, stopID) 66 67 def getVehicleIDs(self, stopID): 68 """getVehicleIDs(string) -> tuple(string) 69 70 Get the IDs of vehicles stopped at the named charging station. 71 """ 72 return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_IDS, stopID) 73 74 def getChargingPower(self, stopID): 75 """getChargingPower(string) -> double 76 77 The charging power. 78 """ 79 return self._getUniversal(tc.VAR_CS_POWER, stopID) 80 81 def getEfficiency(self, stopID): 82 """getEfficiency(string) -> double 83 84 The efficiency [0,1]. 85 """ 86 return self._getUniversal(tc.VAR_CS_EFFICIENCY, stopID) 87 88 def getChargeDelay(self, stopID): 89 """getChargeDelay(string) -> double 90 91 Get the charge delay in seconds. 92 """ 93 return self._getUniversal(tc.VAR_CS_CHARGE_DELAY, stopID) 94 95 def getChargeInTransit(self, stopID): 96 """getChargeInTransit(string) -> integer 97 98 Get whether charging when driving across the charging station works (0=no, 1=yes). 99 """ 100 return self._getUniversal(tc.VAR_CS_CHARGE_IN_TRANSIT, stopID) 101 102 def getTotalPower(self, stopID): 103 """getTotalPower(string) -> double 104 105 Get the total charging power limit for all vehicles. 106 """ 107 return self._getUniversal(tc.VAR_CS_TOTAL_POWER, stopID) 108 109 def setChargingPower(self, stopID, power): 110 """setChargingPower(string, double) -> None 111 112 Sets the charging power in this charging station. 113 """ 114 self._setCmd(tc.VAR_CS_POWER, stopID, "d", power) 115 116 def setEfficiency(self, stopID, efficiency): 117 """setEfficiency(string, double) -> None 118 119 Sets the efficiency in this charging station. 120 """ 121 self._setCmd(tc.VAR_CS_EFFICIENCY, stopID, "d", efficiency) 122 123 def setChargeDelay(self, stopID, delay): 124 """setChargeDelay(string, double) -> None 125 126 Sets the charge delay in this charging station. 127 """ 128 self._setCmd(tc.VAR_CS_CHARGE_DELAY, stopID, "d", delay) 129 130 def setChargeInTransit(self, stopID, inTransit): 131 """setChargeInTransit(string, integer) -> None 132 133 Sets whether this charging station allows charging while still driving (0=no, 1=yes). 134 """ 135 self._setCmd(tc.VAR_CS_CHARGE_IN_TRANSIT, stopID, "i", inTransit) 136 137 def setTotalPower(self, stopID, totalPower): 138 """setTotalPower(string, double) -> None 139 140 Sets the total charging power limit for all vehicles in this charging station. 141 """ 142 self._setCmd(tc.VAR_CS_TOTAL_POWER, stopID, "d", totalPower)
25class ChargingStationDomain(Domain): 26 27 def __init__(self): 28 Domain.__init__(self, "chargingstation", 29 tc.CMD_GET_CHARGINGSTATION_VARIABLE, tc.CMD_SET_CHARGINGSTATION_VARIABLE, 30 tc.CMD_SUBSCRIBE_CHARGINGSTATION_VARIABLE, tc.RESPONSE_SUBSCRIBE_CHARGINGSTATION_VARIABLE, 31 tc.CMD_SUBSCRIBE_CHARGINGSTATION_CONTEXT, tc.RESPONSE_SUBSCRIBE_CHARGINGSTATION_CONTEXT) 32 33 def getLaneID(self, stopID): 34 """getLaneID(string) -> string 35 36 Returns the lane of this calibrator (if it applies to a single lane) 37 """ 38 return self._getUniversal(tc.VAR_LANE_ID, stopID) 39 40 def getStartPos(self, stopID): 41 """getStartPos(string) -> double 42 43 The starting position of the stop along the lane measured in m. 44 """ 45 return self._getUniversal(tc.VAR_POSITION, stopID) 46 47 def getEndPos(self, stopID): 48 """getEndPos(string) -> double 49 50 The end position of the stop along the lane measured in m. 51 """ 52 return self._getUniversal(tc.VAR_LANEPOSITION, stopID) 53 54 def getName(self, stopID): 55 """getName(string) -> string 56 57 Returns the name of this stop 58 """ 59 return self._getUniversal(tc.VAR_NAME, stopID) 60 61 def getVehicleCount(self, stopID): 62 """getVehicleCount(string) -> integer 63 64 Get the total number of vehicles stopped at the named charging station. 65 """ 66 return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_NUMBER, stopID) 67 68 def getVehicleIDs(self, stopID): 69 """getVehicleIDs(string) -> tuple(string) 70 71 Get the IDs of vehicles stopped at the named charging station. 72 """ 73 return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_IDS, stopID) 74 75 def getChargingPower(self, stopID): 76 """getChargingPower(string) -> double 77 78 The charging power. 79 """ 80 return self._getUniversal(tc.VAR_CS_POWER, stopID) 81 82 def getEfficiency(self, stopID): 83 """getEfficiency(string) -> double 84 85 The efficiency [0,1]. 86 """ 87 return self._getUniversal(tc.VAR_CS_EFFICIENCY, stopID) 88 89 def getChargeDelay(self, stopID): 90 """getChargeDelay(string) -> double 91 92 Get the charge delay in seconds. 93 """ 94 return self._getUniversal(tc.VAR_CS_CHARGE_DELAY, stopID) 95 96 def getChargeInTransit(self, stopID): 97 """getChargeInTransit(string) -> integer 98 99 Get whether charging when driving across the charging station works (0=no, 1=yes). 100 """ 101 return self._getUniversal(tc.VAR_CS_CHARGE_IN_TRANSIT, stopID) 102 103 def getTotalPower(self, stopID): 104 """getTotalPower(string) -> double 105 106 Get the total charging power limit for all vehicles. 107 """ 108 return self._getUniversal(tc.VAR_CS_TOTAL_POWER, stopID) 109 110 def setChargingPower(self, stopID, power): 111 """setChargingPower(string, double) -> None 112 113 Sets the charging power in this charging station. 114 """ 115 self._setCmd(tc.VAR_CS_POWER, stopID, "d", power) 116 117 def setEfficiency(self, stopID, efficiency): 118 """setEfficiency(string, double) -> None 119 120 Sets the efficiency in this charging station. 121 """ 122 self._setCmd(tc.VAR_CS_EFFICIENCY, stopID, "d", efficiency) 123 124 def setChargeDelay(self, stopID, delay): 125 """setChargeDelay(string, double) -> None 126 127 Sets the charge delay in this charging station. 128 """ 129 self._setCmd(tc.VAR_CS_CHARGE_DELAY, stopID, "d", delay) 130 131 def setChargeInTransit(self, stopID, inTransit): 132 """setChargeInTransit(string, integer) -> None 133 134 Sets whether this charging station allows charging while still driving (0=no, 1=yes). 135 """ 136 self._setCmd(tc.VAR_CS_CHARGE_IN_TRANSIT, stopID, "i", inTransit) 137 138 def setTotalPower(self, stopID, totalPower): 139 """setTotalPower(string, double) -> None 140 141 Sets the total charging power limit for all vehicles in this charging station. 142 """ 143 self._setCmd(tc.VAR_CS_TOTAL_POWER, stopID, "d", totalPower)
33 def getLaneID(self, stopID): 34 """getLaneID(string) -> string 35 36 Returns the lane of this calibrator (if it applies to a single lane) 37 """ 38 return self._getUniversal(tc.VAR_LANE_ID, stopID)
getLaneID(string) -> string
Returns the lane of this calibrator (if it applies to a single lane)
40 def getStartPos(self, stopID): 41 """getStartPos(string) -> double 42 43 The starting position of the stop along the lane measured in m. 44 """ 45 return self._getUniversal(tc.VAR_POSITION, stopID)
getStartPos(string) -> double
The starting position of the stop along the lane measured in m.
47 def getEndPos(self, stopID): 48 """getEndPos(string) -> double 49 50 The end position of the stop along the lane measured in m. 51 """ 52 return self._getUniversal(tc.VAR_LANEPOSITION, stopID)
getEndPos(string) -> double
The end position of the stop along the lane measured in m.
54 def getName(self, stopID): 55 """getName(string) -> string 56 57 Returns the name of this stop 58 """ 59 return self._getUniversal(tc.VAR_NAME, stopID)
getName(string) -> string
Returns the name of this stop
61 def getVehicleCount(self, stopID): 62 """getVehicleCount(string) -> integer 63 64 Get the total number of vehicles stopped at the named charging station. 65 """ 66 return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_NUMBER, stopID)
getVehicleCount(string) -> integer
Get the total number of vehicles stopped at the named charging station.
68 def getVehicleIDs(self, stopID): 69 """getVehicleIDs(string) -> tuple(string) 70 71 Get the IDs of vehicles stopped at the named charging station. 72 """ 73 return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_IDS, stopID)
getVehicleIDs(string) -> tuple(string)
Get the IDs of vehicles stopped at the named charging station.
75 def getChargingPower(self, stopID): 76 """getChargingPower(string) -> double 77 78 The charging power. 79 """ 80 return self._getUniversal(tc.VAR_CS_POWER, stopID)
getChargingPower(string) -> double
The charging power.
82 def getEfficiency(self, stopID): 83 """getEfficiency(string) -> double 84 85 The efficiency [0,1]. 86 """ 87 return self._getUniversal(tc.VAR_CS_EFFICIENCY, stopID)
getEfficiency(string) -> double
The efficiency [0,1].
89 def getChargeDelay(self, stopID): 90 """getChargeDelay(string) -> double 91 92 Get the charge delay in seconds. 93 """ 94 return self._getUniversal(tc.VAR_CS_CHARGE_DELAY, stopID)
getChargeDelay(string) -> double
Get the charge delay in seconds.
96 def getChargeInTransit(self, stopID): 97 """getChargeInTransit(string) -> integer 98 99 Get whether charging when driving across the charging station works (0=no, 1=yes). 100 """ 101 return self._getUniversal(tc.VAR_CS_CHARGE_IN_TRANSIT, stopID)
getChargeInTransit(string) -> integer
Get whether charging when driving across the charging station works (0=no, 1=yes).
103 def getTotalPower(self, stopID): 104 """getTotalPower(string) -> double 105 106 Get the total charging power limit for all vehicles. 107 """ 108 return self._getUniversal(tc.VAR_CS_TOTAL_POWER, stopID)
getTotalPower(string) -> double
Get the total charging power limit for all vehicles.
110 def setChargingPower(self, stopID, power): 111 """setChargingPower(string, double) -> None 112 113 Sets the charging power in this charging station. 114 """ 115 self._setCmd(tc.VAR_CS_POWER, stopID, "d", power)
setChargingPower(string, double) -> None
Sets the charging power in this charging station.
117 def setEfficiency(self, stopID, efficiency): 118 """setEfficiency(string, double) -> None 119 120 Sets the efficiency in this charging station. 121 """ 122 self._setCmd(tc.VAR_CS_EFFICIENCY, stopID, "d", efficiency)
setEfficiency(string, double) -> None
Sets the efficiency in this charging station.
124 def setChargeDelay(self, stopID, delay): 125 """setChargeDelay(string, double) -> None 126 127 Sets the charge delay in this charging station. 128 """ 129 self._setCmd(tc.VAR_CS_CHARGE_DELAY, stopID, "d", delay)
setChargeDelay(string, double) -> None
Sets the charge delay in this charging station.
131 def setChargeInTransit(self, stopID, inTransit): 132 """setChargeInTransit(string, integer) -> None 133 134 Sets whether this charging station allows charging while still driving (0=no, 1=yes). 135 """ 136 self._setCmd(tc.VAR_CS_CHARGE_IN_TRANSIT, stopID, "i", inTransit)
setChargeInTransit(string, integer) -> None
Sets whether this charging station allows charging while still driving (0=no, 1=yes).
138 def setTotalPower(self, stopID, totalPower): 139 """setTotalPower(string, double) -> None 140 141 Sets the total charging power limit for all vehicles in this charging station. 142 """ 143 self._setCmd(tc.VAR_CS_TOTAL_POWER, stopID, "d", totalPower)
setTotalPower(string, double) -> None
Sets the total charging power limit for all vehicles in this charging station.