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 getChargingStrategy(self, stopID):
110        """getChargingStrategy(string) -> string
111
112        Returns the total power allocation strategy: proportional, max-min or flat.
113        """
114        return self._getUniversal(tc.VAR_CS_CHARGING_STRATEGY, stopID)
115
116    def setChargingStrategy(self, stopID, strategy):
117        """setChargingStrategy(string, string) -> None
118
119        Sets the strategy for subsequent total power allocations.
120        Allowed values are proportional, max-min and flat.
121        """
122        self._setCmd(tc.VAR_CS_CHARGING_STRATEGY, stopID, "s", strategy)
123
124    def setChargingPower(self, stopID, power):
125        """setChargingPower(string, double) -> None
126
127        Sets the charging power in this charging station.
128        """
129        self._setCmd(tc.VAR_CS_POWER, stopID, "d", power)
130
131    def setEfficiency(self, stopID, efficiency):
132        """setEfficiency(string, double) -> None
133
134        Sets the efficiency in this charging station.
135        """
136        self._setCmd(tc.VAR_CS_EFFICIENCY, stopID, "d", efficiency)
137
138    def setChargeDelay(self, stopID, delay):
139        """setChargeDelay(string, double) -> None
140
141        Sets the charge delay in this charging station.
142        """
143        self._setCmd(tc.VAR_CS_CHARGE_DELAY, stopID, "d", delay)
144
145    def setChargeInTransit(self, stopID, inTransit):
146        """setChargeInTransit(string, integer) -> None
147
148        Sets whether this charging station allows charging while still driving (0=no, 1=yes).
149        """
150        self._setCmd(tc.VAR_CS_CHARGE_IN_TRANSIT, stopID, "i", inTransit)
151
152    def setTotalPower(self, stopID, totalPower):
153        """setTotalPower(string, double) -> None
154
155        Sets the total charging power limit for all vehicles in this charging station.
156        """
157        self._setCmd(tc.VAR_CS_TOTAL_POWER, stopID, "d", totalPower)
class ChargingStationDomain(traci.domain.Domain):
 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 getChargingStrategy(self, stopID):
111        """getChargingStrategy(string) -> string
112
113        Returns the total power allocation strategy: proportional, max-min or flat.
114        """
115        return self._getUniversal(tc.VAR_CS_CHARGING_STRATEGY, stopID)
116
117    def setChargingStrategy(self, stopID, strategy):
118        """setChargingStrategy(string, string) -> None
119
120        Sets the strategy for subsequent total power allocations.
121        Allowed values are proportional, max-min and flat.
122        """
123        self._setCmd(tc.VAR_CS_CHARGING_STRATEGY, stopID, "s", strategy)
124
125    def setChargingPower(self, stopID, power):
126        """setChargingPower(string, double) -> None
127
128        Sets the charging power in this charging station.
129        """
130        self._setCmd(tc.VAR_CS_POWER, stopID, "d", power)
131
132    def setEfficiency(self, stopID, efficiency):
133        """setEfficiency(string, double) -> None
134
135        Sets the efficiency in this charging station.
136        """
137        self._setCmd(tc.VAR_CS_EFFICIENCY, stopID, "d", efficiency)
138
139    def setChargeDelay(self, stopID, delay):
140        """setChargeDelay(string, double) -> None
141
142        Sets the charge delay in this charging station.
143        """
144        self._setCmd(tc.VAR_CS_CHARGE_DELAY, stopID, "d", delay)
145
146    def setChargeInTransit(self, stopID, inTransit):
147        """setChargeInTransit(string, integer) -> None
148
149        Sets whether this charging station allows charging while still driving (0=no, 1=yes).
150        """
151        self._setCmd(tc.VAR_CS_CHARGE_IN_TRANSIT, stopID, "i", inTransit)
152
153    def setTotalPower(self, stopID, totalPower):
154        """setTotalPower(string, double) -> None
155
156        Sets the total charging power limit for all vehicles in this charging station.
157        """
158        self._setCmd(tc.VAR_CS_TOTAL_POWER, stopID, "d", totalPower)
def getLaneID(self, stopID):
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)

def getStartPos(self, stopID):
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.

def getEndPos(self, stopID):
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.

def getName(self, stopID):
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

def getVehicleCount(self, stopID):
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.

def getVehicleIDs(self, stopID):
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.

def getChargingPower(self, stopID):
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.

def getEfficiency(self, stopID):
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].

def getChargeDelay(self, stopID):
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.

def getChargeInTransit(self, stopID):
 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).

def getTotalPower(self, stopID):
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.

def getChargingStrategy(self, stopID):
110    def getChargingStrategy(self, stopID):
111        """getChargingStrategy(string) -> string
112
113        Returns the total power allocation strategy: proportional, max-min or flat.
114        """
115        return self._getUniversal(tc.VAR_CS_CHARGING_STRATEGY, stopID)

getChargingStrategy(string) -> string

Returns the total power allocation strategy: proportional, max-min or flat.

def setChargingStrategy(self, stopID, strategy):
117    def setChargingStrategy(self, stopID, strategy):
118        """setChargingStrategy(string, string) -> None
119
120        Sets the strategy for subsequent total power allocations.
121        Allowed values are proportional, max-min and flat.
122        """
123        self._setCmd(tc.VAR_CS_CHARGING_STRATEGY, stopID, "s", strategy)

setChargingStrategy(string, string) -> None

Sets the strategy for subsequent total power allocations. Allowed values are proportional, max-min and flat.

def setChargingPower(self, stopID, power):
125    def setChargingPower(self, stopID, power):
126        """setChargingPower(string, double) -> None
127
128        Sets the charging power in this charging station.
129        """
130        self._setCmd(tc.VAR_CS_POWER, stopID, "d", power)

setChargingPower(string, double) -> None

Sets the charging power in this charging station.

def setEfficiency(self, stopID, efficiency):
132    def setEfficiency(self, stopID, efficiency):
133        """setEfficiency(string, double) -> None
134
135        Sets the efficiency in this charging station.
136        """
137        self._setCmd(tc.VAR_CS_EFFICIENCY, stopID, "d", efficiency)

setEfficiency(string, double) -> None

Sets the efficiency in this charging station.

def setChargeDelay(self, stopID, delay):
139    def setChargeDelay(self, stopID, delay):
140        """setChargeDelay(string, double) -> None
141
142        Sets the charge delay in this charging station.
143        """
144        self._setCmd(tc.VAR_CS_CHARGE_DELAY, stopID, "d", delay)

setChargeDelay(string, double) -> None

Sets the charge delay in this charging station.

def setChargeInTransit(self, stopID, inTransit):
146    def setChargeInTransit(self, stopID, inTransit):
147        """setChargeInTransit(string, integer) -> None
148
149        Sets whether this charging station allows charging while still driving (0=no, 1=yes).
150        """
151        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).

def setTotalPower(self, stopID, totalPower):
153    def setTotalPower(self, stopID, totalPower):
154        """setTotalPower(string, double) -> None
155
156        Sets the total charging power limit for all vehicles in this charging station.
157        """
158        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.