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 /****************************************************************************/
16 // The Battery parameters for the vehicle
17 /****************************************************************************/
18 #ifndef MSDevice_Battery_h
19 #define MSDevice_Battery_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
28 #include <microsim/MSVehicle.h>
30 #include <utils/common/SUMOTime.h>
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class SUMOVehicle;
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
47 public:
51  static void insertOptions(OptionsCont& oc);
52 
63  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into);
64 
65 public:
68 
71 
80  bool notifyMove(SUMOTrafficObject& veh, double oldPos, double newPos, double newSpeed);
82 
84  const std::string deviceName() const {
85  return "battery";
86  }
87 
89  std::string getParameter(const std::string& key) const;
90 
92  void setParameter(const std::string& key, const std::string& value);
93 
94 private:
102  MSDevice_Battery(SUMOVehicle& holder, const std::string& id, const double actualBatteryCapacity, const double maximumBatteryCapacity,
103  const double powerMax, const double stoppingTreshold, const std::map<int, double>& param);
104 
105  void checkParam(const SumoXMLAttr paramKey, const double lower = 0., const double upper = std::numeric_limits<double>::infinity());
106 
107 public:
109  double getActualBatteryCapacity() const;
110 
112  double getMaximumBatteryCapacity() const;
113 
115  double getMaximumPower() const;
116 
118  bool isChargingStopped() const;
119 
121  bool isChargingInTransit() const;
122 
124  double getChargingStartTime() const;
125 
127  double getConsum() const;
128 
130  std::string getChargingStationID() const;
131 
133  double getEnergyCharged() const;
134 
136  int getVehicleStopped() const;
137 
139  double getStoppingTreshold() const;
140 
142  void setActualBatteryCapacity(const double actualBatteryCapacity);
143 
145  void setMaximumBatteryCapacity(const double maximumBatteryCapacity);
146 
148  void setPowerMax(const double new_Pmax);
149 
151  void setStoppingTreshold(const double stoppingTreshold);
152 
154  void resetChargingStartTime();
155 
158 
161 
164 
165 protected:
168 
171 
173  double myPowerMax;
174 
177 
179  std::map<int, double> myParam;
180 
182  double myLastAngle;
183 
186 
189 
192 
194  double myConsum;
195 
198 
201 
204 
205 private:
208 
211 };
212 
213 #endif
214 
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:48
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:200
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:194
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:61
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:84
MSDevice_Battery::myActualBatteryCapacity
double myActualBatteryCapacity
Parameter, The actual vehicles's Battery Capacity in kWh, [myActualBatteryCapacity <= myMaximumBatter...
Definition: MSDevice_Battery.h:167
MSDevice_Battery::myChargingInTransit
bool myChargingInTransit
Parameter, Flag: Vehicles it's charging in transit (by default is false)
Definition: MSDevice_Battery.h:188
MSDevice_Battery::myVehicleStopped
int myVehicleStopped
Parameter, How many timestep the vehicle is stopped.
Definition: MSDevice_Battery.h:203
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:173
MSDevice_Battery::increaseChargingStartTime
void increaseChargingStartTime()
Increase Charging Start time.
Definition: MSDevice_Battery.cpp:329
MSChargingStation
Definition: MSChargingStation.h:51
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:90
MSDevice_Battery
Battery device for electric vehicles.
Definition: MSDevice_Battery.h:46
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:176
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:170
MSDevice_Battery::myChargingStopped
bool myChargingStopped
Parameter, Flag: Vehicles it's charging stopped (by default is false)
Definition: MSDevice_Battery.h:185
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:191
MSDevice_Battery::myParam
std::map< int, double > myParam
Parameter collection.
Definition: MSDevice_Battery.h:179
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:182
MSDevice_Battery::insertOptions
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Example-options.
Definition: MSDevice_Battery.cpp:48
MSDevice_Battery::buildVehicleDevices
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
Definition: MSDevice_Battery.cpp:54
MSDevice_Battery::myActChargingStation
MSChargingStation * myActChargingStation
Parameter, Pointer to current charging station in which vehicle is placed (by default is NULL)
Definition: MSDevice_Battery.h:197
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:373
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:55