-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
MSChargingStation.h
190 lines (153 loc) · 6.85 KB
/
MSChargingStation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/****************************************************************************/
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0/
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License 2.0 are satisfied: GNU General Public License, version 2
// or later which is available at
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
/****************************************************************************/
/// @file MSChargingStation.h
/// @author Daniel Krajzewicz
/// @author Tamas Kurczveil
/// @author Pablo Alvarez Lopez
/// @date 20-12-13
///
// Chargin Station for Electric vehicles
/****************************************************************************/
#pragma once
#include <config.h>
#include <list>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <microsim/MSStoppingPlace.h>
// ===========================================================================
// class declarations
// ===========================================================================
class MSLane;
class MSBusStop;
class OptionsCont;
class MSDevice_Battery;
// ===========================================================================
// class definitions
// ===========================================================================
/**
* @class ChargingStation
* @brief Definition of charging stations
*/
class MSChargingStation : public MSStoppingPlace {
public:
/// @brief constructor
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);
MSChargingStation(const std::string& chargingStationID, const MSParkingArea* parkingArea, const std::string& name, double chargingPower,
double efficency, bool chargeInTransit, SUMOTime chargeDelay, const std::string& chargeType,
SUMOTime waitingTime);
/// @brief destructor
~MSChargingStation();
/// @brief Get charging station's charging power in the
double getChargingPower(bool usingFuel) const;
/// @brief Get efficiency of the charging station
double getEfficency() const;
/// @brief Get chargeInTransit
bool getChargeInTransit() const;
/// @brief Get Charge Delay
SUMOTime getChargeDelay() const;
/// @brief Get charge type
const std::string& getChargeType() const;
/// @brief Get waiting time
SUMOTime getWaitingTime() const;
/** @brief Get the parking area the charging station is placed on
* @return pointer to the parking area or nullptr
*/
const MSParkingArea* getParkingArea() const;
/// @brief enable or disable charging vehicle
void setChargingVehicle(bool value);
/** @brief Check if a vehicle is inside in the Charge Station
* @param[in] position Position of vehicle in the LANE
* @return true if is between StartPostion and EndPostion
*/
bool vehicleIsInside(const double position) const;
/// @brief Return true if in the current time step charging station is charging a vehicle
bool isCharging() const;
double getTotalCharged() const {
return myTotalCharge;
}
/// @brief add charge value for output
void addChargeValueForOutput(double WCharged, MSDevice_Battery* battery);
/// @brief write charging station values
void writeChargingStationOutput(OutputDevice& output);
protected:
/// @brief struct to save information for the chargingStation output
struct Charge {
/// @brief constructor
Charge(SUMOTime _timeStep, std::string _vehicleID, std::string _vehicleType, std::string _status,
double _WCharged, double _actualBatteryCapacity, double _maxBatteryCapacity, double _chargingPower,
double _chargingEfficiency, double _totalEnergyCharged) :
timeStep(_timeStep),
vehicleID(_vehicleID),
vehicleType(_vehicleType),
status(_status),
WCharged(_WCharged),
actualBatteryCapacity(_actualBatteryCapacity),
maxBatteryCapacity(_maxBatteryCapacity),
chargingPower(_chargingPower),
chargingEfficiency(_chargingEfficiency),
totalEnergyCharged(_totalEnergyCharged) {}
// @brief vehicle TimeStep
SUMOTime timeStep;
// @brief vehicle ID
std::string vehicleID;
// @brief vehicle Type
std::string vehicleType;
/// @brief status
std::string status;
// @brief W charged
double WCharged;
// @brief actual battery capacity AFTER charging
double actualBatteryCapacity;
// @brief battery max capacity
double maxBatteryCapacity;
// @brief current charging power of charging station
double chargingPower;
// @brief current efficiency of charging station
double chargingEfficiency;
// @brief current energy charged by charging stations AFTER charging
double totalEnergyCharged;
};
static void writeVehicle(OutputDevice& out, const std::vector<Charge>& chargeSteps, int iStart, int iEnd, double charged);
/// @brief Charging station's charging power
double myChargingPower = 0;
/// @brief Efficiency of the charging station
double myEfficiency = 0;
/// @brief Allow charge in transit
bool myChargeInTransit;
/// @brief Charge Delay
SUMOTime myChargeDelay = 0;
/// @brief charge type
const std::string myChargeType = "normal";
/// @brief waiting time
SUMOTime myWaitingTime = 0;
/// @brief Check if in the current TimeStep chargingStation is charging a vehicle
bool myChargingVehicle = false;
/// @brief total energy charged by this charging station
double myTotalCharge = 0;
/// @brief parkingArea the charging station is placed on
const MSParkingArea* myParkingArea = nullptr;
/// @brief map with the charges of this charging station (key = vehicleID)
std::map<std::string, std::vector<Charge> > myChargeValues;
/// @brief order vehicles by time of first charge
std::vector<std::string> myChargedVehicles;
private:
/// @brief Invalidated copy constructor.
MSChargingStation(const MSChargingStation&) = delete;
/// @brief Invalidated assignment operator.
MSChargingStation& operator=(const MSChargingStation&) = delete;
};