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-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // The Battery parameters for the vehicle
20 /****************************************************************************/
21 #include <config.h>
22 
26 #include <utils/common/SUMOTime.h>
27 #include <utils/geom/GeomHelper.h>
29 #include <microsim/MSNet.h>
30 #include <microsim/MSLane.h>
31 #include <microsim/MSEdge.h>
32 #include <microsim/MSVehicle.h>
33 #include "MSDevice_Tripinfo.h"
34 #include "MSDevice_Battery.h"
35 
36 #define DEFAULT_MAX_CAPACITY 35000
37 #define DEFAULT_CHARGE_RATIO 0.5
38 
39 
40 // ===========================================================================
41 // method definitions
42 // ===========================================================================
43 // ---------------------------------------------------------------------------
44 // static initialisation methods
45 // ---------------------------------------------------------------------------
46 void
48  insertDefaultAssignmentOptions("battery", "Battery", oc);
49  // custom options
50  oc.doRegister("device.battery.track-fuel", new Option_Bool(false));
51  oc.addDescription("device.battery.track-fuel", "Battery", "Track fuel consumption for non-electric vehicles");
52 }
53 
54 
55 void
56 MSDevice_Battery::buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into) {
57  // Check if vehicle should get a battery
58  if (equippedByDefaultAssignmentOptions(OptionsCont::getOptions(), "battery", v, false)) {
59  const SUMOVTypeParameter& typeParams = v.getVehicleType().getParameter();
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 = typeParams.getDouble(toString(SUMO_ATTR_ACTUALBATTERYCAPACITY),
67  maximumBatteryCapacity * DEFAULT_CHARGE_RATIO);
68  } else {
70  }
71 
72  const double powerMax = typeParams.getDouble(toString(SUMO_ATTR_MAXIMUMPOWER), 100.);
73  const double stoppingTreshold = typeParams.getDouble(toString(SUMO_ATTR_STOPPINGTRESHOLD), 0.1);
75 
76  // battery constructor
77  MSDevice_Battery* device = new MSDevice_Battery(v, "battery_" + v.getID(),
78  actualBatteryCapacity, maximumBatteryCapacity, powerMax, stoppingTreshold, params);
79 
80  // Add device to vehicle
81  into.push_back(device);
82  }
83 }
84 
85 
86 bool MSDevice_Battery::notifyMove(SUMOTrafficObject& tObject, double /* oldPos */, double /* newPos */, double /* newSpeed */) {
87  if (!tObject.isVehicle()) {
88  return false;
89  }
90  SUMOVehicle& veh = static_cast<SUMOVehicle&>(tObject);
91  // Start vehicleStoppedTimer if the vehicle is stopped. In other case reset timer
92  if (veh.getSpeed() < myStoppingTreshold) {
93  // Increase vehicle stopped timer
95  } else {
96  // Reset vehicle Stopped
98  }
99 
100  // Update Energy from the battery
101  if (getMaximumBatteryCapacity() != 0) {
102  myParam.setDouble(SUMO_ATTR_ANGLE, myLastAngle == std::numeric_limits<double>::infinity() ? 0. : GeomHelper::angleDiff(myLastAngle, veh.getAngle()));
103  if (myTrackFuel) {
104  // [ml]
106  } else {
107  // [Wh]
109  }
110  if (veh.isParking()) {
111  // recuperation from last braking step is ok but further consumption should cease
112  myConsum = MIN2(myConsum, 0.0);
113  }
114 
115  // Energy lost/gained from vehicle movement (via vehicle energy model) [Wh]
117 
118  // Track total energy consumption and regeneration
119  if (myConsum > 0.0) {
121  } else {
123  }
124 
125  // saturate between 0 and myMaximumBatteryCapacity [Wh]
126  if (getActualBatteryCapacity() < 0) {
128  if (getMaximumBatteryCapacity() > 0) {
129  WRITE_WARNING("Battery of vehicle '" + veh.getID() + "' is depleted.")
130  }
133  }
134  myLastAngle = veh.getAngle();
135  }
136 
137  // Check if vehicle has under their position one charge Station
138  const std::string chargingStationID = MSNet::getInstance()->getStoppingPlaceID(veh.getLane(), veh.getPositionOnLane(), SUMO_TAG_CHARGING_STATION);
139 
140  // If vehicle is over a charging station
141  if (chargingStationID != "") {
142  // if the vehicle is almost stopped, or charge in transit is enabled, then charge vehicle
143  MSChargingStation* const cs = static_cast<MSChargingStation*>(MSNet::getInstance()->getStoppingPlace(chargingStationID, SUMO_TAG_CHARGING_STATION));
144  if ((veh.getSpeed() < myStoppingTreshold) || cs->getChargeInTransit()) {
145  // Set Flags Stopped/intransit to
146  if (veh.getSpeed() < myStoppingTreshold) {
147  // vehicle ist almost stopped, then is charging stopped
148  myChargingStopped = true;
149 
150  // therefore isn't charging in transit
151  myChargingInTransit = false;
152  } else {
153  // vehicle is moving, and the Charging station allow charge in transit
154  myChargingStopped = false;
155 
156  // Therefore charge in transit
157  myChargingInTransit = true;
158  }
159 
160  // get pointer to charging station
162 
163  // Only update charging start time if vehicle allow charge in transit, or in other case
164  // if the vehicle not allow charge in transit but it's stopped.
166  // Update Charging start time
168  }
169 
170  // time it takes the vehicle at the station < charging station time delay?
172  // Enable charging vehicle
174 
175  // Calulate energy charged
177 
178  // Update Battery charge
181  } else {
183  }
184  }
185  // add charge value for output to myActChargingStation
187  }
188  // else disable charging vehicle
189  else {
190  cs->setChargingVehicle(false);
191  }
192  // disable charging vehicle from previous (not current) ChargingStation (reason: if there is no gap between two different chargingStations = the vehicle switches from used charging station to other one in a single timestap)
195  }
197  }
198  // In other case, vehicle will be not charged
199  else {
200  // Disable flags
201  myChargingInTransit = false;
202  myChargingStopped = false;
203 
204  // Disable charging vehicle
205  if (myActChargingStation != nullptr) {
207  }
208 
209  // Set charging station pointer to NULL
210  myActChargingStation = nullptr;
211 
212  // Set energy charged to 0
213  myEnergyCharged = 0.00;
214 
215  // Reset timer
217  }
218 
219  // Always return true.
220  return true;
221 }
222 
223 
224 // ---------------------------------------------------------------------------
225 // MSDevice_Battery-methods
226 // ---------------------------------------------------------------------------
227 MSDevice_Battery::MSDevice_Battery(SUMOVehicle& holder, const std::string& id, const double actualBatteryCapacity, const double maximumBatteryCapacity,
228  const double powerMax, const double stoppingTreshold, const EnergyParams& param) :
229  MSVehicleDevice(holder, id),
230  myActualBatteryCapacity(0), // [actualBatteryCapacity <= maximumBatteryCapacity]
231  myMaximumBatteryCapacity(0), // [maximumBatteryCapacity >= 0]
232  myPowerMax(0), // [maximumPower >= 0]
233  myStoppingTreshold(0), // [stoppingTreshold >= 0]
234  myParam(param),
235  myLastAngle(std::numeric_limits<double>::infinity()),
236  myChargingStopped(false), // Initially vehicle don't charge stopped
237  myChargingInTransit(false), // Initially vehicle don't charge in transit
238  myChargingStartTime(0), // Initially charging start time (must be if the vehicle was launched at the charging station)
239  myConsum(0), // Initially the vehicle is stopped and therefore the consum is zero.
240  myTotalConsumption(0.0),
241  myTotalRegenerated(0.0),
242  myActChargingStation(nullptr), // Initially the vehicle isn't over a Charging Station
243  myPreviousNeighbouringChargingStation(nullptr), // Initially the vehicle wasn't over a Charging Station
244  myEnergyCharged(0), // Initially the energy charged is zero
245  myVehicleStopped(0) { // Initially the vehicle is stopped and the corresponding variable is 0
246 
247  if (maximumBatteryCapacity < 0) {
248  WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter " + toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY) + " (" + toString(maximumBatteryCapacity) + ").")
249  } else {
250  myMaximumBatteryCapacity = maximumBatteryCapacity;
251  }
252 
253  if (actualBatteryCapacity > maximumBatteryCapacity) {
254  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");
256  } else {
257  myActualBatteryCapacity = actualBatteryCapacity;
258  }
259 
260  if (powerMax < 0) {
261  WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter " + toString(SUMO_ATTR_MAXIMUMPOWER) + " (" + toString(powerMax) + ").")
262  } else {
263  myPowerMax = powerMax;
264  }
265 
266  if (stoppingTreshold < 0) {
267  WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter " + toString(SUMO_ATTR_STOPPINGTRESHOLD) + " (" + toString(stoppingTreshold) + ").")
268  } else {
269  myStoppingTreshold = stoppingTreshold;
270  }
271 
282 
284 }
285 
286 
288 }
289 
290 
291 void
292 MSDevice_Battery::checkParam(const SumoXMLAttr paramKey, const double lower, const double upper) {
293  if (!myParam.knowsParameter(paramKey)
294  || myParam.getDouble(paramKey) < lower
295  || myParam.getDouble(paramKey) > upper) {
296  WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter " + toString(paramKey) + " (" + toString(myParam.getDouble(paramKey)) + ").");
297  myParam.setDouble(paramKey, PollutantsInterface::getEnergyHelper().getDefaultParam(paramKey));
298  }
299 }
300 
301 
302 void
303 MSDevice_Battery::setActualBatteryCapacity(const double actualBatteryCapacity) {
304  if (actualBatteryCapacity < 0) {
306  } else if (actualBatteryCapacity > myMaximumBatteryCapacity) {
308  } else {
309  myActualBatteryCapacity = actualBatteryCapacity;
310  }
311 }
312 
313 
314 void
315 MSDevice_Battery::setMaximumBatteryCapacity(const double maximumBatteryCapacity) {
316  if (myMaximumBatteryCapacity < 0) {
317  WRITE_WARNING("Trying to set into the battery device of vehicle '" + getID() + "' an invalid " + toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY) + " (" + toString(maximumBatteryCapacity) + ").")
318  } else {
319  myMaximumBatteryCapacity = maximumBatteryCapacity;
320  }
321 }
322 
323 
324 void
325 MSDevice_Battery::setPowerMax(const double powerMax) {
326  if (myPowerMax < 0) {
327  WRITE_WARNING("Trying to set into the battery device of vehicle '" + getID() + "' an invalid " + toString(SUMO_ATTR_MAXIMUMPOWER) + " (" + toString(powerMax) + ").")
328  } else {
329  myPowerMax = powerMax;
330  }
331 }
332 
333 
334 void
335 MSDevice_Battery::setStoppingTreshold(const double stoppingTreshold) {
336  if (stoppingTreshold < 0) {
337  WRITE_WARNING("Trying to set into the battery device of vehicle '" + getID() + "' an invalid " + toString(SUMO_ATTR_STOPPINGTRESHOLD) + " (" + toString(stoppingTreshold) + ").")
338  } else {
339  myStoppingTreshold = stoppingTreshold;
340  }
341 }
342 
343 
344 void
347 }
348 
349 
350 void
353 }
354 
355 
356 void
358  myVehicleStopped = 0;
359 }
360 
361 
362 void
365 }
366 
367 
368 double
371 }
372 
373 
374 double
377 }
378 
379 
380 double
382  return myPowerMax;
383 }
384 
385 
386 double
388  return myConsum;
389 }
390 
391 double
393  return myTotalConsumption;
394 }
395 
396 
397 double
399  return myTotalRegenerated;
400 }
401 
402 
403 bool
405  return myChargingStopped;
406 }
407 
408 
409 bool
411  return myChargingInTransit;
412 }
413 
414 
415 SUMOTime
417  return myChargingStartTime;
418 }
419 
420 
421 std::string
423  if (myActChargingStation != nullptr) {
424  return myActChargingStation->getID();
425  } else {
426  return "NULL";
427  }
428 }
429 
430 double
432  return myEnergyCharged;
433 }
434 
435 
436 int
438  return myVehicleStopped;
439 }
440 
441 
442 double
444  return myStoppingTreshold;
445 }
446 
447 
448 std::string
449 MSDevice_Battery::getParameter(const std::string& key) const {
452  } else if (key == toString(SUMO_ATTR_ENERGYCONSUMED)) {
453  return toString(getConsum());
454  } else if (key == toString(SUMO_ATTR_TOTALENERGYCONSUMED)) {
455  return toString(getTotalConsumption());
456  } else if (key == toString(SUMO_ATTR_TOTALENERGYREGENERATED)) {
457  return toString(getTotalRegenerated());
458  } else if (key == toString(SUMO_ATTR_ENERGYCHARGED)) {
459  return toString(getEnergyCharged());
460  } else if (key == toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY)) {
462  } else if (key == toString(SUMO_ATTR_CHARGINGSTATIONID)) {
463  return getChargingStationID();
464  } else if (key == toString(SUMO_ATTR_VEHICLEMASS)) {
466  }
467  throw InvalidArgument("Parameter '" + key + "' is not supported for device of type '" + deviceName() + "'");
468 }
469 
470 
471 void
472 MSDevice_Battery::setParameter(const std::string& key, const std::string& value) {
473  double doubleValue;
474  try {
475  doubleValue = StringUtils::toDouble(value);
476  } catch (NumberFormatException&) {
477  throw InvalidArgument("Setting parameter '" + key + "' requires a number for device of type '" + deviceName() + "'");
478  }
480  setActualBatteryCapacity(doubleValue);
481  } else if (key == toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY)) {
482  setMaximumBatteryCapacity(doubleValue);
483  } else if (key == toString(SUMO_ATTR_VEHICLEMASS)) {
485  } else {
486  throw InvalidArgument("Setting parameter '" + key + "' is not supported for device of type '" + deviceName() + "'");
487  }
488 }
489 
490 
491 void
493  // @note: only charing is performed but no energy is consumed
495  myConsum = 0;
496 }
497 /****************************************************************************/
#define DEFAULT_CHARGE_RATIO
#define DEFAULT_MAX_CAPACITY
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:280
SUMOTime DELTA_T
Definition: SUMOTime.cpp:37
#define TS
Definition: SUMOTime.h:40
long long int SUMOTime
Definition: SUMOTime.h:32
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_MAXIMUMPOWER
Maximum Power.
@ SUMO_ATTR_ENERGYCONSUMED
Energy consumed.
@ SUMO_ATTR_STOPPINGTRESHOLD
Stopping treshold.
@ SUMO_ATTR_MAXIMUMBATTERYCAPACITY
Maxium battery capacity.
@ SUMO_ATTR_ROLLDRAGCOEFFICIENT
Roll Drag coefficient.
@ SUMO_ATTR_CONSTANTPOWERINTAKE
Constant Power Intake.
@ SUMO_ATTR_RECUPERATIONEFFICIENCY_BY_DECELERATION
Recuperation efficiency (by deceleration)
@ SUMO_ATTR_RECUPERATIONEFFICIENCY
Recuperation efficiency (constant)
@ SUMO_ATTR_AIRDRAGCOEFFICIENT
Air drag coefficient.
@ SUMO_ATTR_CHARGINGSTATIONID
Charging Station ID.
@ SUMO_ATTR_ANGLE
@ SUMO_ATTR_ACTUALBATTERYCAPACITY
@ SUMO_ATTR_VEHICLEMASS
Vehicle mass.
@ SUMO_ATTR_RADIALDRAGCOEFFICIENT
Radial drag coefficient.
@ SUMO_ATTR_ENERGYCHARGED
tgotal of Energy charged
@ SUMO_ATTR_TOTALENERGYREGENERATED
Total energy regenerated.
@ SUMO_ATTR_PROPULSIONEFFICIENCY
Propulsion efficiency.
@ SUMO_ATTR_TOTALENERGYCONSUMED
Total energy consumed.
@ SUMO_ATTR_INTERNALMOMENTOFINERTIA
Internal moment of inertia.
@ SUMO_ATTR_FRONTSURFACEAREA
Front surface area.
T MIN2(T a, T b)
Definition: StdDefs.h:74
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
An upper class for objects with additional parameters.
Definition: EnergyParams.h:41
double getDouble(SumoXMLAttr attr) const
bool knowsParameter(SumoXMLAttr attr) const
void setDouble(SumoXMLAttr attr, double value)
Sets a parameter.
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:179
double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const EnergyParams *param) const
Computes the emitted pollutant amount using the given speed and acceleration.
double getChargingPower(bool usingFuel) const
Get charging station's charging power in the.
bool getChargeInTransit() const
Get chargeInTransit.
void setChargingVehicle(bool value)
enable or disable charging vehicle
void addChargeValueForOutput(double WCharged, MSDevice_Battery *battery)
add charge value for output
SUMOTime getChargeDelay() const
Get Charge Delay.
double getEfficency() const
Get efficiency of the charging station.
Battery device for electric vehicles.
SUMOTime getChargingStartTime() const
Get charging start time.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Example-options.
void notifyParking()
called to update state for parking vehicles
int myVehicleStopped
Parameter, How many timestep the vehicle is stopped.
bool myChargingInTransit
Parameter, Flag: Vehicles it's charging in transit (by default is false)
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
double getActualBatteryCapacity() const
Get the actual vehicle's Battery Capacity in Wh.
int getVehicleStopped() const
Get number of timestep that vehicle is stopped.
double myMaximumBatteryCapacity
Parameter, The total vehicles's Battery Capacity in Wh, [myMaximumBatteryCapacity >= 0].
void increaseVehicleStoppedTimer()
Increase myVehicleStopped.
void setStoppingTreshold(const double stoppingTreshold)
Set vehicle's stopping treshold.
double myActualBatteryCapacity
Parameter, The actual vehicles's Battery Capacity in Wh, [myActualBatteryCapacity <= myMaximumBattery...
double myPowerMax
Parameter, The Maximum Power when accelerating, [myPowerMax >= 0].
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
void increaseChargingStartTime()
Increase Charging Start time.
MSChargingStation * myPreviousNeighbouringChargingStation
Parameter, Pointer to charging station neighbouring with myActChargingStation in which vehicle was pl...
double getMaximumBatteryCapacity() const
Get the total vehicle's Battery Capacity in Wh.
bool myChargingStopped
Parameter, Flag: Vehicles it's charging stopped (by default is false)
double getConsum() const
Get consum.
void setActualBatteryCapacity(const double actualBatteryCapacity)
Set actual vehicle's Battery Capacity in kWh.
void checkParam(const SumoXMLAttr paramKey, const double lower=0., const double upper=std::numeric_limits< double >::infinity())
bool myTrackFuel
whether to track fuel consumption instead of electricity
void setPowerMax(const double new_Pmax)
Set maximum power when accelerating.
double getMaximumPower() const
Get the maximum power when accelerating.
double myEnergyCharged
Parameter, Energy charged in each timestep.
double myLastAngle
Parameter, Vehicle's last angle.
double myTotalRegenerated
Parameter, total vehicle energy regeneration.
EnergyParams myParam
Parameter collection.
SUMOTime myChargingStartTime
Parameter, Moment, wich the vehicle has beging to charging.
bool isChargingInTransit() const
Get true if Vehicle it's charging, false if not.
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key
void resetChargingStartTime()
Reset charging start time.
double myTotalConsumption
Parameter, total vehicle energy consumption.
const std::string deviceName() const
return the name for this type of device
void resetVehicleStoppedTimer()
Reset myVehicleStopped.
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key
MSDevice_Battery(SUMOVehicle &holder, const std::string &id, const double actualBatteryCapacity, const double maximumBatteryCapacity, const double powerMax, const double stoppingTreshold, const EnergyParams &param)
Constructor.
double getTotalRegenerated() const
Get total regenerated.
double getTotalConsumption() const
Get total consumption.
MSChargingStation * myActChargingStation
Parameter, Pointer to current charging station in which vehicle is placed (by default is NULL)
~MSDevice_Battery()
Destructor.
double myStoppingTreshold
Parameter, stopping vehicle treshold [myStoppingTreshold >= 0].
double myConsum
Parameter, Vehicle consum during a time step (by default is 0.)
double getEnergyCharged() const
Get charged energy.
std::string getChargingStationID() const
Get current Charging Station ID.
void setMaximumBatteryCapacity(const double maximumBatteryCapacity)
Set total vehicle's Battery Capacity in kWh.
double getStoppingTreshold() const
Get stopping treshold.
bool isChargingStopped() const
Get true if Vehicle is charging, false if not.
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:137
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:205
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:174
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:1259
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
Definition: MSNet.cpp:1250
Abstract in-vehicle device.
SUMOVehicle & myHolder
The vehicle that stores the device.
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
const SUMOVTypeParameter & getParameter() const
const std::string & getID() const
Returns the id.
Definition: Named.h:74
A storage for options typed value containers)
Definition: OptionsCont.h:89
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
Definition: OptionsCont.cpp:75
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
double getDouble(const std::string &key, const double defaultValue) const
Returns the value for a given key converted to a double.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
bool includesClass(const SUMOEmissionClass c) const
static const HelpersEnergy & getEnergyHelper()
get energy helper
static double compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope, const EnergyParams *param=0)
Returns the amount of the emitted pollutant given the vehicle type and state (in mg/s or ml/s for fue...
Representation of a vehicle, person, or container.
virtual bool isVehicle() const
Whether it is a vehicle.
virtual double getAcceleration() const =0
Returns the object's acceleration.
virtual double getSlope() const =0
Returns the slope of the road at object's position in degrees.
virtual double getSpeed() const =0
Returns the object's current speed.
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
virtual const MSLane * getLane() const =0
Returns the lane the object is currently at.
virtual double getPositionOnLane() const =0
Get the object's position along the lane.
Structure representing possible vehicle parameter.
Representation of a vehicle.
Definition: SUMOVehicle.h:60
virtual bool isParking() const =0
Returns the information whether the vehicle is parked.
virtual double getAngle() const =0
Get the vehicle's angle.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter