SUMO - Simulation of Urban MObility
MSDevice_Battery.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // The Battery parameters for the vehicle
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #ifndef MSDevice_Battery_h
33 #define MSDevice_Battery_h
34 
36 #include <microsim/MSVehicle.h>
38 #include <utils/common/SUMOTime.h>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class SUMOVehicle;
45 
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
54 class MSDevice_Battery : public MSDevice {
55 public:
59  static void insertOptions(OptionsCont& oc);
60 
71  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSDevice*>& into);
72 
73 public:
76 
79 
88  bool notifyMove(SUMOVehicle& veh, double oldPos, double newPos, double newSpeed);
90 
92  const std::string deviceName() const {
93  return "battery";
94  }
95 
97  std::string getParameter(const std::string& key) const;
98 
100  void setParameter(const std::string& key, const std::string& value);
101 
102 private:
110  MSDevice_Battery(SUMOVehicle& holder, const std::string& id, const double actualBatteryCapacity, const double maximumBatteryCapacity,
111  const double powerMax, const double stoppingTreshold, const std::map<int, double>& param);
112 
113  void checkParam(const SumoXMLAttr paramKey, const double lower = 0., const double upper = std::numeric_limits<double>::infinity());
114 
115 public:
117  double getActualBatteryCapacity() const;
118 
120  double getMaximumBatteryCapacity() const;
121 
123  double getMaximumPower() const;
124 
126  bool isChargingStopped() const;
127 
129  bool isChargingInTransit() const;
130 
132  double getChargingStartTime() const;
133 
135  double getConsum() const;
136 
138  std::string getChargingStationID() const;
139 
141  double getEnergyCharged() const;
142 
144  int getVehicleStopped() const;
145 
147  double getStoppingTreshold() const;
148 
150  void setActualBatteryCapacity(const double actualBatteryCapacity);
151 
153  void setMaximumBatteryCapacity(const double maximumBatteryCapacity);
154 
156  void setPowerMax(const double new_Pmax);
157 
159  void setStoppingTreshold(const double stoppingTreshold);
160 
162  void resetChargingStartTime();
163 
166 
169 
172 
173 protected:
176 
179 
181  double myPowerMax;
182 
185 
187  std::map<int, double> myParam;
188 
190  double myLastAngle;
191 
194 
197 
200 
202  double myConsum;
203 
206 
209 
212 
213 private:
216 
219 };
220 
221 #endif
222 
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:67
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:71
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:99
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.