Eclipse SUMO - Simulation of Urban MObility
MSDevice_Battery.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2013-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 /****************************************************************************/
15 // The Battery parameters for the vehicle
16 /****************************************************************************/
17 #ifndef MSDevice_Battery_h
18 #define MSDevice_Battery_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
27 #include <microsim/MSVehicle.h>
29 #include <utils/common/SUMOTime.h>
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class SUMOVehicle;
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
46 public:
50  static void insertOptions(OptionsCont& oc);
51 
62  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into);
63 
64 public:
67 
70 
79  bool notifyMove(SUMOTrafficObject& veh, double oldPos, double newPos, double newSpeed);
81 
83  const std::string deviceName() const {
84  return "battery";
85  }
86 
88  std::string getParameter(const std::string& key) const;
89 
91  void setParameter(const std::string& key, const std::string& value);
92 
93 private:
101  MSDevice_Battery(SUMOVehicle& holder, const std::string& id, const double actualBatteryCapacity, const double maximumBatteryCapacity,
102  const double powerMax, const double stoppingTreshold, const std::map<int, double>& param);
103 
104  void checkParam(const SumoXMLAttr paramKey, const double lower = 0., const double upper = std::numeric_limits<double>::infinity());
105 
106 public:
108  double getActualBatteryCapacity() const;
109 
111  double getMaximumBatteryCapacity() const;
112 
114  double getMaximumPower() const;
115 
117  bool isChargingStopped() const;
118 
120  bool isChargingInTransit() const;
121 
123  double getChargingStartTime() const;
124 
126  double getConsum() const;
127 
129  std::string getChargingStationID() const;
130 
132  double getEnergyCharged() const;
133 
135  int getVehicleStopped() const;
136 
138  double getStoppingTreshold() const;
139 
141  void setActualBatteryCapacity(const double actualBatteryCapacity);
142 
144  void setMaximumBatteryCapacity(const double maximumBatteryCapacity);
145 
147  void setPowerMax(const double new_Pmax);
148 
150  void setStoppingTreshold(const double stoppingTreshold);
151 
153  void resetChargingStartTime();
154 
157 
160 
163 
165  const std::map<int, double>& getEnergyParams() const {
166  return myParam;
167  }
168 
169 protected:
172 
175 
177  double myPowerMax;
178 
181 
183  std::map<int, double> myParam;
184 
186  double myLastAngle;
187 
190 
193 
196 
198  double myConsum;
199 
202 
205 
208 
209 private:
212 
215 };
216 
217 #endif
218 
MSDevice_Battery::checkParam
void checkParam(const SumoXMLAttr paramKey, const double lower=0., const double upper=std::numeric_limits< double >::infinity())
Definition: MSDevice_Battery.cpp:272
MSDevice_Battery::~MSDevice_Battery
~MSDevice_Battery()
Destructor.
Definition: MSDevice_Battery.cpp:267
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:47
MSDevice_Battery::getMaximumBatteryCapacity
double getMaximumBatteryCapacity() const
Get the total vehicle's Battery Capacity in kWh.
Definition: MSDevice_Battery.cpp:353
MSDevice_Battery::getChargingStationID
std::string getChargingStationID() const
Get current Charging Station ID.
Definition: MSDevice_Battery.cpp:389
SUMOTime.h
MSDevice_Battery::getStoppingTreshold
double getStoppingTreshold() const
Get stopping treshold.
Definition: MSDevice_Battery.cpp:410
MSVehicleDevice.h
MSDevice_Battery::myEnergyCharged
double myEnergyCharged
Parameter, Energy charged in each timestep.
Definition: MSDevice_Battery.h:204
MSDevice_Battery::getEnergyCharged
double getEnergyCharged() const
Get charged energy.
Definition: MSDevice_Battery.cpp:398
MSDevice_Battery::getActualBatteryCapacity
double getActualBatteryCapacity() const
Get the actual vehicle's Battery Capacity in kWh.
Definition: MSDevice_Battery.cpp:347
MSDevice_Battery::getParameter
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key
Definition: MSDevice_Battery.cpp:416
MSDevice_Battery::myConsum
double myConsum
Parameter, Vehicle consum during a time step (by default is 0.)
Definition: MSDevice_Battery.h:198
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:60
MSDevice_Battery::notifyMove
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
Definition: MSDevice_Battery.cpp:95
MSChargingStation.h
MSDevice_Battery::setStoppingTreshold
void setStoppingTreshold(const double stoppingTreshold)
Set vehicle's stopping treshold.
Definition: MSDevice_Battery.cpp:313
MSDevice_Battery::setActualBatteryCapacity
void setActualBatteryCapacity(const double actualBatteryCapacity)
Set actual vehicle's Battery Capacity in kWh.
Definition: MSDevice_Battery.cpp:281
MSVehicle.h
MSDevice_Battery::deviceName
const std::string deviceName() const
return the name for this type of device
Definition: MSDevice_Battery.h:83
MSDevice_Battery::myActualBatteryCapacity
double myActualBatteryCapacity
Parameter, The actual vehicles's Battery Capacity in kWh, [myActualBatteryCapacity <= myMaximumBatter...
Definition: MSDevice_Battery.h:171
MSDevice_Battery::myChargingInTransit
bool myChargingInTransit
Parameter, Flag: Vehicles it's charging in transit (by default is false)
Definition: MSDevice_Battery.h:192
MSDevice_Battery::myVehicleStopped
int myVehicleStopped
Parameter, How many timestep the vehicle is stopped.
Definition: MSDevice_Battery.h:207
MSDevice_Battery::increaseVehicleStoppedTimer
void increaseVehicleStoppedTimer()
Increase myVehicleStopped.
Definition: MSDevice_Battery.cpp:341
MSDevice_Battery::myPowerMax
double myPowerMax
Parameter, The Maximum Power when accelerating, [myPowerMax >= 0].
Definition: MSDevice_Battery.h:177
MSDevice_Battery::increaseChargingStartTime
void increaseChargingStartTime()
Increase Charging Start time.
Definition: MSDevice_Battery.cpp:329
MSChargingStation
Definition: MSChargingStation.h:50
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
MSDevice_Battery
Battery device for electric vehicles.
Definition: MSDevice_Battery.h:45
MSDevice_Battery::resetVehicleStoppedTimer
void resetVehicleStoppedTimer()
Reset myVehicleStopped.
Definition: MSDevice_Battery.cpp:335
MSDevice_Battery::getConsum
double getConsum() const
Get consum.
Definition: MSDevice_Battery.cpp:365
MSDevice_Battery::MSDevice_Battery
MSDevice_Battery(SUMOVehicle &holder, const std::string &id, const double actualBatteryCapacity, const double maximumBatteryCapacity, const double powerMax, const double stoppingTreshold, const std::map< int, double > &param)
Constructor.
Definition: MSDevice_Battery.cpp:213
MSDevice_Battery::operator=
MSDevice_Battery & operator=(const MSDevice_Battery &)
Invalidated assignment operator.
MSDevice_Battery::myStoppingTreshold
double myStoppingTreshold
Parameter, stopping vehicle treshold [myStoppingTreshold >= 0].
Definition: MSDevice_Battery.h:180
MSDevice_Battery::resetChargingStartTime
void resetChargingStartTime()
Reset charging start time.
Definition: MSDevice_Battery.cpp:323
MSDevice_Battery::myMaximumBatteryCapacity
double myMaximumBatteryCapacity
Parameter, The total vehicles's Battery Capacity in kWh, [myMaximumBatteryCapacity >= 0].
Definition: MSDevice_Battery.h:174
MSDevice_Battery::myChargingStopped
bool myChargingStopped
Parameter, Flag: Vehicles it's charging stopped (by default is false)
Definition: MSDevice_Battery.h:189
MSDevice_Battery::getEnergyParams
const std::map< int, double > & getEnergyParams() const
retrieve parameters for the energy consumption model
Definition: MSDevice_Battery.h:165
MSDevice_Battery::setPowerMax
void setPowerMax(const double new_Pmax)
Set maximum power when accelerating.
Definition: MSDevice_Battery.cpp:303
MSDevice_Battery::myChargingStartTime
double myChargingStartTime
Parameter, Moment, wich the vehicle has beging to charging.
Definition: MSDevice_Battery.h:195
MSDevice_Battery::myParam
std::map< int, double > myParam
Parameter collection.
Definition: MSDevice_Battery.h:183
MSDevice_Battery::isChargingInTransit
bool isChargingInTransit() const
Get true if Vehicle it's charging, false if not.
Definition: MSDevice_Battery.cpp:377
config.h
MSDevice_Battery::myLastAngle
double myLastAngle
Parameter, Vehicle's last angle.
Definition: MSDevice_Battery.h:186
MSDevice_Battery::insertOptions
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Example-options.
Definition: MSDevice_Battery.cpp:47
MSDevice_Battery::buildVehicleDevices
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
Definition: MSDevice_Battery.cpp:53
MSDevice_Battery::myActChargingStation
MSChargingStation * myActChargingStation
Parameter, Pointer to current charging station in which vehicle is placed (by default is NULL)
Definition: MSDevice_Battery.h:201
MSDevice_Battery::setMaximumBatteryCapacity
void setMaximumBatteryCapacity(const double maximumBatteryCapacity)
Set total vehicle's Battery Capacity in kWh.
Definition: MSDevice_Battery.cpp:293
MSDevice_Battery::isChargingStopped
bool isChargingStopped() const
Get true if Vehicle is charging, false if not.
Definition: MSDevice_Battery.cpp:371
MSDevice_Battery::getMaximumPower
double getMaximumPower() const
Get the maximum power when accelerating.
Definition: MSDevice_Battery.cpp:359
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
MSDevice_Battery::getChargingStartTime
double getChargingStartTime() const
Get charging start time.
Definition: MSDevice_Battery.cpp:383
MSDevice_Battery::getVehicleStopped
int getVehicleStopped() const
Get number of timestep that vehicle is stopped.
Definition: MSDevice_Battery.cpp:404
MSDevice_Battery::setParameter
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key
Definition: MSDevice_Battery.cpp:435
MSVehicleDevice
Abstract in-vehicle device.
Definition: MSVehicleDevice.h:54