Eclipse SUMO - Simulation of Urban MObility
HelpersEnergy Class Reference

Helper methods for energy-based electricity consumption computation based on the battery device. More...

#include <HelpersEnergy.h>

Inheritance diagram for HelpersEnergy:
[legend]
Collaboration diagram for HelpersEnergy:
[legend]

Public Member Functions

double acceleration (const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double P, const double slope, const std::map< int, double > *param) const
 Computes the achievable acceleration using the given speed and amount of consumed electric power. More...
 
void addAllClassesInto (std::vector< SUMOEmissionClass > &list) const
 Add all known emission classes of this model to the given container. More...
 
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. More...
 
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. More...
 
const std::string getClassName (const SUMOEmissionClass c) const
 Returns the complete name of the emission class including the model. More...
 
double getDefaultParam (int paramKey) const
 
virtual double getModifiedAccel (const SUMOEmissionClass c, const double v, const double a, const double slope) const
 Returns the adapted acceleration value, useful for comparing with external PHEMlight references. Default implementation returns always the input accel. More...
 
const std::string & getName () const
 Returns the name of the model. More...
 
 HelpersEnergy ()
 Constructor (initializes myEmissionClassStrings) More...
 
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. More...
 
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. More...
 
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". More...
 
virtual std::string getFuel (const SUMOEmissionClass c) const
 Returns the fuel type described by this emission class as described in the Amitran interface (Gasoline, Diesel, ...) Default implementation returns always "Gasoline". More...
 
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. More...
 
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. More...
 

Protected Attributes

StringBijection< SUMOEmissionClassmyEmissionClassStrings
 Mapping between emission class names and integer representations. More...
 
const std::string myName
 the name of the model More...
 

Private Attributes

std::map< int, double > myDefaultParameter
 The default parameter. More...
 

Static Private Attributes

static const int ENERGY_BASE = 4 << 16
 

Detailed Description

Helper methods for energy-based electricity consumption computation based on the battery device.

Definition at line 40 of file HelpersEnergy.h.

Constructor & Destructor Documentation

◆ HelpersEnergy()

Member Function Documentation

◆ acceleration()

double HelpersEnergy::acceleration ( const SUMOEmissionClass  c,
const PollutantsInterface::EmissionType  e,
const double  v,
const double  P,
const double  slope,
const std::map< int, double > *  param 
) const

Computes the achievable acceleration using the given speed and amount of consumed electric power.

Parameters
[in]cemission class for the function parameters to use
[in]ethe type of emission (CO, CO2, ...), only electricity gives valid results
[in]vThe vehicle's current velocity
[in]PThe vehicle's current power consumption
[in]slopeThe road's slope at vehicle's position [deg]
Returns
The amount emitted by the given emission class when moving with the given velocity and acceleration [mg/s or ml/s]

Definition at line 145 of file HelpersEnergy.cpp.

References PolySolver::cubicSolve(), DEG2RAD, PollutantsInterface::ELEC, GRAVITY, MAX2(), MAX3(), myDefaultParameter, SUMO_ATTR_AIRDRAGCOEFFICIENT, SUMO_ATTR_FRONTSURFACEAREA, SUMO_ATTR_INTERNALMOMENTOFINERTIA, SUMO_ATTR_PROPULSIONEFFICIENCY, SUMO_ATTR_RECUPERATIONEFFICIENCY, SUMO_ATTR_ROLLDRAGCOEFFICIENT, SUMO_ATTR_VEHICLEMASS, TS, and WRITE_ERROR.

Referenced by MSDevice_ElecHybrid::acceleration().

Here is the caller graph for this function:

◆ addAllClassesInto()

void PollutantsInterface::Helper::addAllClassesInto ( std::vector< SUMOEmissionClass > &  list) const
inlineinherited

Add all known emission classes of this model to the given container.

Parameters
[in]listthe vector to add to

Definition at line 273 of file PollutantsInterface.h.

References StringBijection< T >::addKeysInto(), and PollutantsInterface::Helper::myEmissionClassStrings.

Referenced by PollutantsInterface::getAllClasses(), and PollutantsInterface::getAllClassesStr().

Here is the caller graph for this function:

◆ compute()

double HelpersEnergy::compute ( const SUMOEmissionClass  c,
const PollutantsInterface::EmissionType  e,
const double  v,
const double  a,
const double  slope,
const std::map< int, double > *  param 
) const
virtual

Computes the emitted pollutant amount using the given speed and acceleration.

