Eclipse SUMO - Simulation of Urban MObility
|
Helper methods for energy-based electricity consumption computation based on the battery device. More...
#include <HelpersEnergy.h>
Public Member Functions | |
double | acceleration (const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double P, const double slope, const EnergyParams *param) const |
Computes the achievable acceleration using the given speed and amount of consumed electric power. | |
void | addAllClassesInto (std::vector< SUMOEmissionClass > &list) const |
Add all known emission classes of this model to the given container. | |
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. | |
virtual SUMOEmissionClass | getClassByName (const std::string &eClass, const SUMOVehicleClass vc) |
Returns the emission class associated with the given name, aliases are possible If this method is asked for the "unknown" class it should return the default (possibly depending on the given vehicle class). The class name is case insensitive. | |
const std::string | getClassName (const SUMOEmissionClass c) const |
Returns the complete name of the emission class including the model. | |
virtual double | getCoastingDecel (const SUMOEmissionClass c, const double v, const double a, const double slope, const EnergyParams *param) const |
Returns the maximum deceleration value (as a negative number), which can still be considered as non-braking. Default implementation returns always zero. | |
std::string | getFuel (const SUMOEmissionClass) const |
Returns the fuel type described by this emission class as described in the Amitran interface (Gasoline, Diesel, ...) | |
virtual double | getModifiedAccel (const SUMOEmissionClass c, const double v, const double a, const double slope, const EnergyParams *param) const |
Returns the adapted acceleration value, useful for comparing with external PHEMlight references. Default implementation returns always the input accel. | |
const std::string & | getName () const |
Returns the name of the model. | |
HelpersEnergy () | |
Constructor (initializes myEmissionClassStrings) | |
bool | includesClass (const SUMOEmissionClass c) const |
virtual bool | isSilent (const SUMOEmissionClass c) |
Returns whether the class denotes a silent vehicle for interfacing with the noise model. By default the first class in each model is the silent class. | |
Methods for Amitran interfaces | |
virtual SUMOEmissionClass | getClass (const SUMOEmissionClass base, const std::string &vClass, const std::string &fuel, const std::string &eClass, const double weight) const |
Returns the emission class described by the given parameters. The base is used to determine the model to use and as default return values. Default implementation returns always base. | |
virtual std::string | getAmitranVehicleClass (const SUMOEmissionClass c) const |
Returns the vehicle class described by this emission class as described in the Amitran interface (Passenger, ...) Default implementation returns always "Passenger". | |
virtual int | getEuroClass (const SUMOEmissionClass c) const |
Returns the Euro emission class described by this emission class as described in the Amitran interface (0, ..., 6) Default implementation returns always 0. | |
virtual double | getWeight (const SUMOEmissionClass c) const |
Returns a reference weight in kg described by this emission class as described in the Amitran interface It might return -1, if the weight is not important to distinguish different emission classes. Default implementation returns always -1. | |
Protected Attributes | |
const int | myBaseIndex |
the starting index for classes of this model | |
StringBijection< SUMOEmissionClass > | myEmissionClassStrings |
Mapping between emission class names and integer representations. | |
const std::string | myName |
the name of the model | |
bool | myVolumetricFuel |
return fuel consumption in l instead of mg | |
Static Protected Attributes | |
static const double | ZERO_SPEED_ACCURACY = .5 |
the lowest speed which allows reliable coasting calculations | |
Static Private Attributes | |
static const int | ENERGY_BASE = 4 << 16 |
Helper methods for energy-based electricity consumption computation based on the battery device.
Definition at line 41 of file HelpersEnergy.h.
HelpersEnergy::HelpersEnergy | ( | ) |
Constructor (initializes myEmissionClassStrings)
Definition at line 39 of file HelpersEnergy.cpp.
double HelpersEnergy::acceleration | ( | const SUMOEmissionClass | c, |
const PollutantsInterface::EmissionType | e, | ||
const double | v, | ||
const double | P, | ||
const double | slope, | ||
const EnergyParams * | param | ||
) | const |
Computes the achievable acceleration using the given speed and amount of consumed electric power.
[in] | c | emission class for the function parameters to use |
[in] | e | the type of emission (CO, CO2, ...), only electricity gives valid results |
[in] | v | The vehicle's current velocity |
[in] | P | The vehicle's current power consumption |
[in] | slope | The road's slope at vehicle's position [deg] |
Definition at line 133 of file HelpersEnergy.cpp.
References PolySolver::cubicSolve(), DEG2RAD, PollutantsInterface::ELEC, EnergyParams::getDefault(), EnergyParams::getDouble(), EnergyParams::getDoubleOptional(), GRAVITY, MAX2(), MAX3(), SUMO_ATTR_AIRDRAGCOEFFICIENT, SUMO_ATTR_FRONTSURFACEAREA, SUMO_ATTR_LOADING, SUMO_ATTR_MASS, SUMO_ATTR_PROPULSIONEFFICIENCY, SUMO_ATTR_RECUPERATIONEFFICIENCY, SUMO_ATTR_ROLLDRAGCOEFFICIENT, SUMO_ATTR_ROTATINGMASS, TL, TS, and WRITE_ERROR.
Referenced by MSDevice_ElecHybrid::acceleration().
|
inherited |
Add all known emission classes of this model to the given container.
[in] | list | the vector to add to |
Definition at line 214 of file PollutantsInterface.cpp.
Referenced by PollutantsInterface::getAllClasses(), and PollutantsInterface::getAllClassesStr().
|
virtual |
Computes the emitted pollutant amount using the given speed and acceleration.
Returns only valid values for electricity all other types give 0.
[in] | c | emission class for the function parameters to use |
[in] | e | the type of emission (CO, CO2, ...), only electricity gives valid results |
[in] | v | The vehicle's current velocity |
[in] | a | The vehicle's current acceleration |
[in] | slope | The road's slope at vehicle's position [deg] |
Reimplemented from PollutantsInterface::Helper.
Definition at line 45 of file HelpersEnergy.cpp.
References ACCEL2SPEED, DEG2RAD, PollutantsInterface::ELEC, EnergyParams::getDefault(), EnergyParams::getDouble(), EnergyParams::getDoubleOptional(), GRAVITY, SPEED2DIST, SUMO_ATTR_AIRDRAGCOEFFICIENT, SUMO_ATTR_ANGLE, SUMO_ATTR_CONSTANTPOWERINTAKE, SUMO_ATTR_FRONTSURFACEAREA, SUMO_ATTR_LOADING, SUMO_ATTR_MASS, SUMO_ATTR_PROPULSIONEFFICIENCY, SUMO_ATTR_RADIALDRAGCOEFFICIENT, SUMO_ATTR_RECUPERATIONEFFICIENCY, SUMO_ATTR_RECUPERATIONEFFICIENCY_BY_DECELERATION, SUMO_ATTR_ROLLDRAGCOEFFICIENT, SUMO_ATTR_ROTATINGMASS, and TS.
Referenced by MSDevice_ElecHybrid::consumption(), and MSDevice_Battery::notifyMove().
|
virtualinherited |
Returns the vehicle class described by this emission class as described in the Amitran interface (Passenger, ...) Default implementation returns always "Passenger".
[in] | c | the emission class |
Reimplemented in HelpersHBEFA3, HelpersHBEFA4, and HelpersPHEMlight.
Definition at line 146 of file PollutantsInterface.cpp.
References UNUSED_PARAMETER.
Referenced by PollutantsInterface::getAmitranVehicleClass().
|
virtualinherited |
Returns the emission class described by the given parameters. The base is used to determine the model to use and as default return values. Default implementation returns always base.
[in] | base | the base class giving the model and the default |
[in] | vClass | the vehicle class as described in the Amitran interface (Passenger, ...) |
[in] | fuel | the fuel type as described in the Amitran interface (Gasoline, Diesel, ...) |
[in] | eClass | the emission class as described in the Amitran interface (Euro0, ...) |
[in] | weight | the vehicle weight in kg as described in the Amitran interface |
Reimplemented in HelpersHBEFA3, HelpersHBEFA4, and HelpersPHEMlight.
Definition at line 136 of file PollutantsInterface.cpp.
References UNUSED_PARAMETER.
Referenced by PollutantsInterface::getClass().
|
virtualinherited |
Returns the emission class associated with the given name, aliases are possible If this method is asked for the "unknown" class it should return the default (possibly depending on the given vehicle class). The class name is case insensitive.
[in] | eClass | the name of the emission class (string after the '/' in the emission class attribute) |
[in] | vc | the vehicle class to use when determining default class |
Reimplemented in HelpersPHEMlight, and HelpersPHEMlight5.
Definition at line 113 of file PollutantsInterface.cpp.
References OptionsCont::exists(), OptionsCont::getBool(), OptionsCont::getOptions(), StringUtils::to_lower_case(), and UNUSED_PARAMETER.
Referenced by PollutantsInterface::getClassByName().
|
inherited |
Returns the complete name of the emission class including the model.
[in] | c | the emission class |
Definition at line 124 of file PollutantsInterface.cpp.
Referenced by PollutantsInterface::getName().
|
virtualinherited |
Returns the maximum deceleration value (as a negative number), which can still be considered as non-braking. Default implementation returns always zero.
[in] | c | the emission class |
[in] | v | the speed value |
[in] | a | the acceleration value |
[in] | slope | The road's slope at vehicle's position [deg] |
[in] | param | parameter of the emission model affecting the computation |
Reimplemented in HelpersPHEMlight, and HelpersPHEMlight5.
Definition at line 196 of file PollutantsInterface.cpp.
References PollutantsInterface::getCoastingDecel(), EnergyParams::getDefault(), EnergyParams::getDouble(), PHEMlightdllV5::Constants::GRAVITY_CONST, M_PI, MIN2(), PHEMlightdllV5::Constants::SPEED_DCEL_MIN, SUMO_ATTR_HEIGHT, SUMO_ATTR_MASS, and SUMO_ATTR_WIDTH.
Referenced by HelpersHBEFA::compute(), HelpersHBEFA3::compute(), HelpersHBEFA4::compute(), and PollutantsInterface::getCoastingDecel().
|
virtualinherited |
Returns the Euro emission class described by this emission class as described in the Amitran interface (0, ..., 6) Default implementation returns always 0.
[in] | c | the emission class |
Reimplemented in HelpersHBEFA3, HelpersHBEFA4, and HelpersPHEMlight.
Definition at line 160 of file PollutantsInterface.cpp.
References UNUSED_PARAMETER.
Referenced by PollutantsInterface::getEuroClass().
|
inlinevirtual |
Returns the fuel type described by this emission class as described in the Amitran interface (Gasoline, Diesel, ...)
[in] | c | the emission class |
Reimplemented from PollutantsInterface::Helper.
Definition at line 54 of file HelpersEnergy.h.
|
virtualinherited |
Returns the adapted acceleration value, useful for comparing with external PHEMlight references. Default implementation returns always the input accel.
[in] | c | the emission class |
[in] | v | the speed value |
[in] | a | the acceleration value |
[in] | slope | The road's slope at vehicle's position [deg] |
Reimplemented in HelpersPHEMlight, and HelpersPHEMlight5.
Definition at line 186 of file PollutantsInterface.cpp.
References UNUSED_PARAMETER.
Referenced by PollutantsInterface::getModifiedAccel().
|
inherited |
Returns the name of the model.
Definition at line 107 of file PollutantsInterface.cpp.
|
virtualinherited |
Returns a reference weight in kg described by this emission class as described in the Amitran interface It might return -1, if the weight is not important to distinguish different emission classes. Default implementation returns always -1.
[in] | c | the emission class |
Reimplemented in HelpersPHEMlight.
Definition at line 167 of file PollutantsInterface.cpp.
References UNUSED_PARAMETER.
Referenced by PollutantsInterface::getWeight().
|
inherited |
Definition at line 220 of file PollutantsInterface.cpp.
|
virtualinherited |
Returns whether the class denotes a silent vehicle for interfacing with the noise model. By default the first class in each model is the silent class.
[in] | c | the emission class |
Definition at line 130 of file PollutantsInterface.cpp.
References PollutantsInterface::HEAVY_BIT.
Referenced by PollutantsInterface::isSilent().
|
staticprivate |
Definition at line 43 of file HelpersEnergy.h.
|
protectedinherited |
the starting index for classes of this model
Definition at line 228 of file PollutantsInterface.h.
|
protectedinherited |
Mapping between emission class names and integer representations.
Definition at line 234 of file PollutantsInterface.h.
Referenced by HelpersHBEFA3::getAmitranVehicleClass(), HelpersHBEFA4::getAmitranVehicleClass(), HelpersPHEMlight::getAmitranVehicleClass(), HelpersHBEFA3::getClass(), HelpersHBEFA4::getClass(), HelpersPHEMlight::getClass(), HelpersPHEMlight::getClassByName(), HelpersPHEMlight5::getClassByName(), HelpersHBEFA3::getEuroClass(), HelpersHBEFA4::getEuroClass(), HelpersPHEMlight::getEuroClass(), HelpersHBEFA3::getFuel(), HelpersHBEFA4::getFuel(), HelpersPHEMlight::getFuel(), HelpersPHEMlight5::getFuel(), HelpersPHEMlight::getWeight(), PollutantsInterface::Helper::Helper(), HelpersHBEFA::HelpersHBEFA(), HelpersHBEFA3::HelpersHBEFA3(), and HelpersHBEFA4::HelpersHBEFA4().
|
protectedinherited |
the name of the model
Definition at line 225 of file PollutantsInterface.h.
|
protectedinherited |
return fuel consumption in l instead of mg
Definition at line 231 of file PollutantsInterface.h.
Referenced by HelpersHBEFA::compute(), HelpersHBEFA3::compute(), HelpersHBEFA4::compute(), HelpersPHEMlight::compute(), HelpersPHEMlight5::compute(), HelpersPHEMlight::getClassByName(), and HelpersPHEMlight5::getClassByName().
|
staticprotectedinherited |
the lowest speed which allows reliable coasting calculations
Definition at line 222 of file PollutantsInterface.h.
Referenced by HelpersHBEFA::compute(), HelpersHBEFA3::compute(), and HelpersHBEFA4::compute().