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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // The Battery parameters for the vehicle
19 /****************************************************************************/
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #ifndef MSDevice_Battery_h
32 #define MSDevice_Battery_h
33 
35 #include <microsim/MSVehicle.h>
37 #include <utils/common/SUMOTime.h>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class SUMOVehicle;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
53 class MSDevice_Battery : public MSDevice {
54 public:
58  static void insertOptions(OptionsCont& oc);
59 
70  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSDevice*>& into);
71 
72 public:
75 
78 
87  bool notifyMove(SUMOVehicle& veh, double oldPos, double newPos, double newSpeed);
89 
91  const std::string deviceName() const {
92  return "battery";
93  }
94 
96  std::string getParameter(const std::string& key) const;
97 
99  void setParameter(const std::string& key, const std::string& value);
100 
101 private:
109  MSDevice_Battery(SUMOVehicle& holder, const std::string& id, const double actualBatteryCapacity, const double maximumBatteryCapacity,
110  const double powerMax, const double stoppingTreshold, const std::map<int, double>& param);
111 
112  void checkParam(const SumoXMLAttr paramKey, const double lower = 0., const double upper = std::numeric_limits<double>::infinity());
113 
114 public:
116  double getActualBatteryCapacity() const;
117 
119  double getMaximumBatteryCapacity() const;
120 
122  double getMaximumPower() const;
123 
125  bool isChargingStopped() const;
126 
128  bool isChargingInTransit() const;
129 
131  double getChargingStartTime() const;
132 
134  double getConsum() const;
135 
137  std::string getChargingStationID() const;
138 
140  double getEnergyCharged() const;
141 
143  int getVehicleStopped() const;
144 
146  double getStoppingTreshold() const;
147 
149  void setActualBatteryCapacity(const double actualBatteryCapacity);
150 
152  void setMaximumBatteryCapacity(const double maximumBatteryCapacity);
153 
155  void setPowerMax(const double new_Pmax);
156 
158  void setStoppingTreshold(const double stoppingTreshold);
159 
161  void resetChargingStartTime();
162 
165 
168 
171 
172 protected:
175 
178 
180  double myPowerMax;
181 
184 
186  std::map<int, double> myParam;
187 
189  double myLastAngle;
190 
193 
196 
199 
201  double myConsum;
202 
205 
208 
211 
212 private:
215 
218 };
219 
220 #endif
221 
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key ...
bool notifyMove(SUMOVehicle &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
MSChargingStation * myActChargingStation
Parameter, Pointer to current charging station in which vehicle is placed (by default is NULL) ...
double getStoppingTreshold() const
Get stopping treshold.
double getMaximumBatteryCapacity() const
Get the total vehicle&#39;s Battery Capacity in kWh.
std::map< int, double > myParam
Parameter collection.
double myActualBatteryCapacity
Parameter, The actual vehicles&#39;s Battery Capacity in kWh, [myActualBatteryCapacity <= myMaximumBatter...
void increaseVehicleStoppedTimer()
Increase myVehicleStopped.
double getChargingStartTime() const
Get charging start time.
double getActualBatteryCapacity() const
Get the actual vehicle&#39;s Battery Capacity in kWh.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice *> &into)
Build devices for the given vehicle, if needed.
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.
void checkParam(const SumoXMLAttr paramKey, const double lower=0., const double upper=std::numeric_limits< double >::infinity())
int myVehicleStopped
Parameter, How many timestep the vehicle is stopped.
std::string getChargingStationID() const
Get current Charging Station ID.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
int getVehicleStopped() const
Get number of timestep that vehicle is stopped.
bool myChargingStopped
Parameter, Flag: Vehicles it&#39;s charging stopped (by default is false)
void setPowerMax(const double new_Pmax)
Set maximum power when accelerating.
bool isChargingStopped() const
Get true if Vehicle is charging, false if not.
void setMaximumBatteryCapacity(const double maximumBatteryCapacity)
Set total vehicle&#39;s Battery Capacity in kWh.
void setActualBatteryCapacity(const double actualBatteryCapacity)
Set actual vehicle&#39;s Battery Capacity in kWh.
void resetVehicleStoppedTimer()
Reset myVehicleStopped.
double myChargingStartTime
Parameter, Moment, wich the vehicle has beging to charging.
Representation of a vehicle.
Definition: SUMOVehicle.h:66
void resetChargingStartTime()
Reset charging start time.
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key ...
double getEnergyCharged() const
Get charged energy.
MSDevice_Battery & operator=(const MSDevice_Battery &)
Invalidated assignment operator.
double myMaximumBatteryCapacity
Parameter, The total vehicles&#39;s Battery Capacity in kWh, [myMaximumBatteryCapacity >= 0]...
const std::string deviceName() const
return the name for this type of device
void setStoppingTreshold(const double stoppingTreshold)
Set vehicle&#39;s stopping treshold.
bool myChargingInTransit
Parameter, Flag: Vehicles it&#39;s charging in transit (by default is false)
double myConsum
Parameter, Vehicle consum during a time step (by default is 0.)
Abstract in-vehicle device.
Definition: MSDevice.h:70
Battery device for electric vehicles.
double getMaximumPower() const
Get the maximum power when accelerating.
double myStoppingTreshold
Parameter, stopping vehicle treshold [myStoppingTreshold >= 0].
void increaseChargingStartTime()
Increase Charging Start time.
double myLastAngle
Parameter, Vehicle&#39;s last angle.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Example-options.
A storage for options typed value containers)
Definition: OptionsCont.h:98
bool isChargingInTransit() const
Get true if Vehicle it&#39;s charging, false if not.
double myEnergyCharged
Parameter, Energy charged in each timestep.
double getConsum() const
Get consum.
double myPowerMax
Parameter, The Maximum Power when accelerating, [myPowerMax >= 0].
~MSDevice_Battery()
Destructor.