Eclipse SUMO - Simulation of Urban MObility
MSDevice_Battery.cpp
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 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
27 #include <utils/common/SUMOTime.h>
28 #include <utils/geom/GeomHelper.h>
30 #include <microsim/MSNet.h>
31 #include <microsim/MSLane.h>
32 #include <microsim/MSEdge.h>
33 #include <microsim/MSVehicle.h>
34 #include "MSDevice_Tripinfo.h"
35 #include "MSDevice_Battery.h"
36 
37 #define DEFAULT_MAX_CAPACITY 35000
38 #define DEFAULT_CHARGE_RATIO 0.5
39 
40 
41 // ===========================================================================
42 // method definitions
43 // ===========================================================================
44 // ---------------------------------------------------------------------------
45 // static initialisation methods
46 // ---------------------------------------------------------------------------
47 void
49  insertDefaultAssignmentOptions("battery", "Battery", oc);
50 }
51 
52 
53 void
54 MSDevice_Battery::buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into) {
55  // Check if vehicle should get a battery
56  if (equippedByDefaultAssignmentOptions(OptionsCont::getOptions(), "battery", v, false)) {
58  const SUMOVTypeParameter& typeParams = v.getVehicleType().getParameter();
59  std::map<int, double> param;
60  // obtain maximumBatteryCapacity
61  const double maximumBatteryCapacity = typeParams.getDouble(toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY), DEFAULT_MAX_CAPACITY);
62 
63  // obtain actualBatteryCapacity
64  double actualBatteryCapacity = 0;
66  actualBatteryCapacity = maximumBatteryCapacity * DEFAULT_CHARGE_RATIO;
67  } else {
69  }
70 
71  const double powerMax = typeParams.getDouble(toString(SUMO_ATTR_MAXIMUMPOWER), 100.);
72  const double stoppingTreshold = typeParams.getDouble(toString(SUMO_ATTR_STOPPINGTRESHOLD), 0.1);
73 
84 
85  // battery constructor
86  MSDevice_Battery* device = new MSDevice_Battery(v, "battery_" + v.getID(),
87  actualBatteryCapacity, maximumBatteryCapacity, powerMax, stoppingTreshold, param);
88 
89  // Add device to vehicle
90  into.push_back(device);
91  }
92 }
93 
94 
95 bool MSDevice_Battery::notifyMove(SUMOTrafficObject& tObject, double /* oldPos */, double /* newPos */, double /* newSpeed */) {
96  if (!tObject.isVehicle()) {
97  return false;
98  }
99  SUMOVehicle& veh = static_cast<SUMOVehicle&>(tObject);
100  // Start vehicleStoppedTimer if the vehicle is stopped. In other case reset timer
101  if (veh.getSpeed() < myStoppingTreshold) {
102  // Increase vehicle stopped timer
104  } else {
105  // Reset vehicle Stopped
107  }
108 
109  // Update Energy from the battery
110  if (getMaximumBatteryCapacity() != 0) {
111  myParam[SUMO_ATTR_ANGLE] = myLastAngle == std::numeric_limits<double>::infinity() ? 0. : GeomHelper::angleDiff(myLastAngle, veh.getAngle());
113 
114  // Energy lost/gained from vehicle movement (via vehicle energy model) [Wh]
116 
117  // saturate between 0 and myMaximumBatteryCapacity [Wh]
118  if (getActualBatteryCapacity() < 0) {
120  if (getMaximumBatteryCapacity() > 0) {
121  WRITE_WARNING("Battery of vehicle '" + veh.getID() + "' is depleted.")
122  }
125  }
126  myLastAngle = veh.getAngle();
127  }
128 
129  // Check if vehicle has under their position one charge Station
130  const std::string chargingStationID = MSNet::getInstance()->getStoppingPlaceID(veh.getLane(), veh.getPositionOnLane(), SUMO_TAG_CHARGING_STATION);
131 
132  // If vehicle is over a charging station
133  if (chargingStationID != "") {
134  // if the vehicle is almost stopped, or charge in transit is enabled, then charge vehicle
135  MSChargingStation* const cs = static_cast<MSChargingStation*>(MSNet::getInstance()->getStoppingPlace(chargingStationID, SUMO_TAG_CHARGING_STATION));
136  if ((veh.getSpeed() < myStoppingTreshold) || cs->getChargeInTransit()) {
137  // Set Flags Stopped/intransit to
138  if (veh.getSpeed() < myStoppingTreshold) {
139  // vehicle ist almost stopped, then is charging stopped
140  myChargingStopped = true;
141 
142  // therefore isn't charging in transit
143  myChargingInTransit = false;
144  } else {
145  // vehicle is moving, and the Charging station allow charge in transit
146  myChargingStopped = false;
147 
148  // Therefore charge in transit
149  myChargingInTransit = true;
150  }
151 
152  // get pointer to charging station
154 
155  // Only update charging start time if vehicle allow charge in transit, or in other case
156  // if the vehicle not allow charge in transit but it's stopped.
158  // Update Charging start time
160  }
161 
162  // time it takes the vehicle at the station < charging station time delay?
164  // Enable charging vehicle
166 
167  // Calulate energy charged
169 
170  // Convert from [Ws] to [Wh] (3600s / 1h):
171  myEnergyCharged /= 3600;
172 
173  // Update Battery charge
176  } else {
178  }
179  }
180  // add charge value for output to myActChargingStation
182  }
183  }
184  // In other case, vehicle will be not charged
185  else {
186  // Disable flags
187  myChargingInTransit = false;
188  myChargingStopped = false;
189 
190  // Disable charging vehicle
191  if (myActChargingStation != nullptr) {
193  }
194 
195  // Set charging station pointer to NULL
196  myActChargingStation = nullptr;
197 
198  // Set energy charged to 0
199  myEnergyCharged = 0.00;
200 
201  // Reset timer
203  }
204 
205  // Always return true.
206  return true;
207 }
208 
209 
210 // ---------------------------------------------------------------------------
211 // MSDevice_Battery-methods
212 // ---------------------------------------------------------------------------
213 MSDevice_Battery::MSDevice_Battery(SUMOVehicle& holder, const std::string& id, const double actualBatteryCapacity, const double maximumBatteryCapacity,
214  const double powerMax, const double stoppingTreshold, const std::map<int, double>& param) :
215  MSVehicleDevice(holder, id),
216  myActualBatteryCapacity(0), // [actualBatteryCapacity <= maximumBatteryCapacity]
217  myMaximumBatteryCapacity(0), // [maximumBatteryCapacity >= 0]
218  myPowerMax(0), // [maximumPower >= 0]
219  myStoppingTreshold(0), // [stoppingTreshold >= 0]
220  myParam(param),
221  myLastAngle(std::numeric_limits<double>::infinity()),
222  myChargingStopped(false), // Initially vehicle don't charge stopped
223  myChargingInTransit(false), // Initially vehicle don't charge in transit
224  myConsum(0), // Initially the vehicle is stopped and therefore the consum is zero.
225  myActChargingStation(nullptr), // Initially the vehicle isn't over a Charging Station
226  myEnergyCharged(0), // Initially the energy charged is zero
227  myVehicleStopped(0) { // Initially the vehicle is stopped and the corresponding variable is 0
228 
229  if (maximumBatteryCapacity < 0) {
230  WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter " + toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY) + " (" + toString(maximumBatteryCapacity) + ").")
231  } else {
232  myMaximumBatteryCapacity = maximumBatteryCapacity;
233  }
234 
235  if (actualBatteryCapacity > maximumBatteryCapacity) {
236  WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' has a " + toString(SUMO_ATTR_ACTUALBATTERYCAPACITY) + " (" + toString(actualBatteryCapacity) + ") greater than it's " + toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY) + " (" + toString(maximumBatteryCapacity) + "). A max battery capacity value will be asigned");
238  } else {
239  myActualBatteryCapacity = actualBatteryCapacity;
240  }
241 
242  if (powerMax < 0) {
243  WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter " + toString(SUMO_ATTR_MAXIMUMPOWER) + " (" + toString(powerMax) + ").")
244  } else {
245  myPowerMax = powerMax;
246  }
247 
248  if (stoppingTreshold < 0) {
249  WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter " + toString(SUMO_ATTR_STOPPINGTRESHOLD) + " (" + toString(stoppingTreshold) + ").")
250  } else {
251  myStoppingTreshold = stoppingTreshold;
252  }
253 
264 }
265 
266 
268 }
269 
270 
271 void
272 MSDevice_Battery::checkParam(const SumoXMLAttr paramKey, const double lower, const double upper) {
273  if (myParam.find(paramKey) == myParam.end() || myParam.find(paramKey)->second < lower || myParam.find(paramKey)->second > upper) {
274  WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter " + toString(paramKey) + " (" + toString(myParam[paramKey]) + ").");
276  }
277 }
278 
279 
280 void
281 MSDevice_Battery::setActualBatteryCapacity(const double actualBatteryCapacity) {
282  if (actualBatteryCapacity < 0) {
284  } else if (actualBatteryCapacity > myMaximumBatteryCapacity) {
286  } else {
287  myActualBatteryCapacity = actualBatteryCapacity;
288  }
289 }
290 
291 
292 void
293 MSDevice_Battery::setMaximumBatteryCapacity(const double maximumBatteryCapacity) {
294  if (myMaximumBatteryCapacity < 0) {
295  WRITE_WARNING("Trying to set into the battery device of vehicle '" + getID() + "' an invalid " + toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY) + " (" + toString(maximumBatteryCapacity) + ").")
296  } else {
297  myMaximumBatteryCapacity = maximumBatteryCapacity;
298  }
299 }
300 
301 
302 void
303 MSDevice_Battery::setPowerMax(const double powerMax) {
304  if (myPowerMax < 0) {
305  WRITE_WARNING("Trying to set into the battery device of vehicle '" + getID() + "' an invalid " + toString(SUMO_ATTR_MAXIMUMPOWER) + " (" + toString(powerMax) + ").")
306  } else {
307  myPowerMax = powerMax;
308  }
309 }
310 
311 
312 void
313 MSDevice_Battery::setStoppingTreshold(const double stoppingTreshold) {
314  if (stoppingTreshold < 0) {
315  WRITE_WARNING("Trying to set into the battery device of vehicle '" + getID() + "' an invalid " + toString(SUMO_ATTR_STOPPINGTRESHOLD) + " (" + toString(stoppingTreshold) + ").")
316  } else {
317  myStoppingTreshold = stoppingTreshold;
318  }
319 }
320 
321 
322 void
325 }
326 
327 
328 void
331 }
332 
333 
334 void
336  myVehicleStopped = 0;
337 }
338 
339 
340 void
343 }
344 
345 
346 double
349 }
350 
351 
352 double
355 }
356 
357 
358 double
360  return myPowerMax;
361 }
362 
363 
364 double
366  return myConsum;
367 }
368 
369 
370 bool
372  return myChargingStopped;
373 }
374 
375 
376 bool
378  return myChargingInTransit;
379 }
380 
381 
382 double
384  return myChargingStartTime;
385 }
386 
387 
388 std::string
390  if (myActChargingStation != nullptr) {
391  return myActChargingStation->getID();
392  } else {
393  return "NULL";
394  }
395 }
396 
397 double
399  return myEnergyCharged;
400 }
401 
402 
403 int
405  return myVehicleStopped;
406 }
407 
408 
409 double
411  return myStoppingTreshold;
412 }
413 
414 
415 std::string
416 MSDevice_Battery::getParameter(const std::string& key) const {
419  } else if (key == toString(SUMO_ATTR_ENERGYCONSUMED)) {
420  return toString(getConsum());
421  } else if (key == toString(SUMO_ATTR_ENERGYCHARGED)) {
422  return toString(getEnergyCharged());
423  } else if (key == toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY)) {
425  } else if (key == toString(SUMO_ATTR_CHARGINGSTATIONID)) {
426  return getChargingStationID();
427  } else if (key == toString(SUMO_ATTR_VEHICLEMASS)) {
428  return toString(myParam.find(SUMO_ATTR_VEHICLEMASS)->second);
429  }
430  throw InvalidArgument("Parameter '" + key + "' is not supported for device of type '" + deviceName() + "'");
431 }
432 
433 
434 void
435 MSDevice_Battery::setParameter(const std::string& key, const std::string& value) {
436  double doubleValue;
437  try {
438  doubleValue = StringUtils::toDouble(value);
439  } catch (NumberFormatException&) {
440  throw InvalidArgument("Setting parameter '" + key + "' requires a number for device of type '" + deviceName() + "'");
441  }
443  setActualBatteryCapacity(doubleValue);
444  } else if (key == toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY)) {
445  setMaximumBatteryCapacity(doubleValue);
446  } else if (key == toString(SUMO_ATTR_VEHICLEMASS)) {
447  myParam[SUMO_ATTR_VEHICLEMASS] = doubleValue;
448  } else {
449  throw InvalidArgument("Setting parameter '" + key + "' is not supported for device of type '" + deviceName() + "'");
450  }
451 }
452 
453 /****************************************************************************/
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
SUMO_ATTR_ANGLE
Definition: SUMOXMLDefinitions.h:791
MSChargingStation::getChargingPower
double getChargingPower() const
Get charging station's charging power.
Definition: MSChargingStation.cpp:80
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
PollutantsInterface::getEnergyHelper
static const HelpersEnergy & getEnergyHelper()
get energy helper
Definition: PollutantsInterface.h:375
SUMO_ATTR_PROPULSIONEFFICIENCY
Propulsion efficiency.
Definition: SUMOXMLDefinitions.h:501
SUMO_ATTR_VEHICLEMASS
Vehicle mass.
Definition: SUMOXMLDefinitions.h:487
SUMOVehicle::getAngle
virtual double getAngle() const =0
Get the vehicle's angle.
MSDevice_Battery::getChargingStationID
std::string getChargingStationID() const
Get current Charging Station ID.
Definition: MSDevice_Battery.cpp:389
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
SUMOTime.h
MSNet.h
MSDevice_Battery::getStoppingTreshold
double getStoppingTreshold() const
Get stopping treshold.
Definition: MSDevice_Battery.cpp:410
SUMO_ATTR_MAXIMUMPOWER
Maximum Power.
Definition: SUMOXMLDefinitions.h:485
GeomHelper::angleDiff
static double angleDiff(const double angle1, const double angle2)
Returns the difference of the second angle to the first angle in radiants.
Definition: GeomHelper.cpp:181
HelpersEnergy::compute
double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const std::map< int, double > *param) const
Computes the emitted pollutant amount using the given speed and acceleration.
Definition: HelpersEnergy.cpp:54
SUMOVehicle::getParameter
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
SUMOTrafficObject::getAcceleration
virtual double getAcceleration() const =0
Returns the vehicle's acceleration.
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
OptionsCont.h
SUMOTrafficObject::getVehicleType
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
SUMO_ATTR_CHARGINGSTATIONID
Charging Station ID.
Definition: SUMOXMLDefinitions.h:517
SUMOTrafficObject::isVehicle
virtual bool isVehicle() const =0
Get the vehicle's ID.
MSDevice_Battery::getActualBatteryCapacity
double getActualBatteryCapacity() const
Get the actual vehicle's Battery Capacity in kWh.
Definition: MSDevice_Battery.cpp:347
StringUtils::toDouble
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
Definition: StringUtils.cpp:313
SUMOTrafficObject::getID
virtual const std::string & getID() const =0
Get the vehicle's ID.
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
SUMO_ATTR_CONSTANTPOWERINTAKE
Constant Power Intake.
Definition: SUMOXMLDefinitions.h:499
HelpersEnergy.h
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:61
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
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
SUMO_ATTR_MAXIMUMBATTERYCAPACITY
Maxium battery capacity.
Definition: SUMOXMLDefinitions.h:483
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
MSEdge.h
HelpersEnergy::getDefaultParam
double getDefaultParam(int paramKey) const
Definition: HelpersEnergy.h:65
MSNet::getStoppingPlaceID
std::string getStoppingPlaceID(const MSLane *lane, const double pos, const SumoXMLTag category) const
Returns the stop of the given category close to the given position.
Definition: MSNet.cpp:908
MSDevice_Battery.h
SUMO_ATTR_ENERGYCONSUMED
Energy consumed.
Definition: SUMOXMLDefinitions.h:515
Parameterised::getParameter
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
Definition: Parameterised.cpp:71
MSVehicle.h
MSChargingStation::setChargingVehicle
void setChargingVehicle(bool value)
enable or disable charging vehicle
Definition: MSChargingStation.cpp:140
MSChargingStation::getEfficency
double getEfficency() const
Get efficiency of the charging station.
Definition: MSChargingStation.cpp:86
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
SUMO_ATTR_RECUPERATIONEFFICIENCY
Recuperation efficiency (constant)
Definition: SUMOXMLDefinitions.h:503
NumberFormatException
Definition: UtilExceptions.h:96
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
SUMO_TAG_CHARGING_STATION
A Charging Station.
Definition: SUMOXMLDefinitions.h:112
MSDevice::insertDefaultAssignmentOptions
static void insertDefaultAssignmentOptions(const std::string &deviceName, const std::string &optionsTopic, OptionsCont &oc, const bool isPerson=false)
Adds common command options that allow to assign devices to vehicles.
Definition: MSDevice.cpp:126
MSDevice_Battery::increaseVehicleStoppedTimer
void increaseVehicleStoppedTimer()
Increase myVehicleStopped.
Definition: MSDevice_Battery.cpp:341
HelpersEnergy
Helper methods for energy-based electricity consumption computation based on the battery device.
Definition: HelpersEnergy.h:43
TS
#define TS
Definition: SUMOTime.h:44
MSDevice_Battery::myPowerMax
double myPowerMax
Parameter, The Maximum Power when accelerating, [myPowerMax >= 0].
Definition: MSDevice_Battery.h:173
SUMOVTypeParameter
Structure representing possible vehicle parameter.
Definition: SUMOVTypeParameter.h:86
SUMO_ATTR_STOPPINGTRESHOLD
Stopping treshold.
Definition: SUMOXMLDefinitions.h:507
SUMOVehicle::getLane
virtual MSLane * getLane() const =0
Returns the lane the vehicle is on.
MSDevice_Battery::increaseChargingStartTime
void increaseChargingStartTime()
Increase Charging Start time.
Definition: MSDevice_Battery.cpp:329
SUMO_ATTR_ACTUALBATTERYCAPACITY
Definition: SUMOXMLDefinitions.h:481
OutputDevice.h
SUMOTrafficObject::getSlope
virtual double getSlope() const =0
Returns the slope of the road at vehicle's position.
SUMO_ATTR_ROLLDRAGCOEFFICIENT
Roll Drag coefficient.
Definition: SUMOXMLDefinitions.h:497
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
PollutantsInterface::ELEC
Definition: PollutantsInterface.h:56
DEFAULT_MAX_CAPACITY
#define DEFAULT_MAX_CAPACITY
Definition: MSDevice_Battery.cpp:37
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
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
StringUtils.h
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
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:168
MSDevice::equippedByDefaultAssignmentOptions
static bool equippedByDefaultAssignmentOptions(const OptionsCont &oc, const std::string &deviceName, DEVICEHOLDER &v, bool outputOptionSet, const bool isPerson=false)
Determines whether a vehicle should get a certain device.
Definition: MSDevice.h:204
InvalidArgument
Definition: UtilExceptions.h:57
MSDevice_Battery::myStoppingTreshold
double myStoppingTreshold
Parameter, stopping vehicle treshold [myStoppingTreshold >= 0].
Definition: MSDevice_Battery.h:176
SUMO_ATTR_INTERNALMOMENTOFINERTIA
Internal moment of inertia.
Definition: SUMOXMLDefinitions.h:493
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
MSVehicleType::getParameter
const SUMOVTypeParameter & getParameter() const
Definition: MSVehicleType.h:556
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
MSChargingStation::addChargeValueForOutput
void addChargeValueForOutput(double WCharged, MSDevice_Battery *battery)
add charge value for output
Definition: MSChargingStation.cpp:162
MSDevice_Tripinfo.h
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
GeomHelper.h
SUMO_ATTR_ENERGYCHARGED
tgotal of Energy charged
Definition: SUMOXMLDefinitions.h:519
MSDevice_Battery::isChargingStopped
bool isChargingStopped() const
Get true if Vehicle is charging, false if not.
Definition: MSDevice_Battery.cpp:371
SUMO_ATTR_AIRDRAGCOEFFICIENT
Air drag coefficient.
Definition: SUMOXMLDefinitions.h:491
SUMO_ATTR_RADIALDRAGCOEFFICIENT
Radial drag coefficient.
Definition: SUMOXMLDefinitions.h:495
MSLane.h
MSDevice_Battery::getMaximumPower
double getMaximumPower() const
Get the maximum power when accelerating.
Definition: MSDevice_Battery.cpp:359
SUMOTrafficObject::getPositionOnLane
virtual double getPositionOnLane() const =0
Get the vehicle's position along the lane.
SUMO_ATTR_RECUPERATIONEFFICIENCY_BY_DECELERATION
Recuperation efficiency (by deceleration)
Definition: SUMOXMLDefinitions.h:505
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
MSChargingStation::getChargeDelay
double getChargeDelay() const
Get Charge Delay.
Definition: MSChargingStation.cpp:98
MSDevice_Battery::getChargingStartTime
double getChargingStartTime() const
Get charging start time.
Definition: MSDevice_Battery.cpp:383
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:77
MSDevice_Battery::getVehicleStopped
int getVehicleStopped() const
Get number of timestep that vehicle is stopped.
Definition: MSDevice_Battery.cpp:404
MSChargingStation::getChargeInTransit
bool getChargeInTransit() const
Get chargeInTransit.
Definition: MSChargingStation.cpp:92
DEFAULT_CHARGE_RATIO
#define DEFAULT_CHARGE_RATIO
Definition: MSDevice_Battery.cpp:38
Parameterised::getDouble
double getDouble(const std::string &key, const double defaultValue) const
Returns the value for a given key converted to a double.
Definition: Parameterised.cpp:81
SUMOTrafficObject::getSpeed
virtual double getSpeed() const =0
Returns the vehicle's current speed.
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
SUMO_ATTR_FRONTSURFACEAREA
Front surface area.
Definition: SUMOXMLDefinitions.h:489
MSVehicleDevice
Abstract in-vehicle device.
Definition: MSVehicleDevice.h:55