Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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// Charging 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// ===========================================================================
36class MSLane;
37class MSBusStop;
38class OptionsCont;
40
41
42// ===========================================================================
43// class definitions
44// ===========================================================================
50
51public:
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
75
77 const std::string& getChargeType() const;
78
81
85 const MSParkingArea* getParkingArea() const;
86
88 void setChargingPower(double chargingPower);
89
91 void setEfficiency(double efficiency);
92
94 void setChargeDelay(SUMOTime delay);
95
97 void setChargeInTransit(bool value);
98
100 void setChargingVehicle(bool value);
101
106 bool vehicleIsInside(const double position) const;
107
109 bool isCharging() const;
110
111 double getTotalCharged() const {
112 return myTotalCharge;
113 }
114
116 void addChargeValueForOutput(double WCharged, MSDevice_Battery* battery);
117
120
122 void writeAggregatedChargingStationOutput(OutputDevice& output, bool includeUnfinished = false);
123
124protected:
125
127 struct Charge {
129 Charge(SUMOTime _timeStep, std::string _vehicleID, std::string _vehicleType, std::string _status,
130 double _WCharged, double _actualBatteryCapacity, double _maxBatteryCapacity, double _chargingPower,
131 double _chargingEfficiency, double _totalEnergyCharged) :
132 timeStep(_timeStep),
133 vehicleID(_vehicleID),
134 vehicleType(_vehicleType),
135 status(_status),
136 WCharged(_WCharged),
137 actualBatteryCapacity(_actualBatteryCapacity),
138 maxBatteryCapacity(_maxBatteryCapacity),
139 chargingPower(_chargingPower),
140 chargingEfficiency(_chargingEfficiency),
141 totalEnergyCharged(_totalEnergyCharged) {}
142
143 // @brief vehicle TimeStep
145 // @brief vehicle ID
146 std::string vehicleID;
147 // @brief vehicle Type
148 std::string vehicleType;
150 std::string status;
151 // @brief W charged
152 double WCharged;
153 // @brief actual battery capacity AFTER charging
155 // @brief battery max capacity
157 // @brief current charging power of charging station
159 // @brief current efficiency of charging station
161 // @brief current energy charged by charging stations AFTER charging
163 };
164
165 static void writeVehicle(OutputDevice& out, const std::vector<Charge>& chargeSteps, int iStart, int iEnd, double charged);
166
168 double myChargingPower = 0;
169
171 double myEfficiency = 0;
172
175
178
180 const std::string myChargeType = "normal";
181
184
186 bool myChargingVehicle = false;
187
189 double myTotalCharge = 0;
190
192 const MSParkingArea* myParkingArea = nullptr;
193
195 std::map<std::string, std::vector<Charge> > myChargeValues;
197 std::vector<std::string> myChargedVehicles;
198
199private:
202
205};
long long int SUMOTime
Definition GUI.h:36
MSChargingStation & operator=(const MSChargingStation &)=delete
Invalidated assignment operator.
double myChargingPower
Charging station's charging power.
void setChargeInTransit(bool value)
set charging in transit
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.
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.
void setEfficiency(double efficiency)
set efficiency of the charging station
void setChargingPower(double chargingPower)
set charging station's charging power
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.
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
SUMOTime getChargeDelay() const
Get Charge Delay.
void writeAggregatedChargingStationOutput(OutputDevice &output, bool includeUnfinished=false)
write ungrouped output (flush data after writing)
void setChargeDelay(SUMOTime delay)
set charging delay of the charging station
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.
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.
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