Returns only valid values for electricity all other types give 0.

Parameters
[in]cemission class for the function parameters to use
[in]ethe type of emission (CO, CO2, ...), only electricity gives valid results
[in]vThe vehicle's current velocity
[in]aThe vehicle's current acceleration
[in]slopeThe road's slope at vehicle's position [deg]
Returns
The amount emitted by the given emission class when moving with the given velocity and acceleration [mg/s or ml/s]

Reimplemented from PollutantsInterface::Helper.

Definition at line 57 of file HelpersEnergy.cpp.

References ACCEL2SPEED, DEG2RAD, PollutantsInterface::ELEC, GRAVITY, myDefaultParameter, SPEED2DIST, SUMO_ATTR_AIRDRAGCOEFFICIENT, SUMO_ATTR_ANGLE, SUMO_ATTR_CONSTANTPOWERINTAKE, SUMO_ATTR_FRONTSURFACEAREA, SUMO_ATTR_INTERNALMOMENTOFINERTIA, SUMO_ATTR_PROPULSIONEFFICIENCY, SUMO_ATTR_RADIALDRAGCOEFFICIENT, SUMO_ATTR_RECUPERATIONEFFICIENCY, SUMO_ATTR_RECUPERATIONEFFICIENCY_BY_DECELERATION, SUMO_ATTR_ROLLDRAGCOEFFICIENT, SUMO_ATTR_VEHICLEMASS, and TS.

Referenced by MSDevice_ElecHybrid::consumption(), and MSDevice_Battery::notifyMove().

Here is the caller graph for this function:

◆ getAmitranVehicleClass()

virtual std::string PollutantsInterface::Helper::getAmitranVehicleClass ( const SUMOEmissionClass  c) const
inlinevirtualinherited

Returns the vehicle class described by this emission class as described in the Amitran interface (Passenger, ...) Default implementation returns always "Passenger".

Parameters
[in]cthe emission class
Returns
the name of the vehicle class

Reimplemented in HelpersPHEMlight, and HelpersHBEFA3.

Definition at line 200 of file PollutantsInterface.h.

References UNUSED_PARAMETER.

Referenced by PollutantsInterface::getAmitranVehicleClass().

Here is the caller graph for this function:

◆ getClass()

virtual SUMOEmissionClass PollutantsInterface::Helper::getClass ( const SUMOEmissionClass  base,
const std::string &  vClass,
const std::string &  fuel,
const std::string &  eClass,
const double  weight 
) const
inlinevirtualinherited

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.

Parameters
[in]basethe base class giving the model and the default
[in]vClassthe vehicle class as described in the Amitran interface (Passenger, ...)
[in]fuelthe fuel type as described in the Amitran interface (Gasoline, Diesel, ...)
[in]eClassthe emission class as described in the Amitran interface (Euro0, ...)
[in]weightthe vehicle weight in kg as described in the Amitran interface
Returns
the class described by the parameters

Reimplemented in HelpersPHEMlight, and HelpersHBEFA3.

Definition at line 186 of file PollutantsInterface.h.

References UNUSED_PARAMETER.

Referenced by PollutantsInterface::getClass().

Here is the caller graph for this function:

◆ getClassByName()

virtual SUMOEmissionClass PollutantsInterface::Helper::getClassByName ( const std::string &  eClass,
const SUMOVehicleClass  vc 
)
inlinevirtualinherited

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.

Parameters
[in]eClassthe name of the emission class (string after the '/' in the emission class attribute)
[in]vcthe vehicle class to use when determining default class
Returns
the name of the model (string before the '/' in the emission class)

Reimplemented in HelpersPHEMlight.

Definition at line 129 of file PollutantsInterface.h.

References StringBijection< T >::get(), StringBijection< T >::hasString(), PollutantsInterface::Helper::myEmissionClassStrings, and UNUSED_PARAMETER.

Referenced by PollutantsInterface::getClassByName().

Here is the caller graph for this function:

◆ getClassName()

const std::string PollutantsInterface::Helper::getClassName ( const SUMOEmissionClass  c) const
inlineinherited

Returns the complete name of the emission class including the model.

Parameters
[in]cthe emission class
Returns
the name of the class (the complete emission class attribute)

Definition at line 160 of file PollutantsInterface.h.

References StringBijection< T >::getString(), PollutantsInterface::Helper::myEmissionClassStrings, and PollutantsInterface::Helper::myName.

