Eclipse SUMO - Simulation of Urban MObility
MSChargingStation.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 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 /****************************************************************************/
20 // Chargin Station for Electric vehicles
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include <list>
26 #include <string>
27 #include <iostream>
28 #include <fstream>
29 #include <sstream>
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class MSLane;
37 class MSBusStop;
38 class OptionsCont;
39 class MSDevice_Battery;
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
50 
51 public:
53  MSChargingStation(const std::string& chargingStationID, MSLane& lane, double startPos, double endPos,
54  const std::string& name, double chargingPower, double efficency, bool chargeInTransit,
55  SUMOTime chargeDelay, const std::string& chargeType, SUMOTime waitingTime);
56 
57  MSChargingStation(const std::string& chargingStationID, const MSParkingArea* parkingArea, const std::string& name, double chargingPower,
58  double efficency, bool chargeInTransit, SUMOTime chargeDelay, const std::string& chargeType,
59  SUMOTime waitingTime);
60 
63 
65  double getChargingPower(bool usingFuel) const;
66 
68  double getEfficency() const;
69 
71  bool getChargeInTransit() const;
72 
74  SUMOTime getChargeDelay() const;
75 
77  const std::string& getChargeType() const;
78 
80  SUMOTime getWaitingTime() const;
81 
85  const MSParkingArea* getParkingArea() const;
86 
88  void setChargingVehicle(bool value);
89 
94  bool vehicleIsInside(const double position) const;
95 
97  bool isCharging() const;
98 
99  double getTotalCharged() const {
100  return myTotalCharge;
101  }
102 
104  void addChargeValueForOutput(double WCharged, MSDevice_Battery* battery);
105 
108 
109 protected:
110 
112  struct Charge {
114  Charge(SUMOTime _timeStep, std::string _vehicleID, std::string _vehicleType, std::string _status,
115  double _WCharged, double _actualBatteryCapacity, double _maxBatteryCapacity, double _chargingPower,
116  double _chargingEfficiency, double _totalEnergyCharged) :
117  timeStep(_timeStep),
118  vehicleID(_vehicleID),
119  vehicleType(_vehicleType),
120  status(_status),
121  WCharged(_WCharged),
122  actualBatteryCapacity(_actualBatteryCapacity),
123  maxBatteryCapacity(_maxBatteryCapacity),
124  chargingPower(_chargingPower),
125  chargingEfficiency(_chargingEfficiency),
126  totalEnergyCharged(_totalEnergyCharged) {}
127 
128  // @brief vehicle TimeStep
130  // @brief vehicle ID
131  std::string vehicleID;
132  // @brief vehicle Type
133  std::string vehicleType;
135  std::string status;
136  // @brief W charged
137  double WCharged;
138  // @brief actual battery capacity AFTER charging
140  // @brief battery max capacity
142  // @brief current charging power of charging station
144  // @brief current efficiency of charging station
146  // @brief current energy charged by charging stations AFTER charging
148  };
149 
150  static void writeVehicle(OutputDevice& out, const std::vector<Charge>& chargeSteps, int iStart, int iEnd, double charged);
151 
153  double myChargingPower = 0;
154 
156  double myEfficiency = 0;
157 
160 
163 
165  const std::string myChargeType = "normal";
166 
169 
171  bool myChargingVehicle = false;
172 
174  double myTotalCharge = 0;
175 
177  const MSParkingArea* myParkingArea = nullptr;
178 
180  std::map<std::string, std::vector<Charge> > myChargeValues;
182  std::vector<std::string> myChargedVehicles;
183 
184 private:
187 
190 };
long long int SUMOTime
Definition: GUI.h:35
double myChargingPower
Charging station's charging power.
void writeChargingStationOutput(OutputDevice &output)
write charging station values
double myTotalCharge
total energy charged by this charging station
static void writeVehicle(OutputDevice &out, const std::vector< Charge > &chargeSteps, int iStart, int iEnd, double charged)
double getChargingPower(bool usingFuel) const
Get charging station's charging power in the.
bool getChargeInTransit() const
Get chargeInTransit.
const std::string & getChargeType() const
Get charge type.
void setChargingVehicle(bool value)
enable or disable charging vehicle
const std::string myChargeType
charge type
std::vector< std::string > myChargedVehicles
order vehicles by time of first charge
double myEfficiency
Efficiency of the charging station.
SUMOTime myWaitingTime
waiting time
bool myChargeInTransit
Allow charge in transit.
bool vehicleIsInside(const double position) const
Check if a vehicle is inside in the Charge Station.
const MSParkingArea * myParkingArea
parkingArea the charging station is placed on
MSChargingStation(const MSChargingStation &)=delete
Invalidated copy constructor.
MSChargingStation & operator=(const MSChargingStation &)=delete
Invalidated assignment operator.
double getTotalCharged() const
std::map< std::string, std::vector< Charge > > myChargeValues
map with the charges of this charging station (key = vehicleID)
void addChargeValueForOutput(double WCharged, MSDevice_Battery *battery)
add charge value for output
MSChargingStation(const std::string &chargingStationID, MSLane &lane, double startPos, double endPos, const std::string &name, double chargingPower, double efficency, bool chargeInTransit, SUMOTime chargeDelay, const std::string &chargeType, SUMOTime waitingTime)
constructor
SUMOTime getChargeDelay() const
Get Charge Delay.
double getEfficency() const
Get efficiency of the charging station.
SUMOTime myChargeDelay
Charge Delay.
~MSChargingStation()
destructor
bool myChargingVehicle
Check if in the current TimeStep chargingStation is charging a vehicle.
bool isCharging() const
Return true if in the current time step charging station is charging a vehicle.
SUMOTime getWaitingTime() const
Get waiting time.
const MSParkingArea * getParkingArea() const
Get the parking area the charging station is placed on.
Battery device for electric vehicles.
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
A lane area vehicles can halt at.
Definition: MSParkingArea.h:60
A lane area vehicles can halt at.
A storage for options typed value containers)
Definition: OptionsCont.h:89
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
struct to save information for the chargingStation output
Charge(SUMOTime _timeStep, std::string _vehicleID, std::string _vehicleType, std::string _status, double _WCharged, double _actualBatteryCapacity, double _maxBatteryCapacity, double _chargingPower, double _chargingEfficiency, double _totalEnergyCharged)
constructor