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-2023 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// ===========================================================================
36class MSLane;
37class MSBusStop;
38class OptionsCont;
40
41
42// ===========================================================================
43// class definitions
44// ===========================================================================
50public:
51
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);
56
59
61 double getChargingPower(bool usingFuel) const;
62
64 double getEfficency() const;
65
67 bool getChargeInTransit() const;
68
71
73 void setChargingVehicle(bool value);
74
79 bool vehicleIsInside(const double position) const;
80
82 bool isCharging() const;
83
84 double getTotalCharged() const {
85 return myTotalCharge;
86 }
87
89 void addChargeValueForOutput(double WCharged, MSDevice_Battery* battery);
90
93
94protected:
95
97 struct Charge {
99 Charge(SUMOTime _timeStep, std::string _vehicleID, std::string _vehicleType, std::string _status,
100 double _WCharged, double _actualBatteryCapacity, double _maxBatteryCapacity, double _chargingPower,
101 double _chargingEfficiency, double _totalEnergyCharged) :
102 timeStep(_timeStep),
103 vehicleID(_vehicleID),
104 vehicleType(_vehicleType),
105 status(_status),
106 WCharged(_WCharged),
107 actualBatteryCapacity(_actualBatteryCapacity),
108 maxBatteryCapacity(_maxBatteryCapacity),
109 chargingPower(_chargingPower),
110 chargingEfficiency(_chargingEfficiency),
111 totalEnergyCharged(_totalEnergyCharged) {}
112
113 // @brief vehicle TimeStep
115 // @brief vehicle ID
116 std::string vehicleID;
117 // @brief vehicle Type
118 std::string vehicleType;
120 std::string status;
121 // @brief W charged
122 double WCharged;
123 // @brief actual battery capacity AFTER charging
125 // @brief battery max capacity
127 // @brief current charging power of charging station
129 // @brief current efficiency of charging station
131 // @brief current energy charged by charging stations AFTER charging
133 };
134
135 static void writeVehicle(OutputDevice& out, const std::vector<Charge>& chargeSteps, int iStart, int iEnd, double charged);
136
139
142
145
148
151
154
156 std::map<std::string, std::vector<Charge> > myChargeValues;
158 std::vector<std::string> myChargedVehicles;
159
160private:
163
166};
167
long long int SUMOTime
Definition: GUI.h:36
MSChargingStation & operator=(const MSChargingStation &)=delete
Invalidated assignment operator.
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.
void setChargingVehicle(bool value)
enable or disable charging vehicle
std::vector< std::string > myChargedVehicles
order vehicles by time of first charge
double myEfficiency
Efficiency of the charging station.
MSChargingStation(const std::string &chargingStationID, MSLane &lane, double startPos, double endPos, const std::string &name, double chargingPower, double efficency, bool chargeInTransit, SUMOTime chargeDelay)
constructor
bool myChargeInTransit
Allow charge in transit.
bool vehicleIsInside(const double position) const
Check if a vehicle is inside in the Charge Station.
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.
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.
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 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