Referenced by PollutantsInterface::getName().

Here is the caller graph for this function:

◆ getDefaultParam()

double HelpersEnergy::getDefaultParam ( int  paramKey) const
inline

Definition at line 74 of file HelpersEnergy.h.

References myDefaultParameter.

Referenced by MSDevice_Battery::buildVehicleDevices(), MSDevice_ElecHybrid::buildVehicleDevices(), MSDevice_Battery::checkParam(), and MSDevice_ElecHybrid::checkParam().

Here is the caller graph for this function:

◆ getEuroClass()

virtual int PollutantsInterface::Helper::getEuroClass ( const SUMOEmissionClass  c) const
inlinevirtualinherited

Returns the Euro emission class described by this emission class as described in the Amitran interface (0, ..., 6) Default implementation returns always 0.

Parameters
[in]cthe emission class
Returns
the Euro class

Reimplemented in HelpersPHEMlight, and HelpersHBEFA3.

Definition at line 220 of file PollutantsInterface.h.

References UNUSED_PARAMETER.

Referenced by PollutantsInterface::getEuroClass().

Here is the caller graph for this function:

◆ getFuel()

virtual std::string PollutantsInterface::Helper::getFuel ( const SUMOEmissionClass  c) const
inlinevirtualinherited

Returns the fuel type described by this emission class as described in the Amitran interface (Gasoline, Diesel, ...) Default implementation returns always "Gasoline".

Parameters
[in]cthe emission class
Returns
the fuel type

Reimplemented in HelpersPHEMlight, and HelpersHBEFA3.

Definition at line 210 of file PollutantsInterface.h.

References UNUSED_PARAMETER.

Referenced by PollutantsInterface::getFuel().

Here is the caller graph for this function:

◆ getModifiedAccel()

virtual double PollutantsInterface::Helper::getModifiedAccel ( const SUMOEmissionClass  c,
const double  v,
const double  a,
const double  slope 
) const
inlinevirtualinherited

Returns the adapted acceleration value, useful for comparing with external PHEMlight references. Default implementation returns always the input accel.

Parameters
[in]cthe emission class
[in]vthe speed value
[in]athe acceleration value
[in]slopeThe road's slope at vehicle's position [deg]
Returns
the modified acceleration

Reimplemented in HelpersPHEMlight.

Definition at line 263 of file PollutantsInterface.h.

References UNUSED_PARAMETER.

Referenced by PollutantsInterface::getModifiedAccel().

Here is the caller graph for this function:

◆ getName()

const std::string& PollutantsInterface::Helper::getName ( ) const
inlineinherited

Returns the name of the model.

Returns
the name of the model (string before the '/' in the emission class attribute)

Definition at line 116 of file PollutantsInterface.h.

References PollutantsInterface::Helper::myName.

◆ getWeight()

virtual double PollutantsInterface::Helper::getWeight ( const SUMOEmissionClass  c) const
inlinevirtualinherited

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.

Parameters
[in]cthe emission class
Returns
a reference weight

Reimplemented in HelpersPHEMlight.

Definition at line 231 of file PollutantsInterface.h.

References UNUSED_PARAMETER.

Referenced by PollutantsInterface::getWeight().

Here is the caller graph for this function:

◆ isSilent()

virtual bool PollutantsInterface::Helper::isSilent ( const SUMOEmissionClass  c)
inlinevirtualinherited

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.

Parameters
[in]cthe emission class
Returns
whether the class denotes a silent vehicle

Definition at line 169 of file PollutantsInterface.h.

References PollutantsInterface::HEAVY_BIT.

Referenced by PollutantsInterface::isSilent().

Here is the caller graph for this function:

Field Documentation

◆ ENERGY_BASE

const int HelpersEnergy::ENERGY_BASE = 4 << 16
staticprivate

Definition at line 42 of file HelpersEnergy.h.

◆ myDefaultParameter

std::map<int, double> HelpersEnergy::myDefaultParameter
private

The default parameter.

Definition at line 81 of file HelpersEnergy.h.

Referenced by acceleration(), compute(), getDefaultParam(), and HelpersEnergy().

◆ myEmissionClassStrings

◆ myName

const std::string PollutantsInterface::Helper::myName
protectedinherited

the name of the model

Definition at line 279 of file PollutantsInterface.h.

Referenced by PollutantsInterface::Helper::getClassName(), and PollutantsInterface::Helper::getName().


The documentation for this class was generated from the following files: