1 /****************************************************************************/ 2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo 3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others. 4 // This program and the accompanying materials 5 // are made available under the terms of the Eclipse Public License v2.0 6 // which accompanies this distribution, and is available at 7 // http://www.eclipse.org/legal/epl-v20.html 8 // SPDX-License-Identifier: EPL-2.0 9 /****************************************************************************/ 10 /// @file MSChargingStation.h 11 /// @author Daniel Krajzewicz 12 /// @author Tamas Kurczveil 13 /// @author Pablo Alvarez Lopez 14 /// @date 20-12-13 15 /// @version $Id$ 16 /// 17 // Chargin Station for Electric vehicles 18 /****************************************************************************/ 19 #ifndef MSChargingStation_h 20 #define MSChargingStation_h 21 22 // =========================================================================== 23 // included modules 24 // =========================================================================== 25 #include <config.h> 26 27 #include <list> 28 #include <string> 29 #include <iostream> 30 #include <fstream> 31 #include <sstream> 32 #include <microsim/MSStoppingPlace.h> 33 34 35 // =========================================================================== 36 // class declarations 37 // =========================================================================== 38 class MSLane; 39 class MSBusStop; 40 class OptionsCont; 41 class MSDevice_Battery; 42 43 44 // =========================================================================== 45 // class definitions 46 // =========================================================================== 47 /** 48 * @class ChargingStation 49 * @brief Definition of charging stations 50 */ 51 class MSChargingStation : public MSStoppingPlace { 52 public: 53 54 /// @brief constructor 55 MSChargingStation(const std::string& chargingStationID, MSLane& lane, double startPos, double endPos, 56 const std::string& name, 57 double chargingPower, double efficency, bool chargeInTransit, double chargeDelay); 58 59 /// @brief destructor 60 ~MSChargingStation(); 61 62 /// @brief Get charging station's charging power 63 double getChargingPower() const; 64 65 /// @brief Get efficiency of the charging station 66 double getEfficency() const; 67 68 /// @brief Get chargeInTransit 69 bool getChargeInTransit() const; 70 71 /// @brief Get Charge Delay 72 double getChargeDelay() const; 73 74 /// @brief Set charging station's charging power 75 void setChargingPower(double chargingPower); 76 77 /// @brief Set efficiency of the charging station 78 void setEfficency(double efficency); 79 80 /// @brief Set charge in transit of the charging station 81 void setChargeInTransit(bool chargeInTransit); 82 83 /// @brief Set charge delay of the charging station 84 void setChargeDelay(double chargeDelay); 85 86 /// @brief enable or disable charging vehicle 87 void setChargingVehicle(bool value); 88 89 /** @brief Check if a vehicle is inside in the Charge Station 90 * @param[in] position Position of vehicle in the LANE 91 * @return true if is between StartPostion and EndPostion 92 */ 93 bool vehicleIsInside(const double position) const; 94 95 /// @brief Return true if in the current time step charging station is charging a vehicle 96 bool isCharging() const; 97 getTotalCharged()98 double getTotalCharged() const { 99 return myTotalCharge; 100 } 101 102 /// @brief add charge value for output 103 void addChargeValueForOutput(double WCharged, MSDevice_Battery* battery); 104 105 /// @brief write charging station values 106 void writeChargingStationOutput(OutputDevice& output); 107 108 protected: 109 110 /// @brief struct to save information for the cahrgingStation output 111 struct charge { 112 /// @brief constructor chargecharge113 charge(SUMOTime _timeStep, std::string _vehicleID, std::string _vehicleType, std::string _status, 114 double _WCharged, double _actualBatteryCapacity, double _maxBatteryCapacity, double _chargingPower, 115 double _chargingEfficiency, double _totalEnergyCharged) : 116 timeStep(_timeStep), 117 vehicleID(_vehicleID), 118 vehicleType(_vehicleType), 119 status(_status), 120 WCharged(_WCharged), 121 actualBatteryCapacity(_actualBatteryCapacity), 122 maxBatteryCapacity(_maxBatteryCapacity), 123 chargingPower(_chargingPower), 124 chargingEfficiency(_chargingEfficiency), 125 totalEnergyCharged(_totalEnergyCharged) {} 126 127 // @brief vehicle TimeStep 128 SUMOTime timeStep; 129 // @brief vehicle ID 130 std::string vehicleID; 131 // @brief vehicle Type 132 std::string vehicleType; 133 /// @brief status 134 std::string status; 135 // @brief W charged 136 double WCharged; 137 // @brief actual battery capacity AFTER charging 138 double actualBatteryCapacity; 139 // @brief battery max capacity 140 double maxBatteryCapacity; 141 // @brief current charging power of charging station 142 double chargingPower; 143 // @brief current efficiency of charging station 144 double chargingEfficiency; 145 // @brief current energy charged by charging stations AFTER charging 146 double totalEnergyCharged; 147 }; 148 149 /// @brief Charging station's charging power 150 double myChargingPower; 151 152 /// @brief Efficiency of the charging station 153 double myEfficiency; 154 155 /// @brief Allow charge in transit 156 bool myChargeInTransit; 157 158 /// @brief Charge Delay 159 double myChargeDelay; 160 161 /// @brief Check if in the current TimeStep chargingStation is charging a vehicle 162 bool myChargingVehicle; 163 164 /// @brief total energy charged by this charging station 165 double myTotalCharge; 166 167 /// @brief vector with the charges of this charging station 168 std::vector<charge> myChargeValues; 169 170 private: 171 /// @brief Invalidated copy constructor. 172 MSChargingStation(const MSChargingStation&); 173 174 /// @brief Invalidated assignment operator. 175 MSChargingStation& operator=(const MSChargingStation&); 176 }; 177 178 #endif 179