Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
EnergyParams Class Reference

An upper class for objects with additional parameters. More...

#include <EnergyParams.h>

Collaboration diagram for EnergyParams:
[legend]

Public Member Functions

const std::string dump () const
 Returns a complete inner description.
 
 EnergyParams (const EnergyParams *secondaryParams)
 Constructor.
 
 EnergyParams (const SUMOVTypeParameter *typeParams=nullptr)
 Constructor.
 
double getAngleDiff () const
 Returns the angle difference between the last two calls of setDynamicValues (usually the last two time steps)
 
const CharacteristicMapgetCharacteristicMap (SumoXMLAttr attr) const
 Return the CharacteristicMap that belongs to a given attribute.
 
double getDouble (SumoXMLAttr attr) const
 Returns the value for a given key.
 
double getDoubleOptional (SumoXMLAttr attr, const double def) const
 Returns the value for a given key with an optional default. SUMO_ATTR_MASS and SUMO_ATTR_FRONTSURFACEAREA get a special treatment and return the given def value also if the map has a value which is flagged as default.
 
double getTotalMass (const double defaultEmptyMass, const double defaultLoading) const
 Returns the sum of the empty mass (SUMO_ATTR_MASS), tthe loading (SUMO_ATTR_LOADING) and the mass of all transportables in the vehicle.
 
double getTransportableMass () const
 Returns the mass of all transportables in the vehicle.
 
bool isEngineOff () const
 Returns the state of the engine when the vehicle is not moving.
 
bool isOff () const
 Returns whether the vehicle is currently consuming any energy derived from the parking state.
 
void setDynamicValues (const SUMOTime stopDuration, const bool parking, const SUMOTime waitingTime, const double angle)
 Sets the values which change possibly in every simulation step and are relevant for emsssion calculation.
 
void setMass (const double mass)
 Sets the empty mass of the vehicle (type) This is to be used by traci/libsumo.
 
void setSecondary (const EnergyParams *secondaryParams)
 Set secondary params.
 
void setTransportableMass (const double mass)
 Sets the mass of all transportables in the vehicle.
 
 ~EnergyParams ()
 Destructor.
 

Static Public Member Functions

static const EnergyParamsgetDefault ()
 

Private Member Functions

 EnergyParams (const EnergyParams &s)=delete
 invalidate copy constructor
 
EnergyParamsoperator= (const EnergyParams &s)=delete
 invalidate assignment operator
 

Private Attributes

bool myAmParking = false
 
double myAngle = INVALID_DOUBLE
 
std::map< SumoXMLAttr, CharacteristicMapmyCharacteristicMapMap
 
bool myHaveDefaultFrontSurfaceArea = false
 
bool myHaveDefaultMass = false
 
double myLastAngle = INVALID_DOUBLE
 
std::map< SumoXMLAttr, double > myMap
 The key->value maps.
 
const EnergyParamsmySecondaryParams = nullptr
 
double myStopDurationSeconds = -1.
 
double myTransportableMass = 0.
 
double myWaitingTimeSeconds = -1.
 

Static Private Attributes

static const EnergyParamsmyDefault = nullptr
 
static const std::vector< SumoXMLAttrmyParamAttrs
 

Detailed Description

An upper class for objects with additional parameters.

Definition at line 45 of file EnergyParams.h.

Constructor & Destructor Documentation

◆ EnergyParams() [1/3]

◆ EnergyParams() [2/3]

EnergyParams::EnergyParams ( const EnergyParams secondaryParams)
inline

Constructor.

Definition at line 51 of file EnergyParams.h.

◆ ~EnergyParams()

EnergyParams::~EnergyParams ( )

Destructor.

Definition at line 107 of file EnergyParams.cpp.

◆ EnergyParams() [3/3]

EnergyParams::EnergyParams ( const EnergyParams s)
privatedelete

invalidate copy constructor

Member Function Documentation

◆ dump()

const std::string EnergyParams::dump ( ) const
inline

Returns a complete inner description.

Definition at line 123 of file EnergyParams.h.

References dump(), joinToString(), myMap, and mySecondaryParams.

Referenced by dump().

Here is the caller graph for this function:

◆ getAngleDiff()

double EnergyParams::getAngleDiff ( ) const

Returns the angle difference between the last two calls of setDynamicValues (usually the last two time steps)

Returns
The angle difference in radians

Definition at line 142 of file EnergyParams.cpp.

References GeomHelper::angleDiff(), INVALID_DOUBLE, myAngle, and myLastAngle.

Referenced by HelpersEnergy::compute().

Here is the caller graph for this function:

◆ getCharacteristicMap()

const CharacteristicMap & EnergyParams::getCharacteristicMap ( SumoXMLAttr  attr) const

Return the CharacteristicMap that belongs to a given attribute.

Parameters
[in]attrName of an attribute
Returns
A CharacteristicMap

Definition at line 184 of file EnergyParams.cpp.

References getCharacteristicMap(), myCharacteristicMapMap, mySecondaryParams, and toString().

Referenced by HelpersMMPEVEM::compute(), and getCharacteristicMap().

Here is the caller graph for this function:

◆ getDefault()

static const EnergyParams * EnergyParams::getDefault ( )
inlinestatic

Definition at line 137 of file EnergyParams.h.

References myDefault.

Referenced by HelpersEnergy::acceleration(), HelpersEnergy::compute(), and PollutantsInterface::Helper::getCoastingDecel().

Here is the caller graph for this function:

◆ getDouble()

double EnergyParams::getDouble ( SumoXMLAttr  attr) const

Returns the value for a given key.

Parameters
[in]keyThe key to ask for
Returns
The value stored under the key

Definition at line 148 of file EnergyParams.cpp.

References getDouble(), myMap, mySecondaryParams, and toString().

Referenced by MSDevice_ElecHybrid::computeChargedEnergy(), PollutantsInterface::Helper::getCoastingDecel(), getDouble(), MSVehicleType::getMass(), and MSDevice_ElecHybrid::getParameter().

Here is the caller graph for this function:

◆ getDoubleOptional()

double EnergyParams::getDoubleOptional ( SumoXMLAttr  attr,
const double  def 
) const

Returns the value for a given key with an optional default. SUMO_ATTR_MASS and SUMO_ATTR_FRONTSURFACEAREA get a special treatment and return the given def value also if the map has a value which is flagged as default.

Parameters
[in]keyThe key to ask for
[in]defThe default value if no value is stored or the stored value is flagged as default
Returns
The value stored under the key

Definition at line 161 of file EnergyParams.cpp.

References getDoubleOptional(), INVALID_DOUBLE, myHaveDefaultFrontSurfaceArea, myHaveDefaultMass, myMap, mySecondaryParams, SUMO_ATTR_FRONTSURFACEAREA, and SUMO_ATTR_MASS.

Referenced by HelpersEnergy::acceleration(), HelpersPHEMlight5::calcPower(), HelpersPHEMlight5::calcWheelPower(), HelpersEnergy::compute(), HelpersPHEMlight5::compute(), HelpersMMPEVEM::compute(), MSDevice_StationFinder::estimateConsumption(), MSVehicle::executeMove(), HelpersPHEMlight5::getCoastingDecel(), getDoubleOptional(), HelpersPHEMlight5::getModifiedAccel(), getTotalMass(), isEngineOff(), and isOff().

Here is the caller graph for this function:

◆ getTotalMass()

double EnergyParams::getTotalMass ( const double  defaultEmptyMass,
const double  defaultLoading 
) const

Returns the sum of the empty mass (SUMO_ATTR_MASS), tthe loading (SUMO_ATTR_LOADING) and the mass of all transportables in the vehicle.

Returns
The total mass in kg

Definition at line 136 of file EnergyParams.cpp.

References getDoubleOptional(), getTransportableMass(), SUMO_ATTR_LOADING, and SUMO_ATTR_MASS.

Referenced by HelpersEnergy::acceleration(), HelpersEnergy::compute(), and HelpersMMPEVEM::compute().

Here is the caller graph for this function:

◆ getTransportableMass()

double EnergyParams::getTransportableMass ( ) const
inline

Returns the mass of all transportables in the vehicle.

Returns
The total mass of persons and containers in kg

Definition at line 80 of file EnergyParams.h.

References myTransportableMass.

Referenced by MSBaseVehicle::addTransportable(), HelpersPHEMlight5::calcWheelPower(), HelpersPHEMlight5::getCoastingDecel(), HelpersPHEMlight5::getModifiedAccel(), getTotalMass(), and MSBaseVehicle::removeTransportable().

Here is the caller graph for this function:

◆ isEngineOff()

bool EnergyParams::isEngineOff ( ) const

Returns the state of the engine when the vehicle is not moving.

Returns
whether the engine is running

Definition at line 197 of file EnergyParams.cpp.

References DEFAULT_VEH_SHUT_OFF_STOP, getDoubleOptional(), myStopDurationSeconds, myWaitingTimeSeconds, SUMO_ATTR_SHUT_OFF_AUTO, and SUMO_ATTR_SHUT_OFF_STOP.

Referenced by HelpersHBEFA::compute(), HelpersHBEFA3::compute(), HelpersHBEFA4::compute(), HelpersPHEMlight::compute(), and HelpersPHEMlight5::compute().

Here is the caller graph for this function:

◆ isOff()

bool EnergyParams::isOff ( ) const

Returns whether the vehicle is currently consuming any energy derived from the parking state.

Returns
whether the vehicle has any consumption

Definition at line 204 of file EnergyParams.cpp.

References DEFAULT_VEH_SHUT_OFF_STOP, getDoubleOptional(), myAmParking, myStopDurationSeconds, and SUMO_ATTR_SHUT_OFF_STOP.

◆ operator=()

EnergyParams & EnergyParams::operator= ( const EnergyParams s)
privatedelete

invalidate assignment operator

◆ setDynamicValues()

void EnergyParams::setDynamicValues ( const SUMOTime  stopDuration,
const bool  parking,
const SUMOTime  waitingTime,
const double  angle 
)

Sets the values which change possibly in every simulation step and are relevant for emsssion calculation.

Parameters
[in]stopDurationthe total duration of the current stop (-1 means no current stop)
[in]parkingwhether the current stop is a parking stop (only meaningful if stopDuration != -1)
[in]waitingTimethe current total waiting time
[in]anglethe current absolute angle of the vehicle

Definition at line 111 of file EnergyParams.cpp.

References myAmParking, myAngle, myLastAngle, myStopDurationSeconds, myWaitingTimeSeconds, and STEPS2TIME.

Referenced by MSVehicle::workOnMoveReminders().

Here is the caller graph for this function:

◆ setMass()

void EnergyParams::setMass ( const double  mass)

Sets the empty mass of the vehicle (type) This is to be used by traci/libsumo.

Parameters
[in]massthe new mass

Definition at line 123 of file EnergyParams.cpp.

References myHaveDefaultMass, myMap, and SUMO_ATTR_MASS.

◆ setSecondary()

void EnergyParams::setSecondary ( const EnergyParams secondaryParams)
inline

Set secondary params.

Parameters
[in]secondaryParamsThe secondary parameters

Definition at line 59 of file EnergyParams.h.

References mySecondaryParams.

Referenced by MSBaseVehicle::replaceVehicleType().

Here is the caller graph for this function:

◆ setTransportableMass()

void EnergyParams::setTransportableMass ( const double  mass)

Sets the mass of all transportables in the vehicle.

Parameters
[in]massthe new mass

Definition at line 130 of file EnergyParams.cpp.

References myTransportableMass.

Referenced by MSBaseVehicle::addTransportable(), and MSBaseVehicle::removeTransportable().

Here is the caller graph for this function:

Field Documentation

◆ myAmParking

bool EnergyParams::myAmParking = false
private

Definition at line 152 of file EnergyParams.h.

Referenced by isOff(), and setDynamicValues().

◆ myAngle

double EnergyParams::myAngle = INVALID_DOUBLE
private

Definition at line 155 of file EnergyParams.h.

Referenced by getAngleDiff(), and setDynamicValues().

◆ myCharacteristicMapMap

std::map<SumoXMLAttr, CharacteristicMap> EnergyParams::myCharacteristicMapMap
private

Definition at line 147 of file EnergyParams.h.

Referenced by EnergyParams(), and getCharacteristicMap().

◆ myDefault

const EnergyParams * EnergyParams::myDefault = nullptr
staticprivate

Definition at line 158 of file EnergyParams.h.

Referenced by getDefault().

◆ myHaveDefaultFrontSurfaceArea

bool EnergyParams::myHaveDefaultFrontSurfaceArea = false
private

Definition at line 150 of file EnergyParams.h.

Referenced by EnergyParams(), and getDoubleOptional().

◆ myHaveDefaultMass

bool EnergyParams::myHaveDefaultMass = false
private

Definition at line 149 of file EnergyParams.h.

Referenced by EnergyParams(), getDoubleOptional(), and setMass().

◆ myLastAngle

double EnergyParams::myLastAngle = INVALID_DOUBLE
private

Definition at line 154 of file EnergyParams.h.

Referenced by getAngleDiff(), and setDynamicValues().

◆ myMap

std::map<SumoXMLAttr, double> EnergyParams::myMap
private

The key->value maps.

Definition at line 146 of file EnergyParams.h.

Referenced by dump(), EnergyParams(), getDouble(), getDoubleOptional(), and setMass().

◆ myParamAttrs

const std::vector< SumoXMLAttr > EnergyParams::myParamAttrs
staticprivate
Initial value:
= {
}
@ SUMO_ATTR_GEAREFFICIENCY
Gear efficiency.
@ SUMO_ATTR_MAXIMUMPOWER
Maximum Power.
@ SUMO_ATTR_INTERNALBATTERYRESISTANCE
Internal battery resistance.
@ SUMO_ATTR_MAXIMUMTORQUE
Maximum torque.
@ SUMO_ATTR_ROLLDRAGCOEFFICIENT
Roll Drag coefficient.
@ SUMO_ATTR_CONSTANTPOWERINTAKE
Constant Power Intake.
@ SUMO_ATTR_LOADING
additional mass loaded on the vehicle
@ SUMO_ATTR_RECUPERATIONEFFICIENCY_BY_DECELERATION
Recuperation efficiency (by deceleration)
@ SUMO_ATTR_WHEELRADIUS
@ SUMO_ATTR_RECUPERATIONEFFICIENCY
Recuperation efficiency (constant)
@ SUMO_ATTR_AIRDRAGCOEFFICIENT
Air drag coefficient.
@ SUMO_ATTR_MAXIMUMRECUPERATIONPOWER
Maximum recuperation power.
@ SUMO_ATTR_SHUT_OFF_STOP
@ SUMO_ATTR_MAXIMUMRECUPERATIONTORQUE
Maximum recuperation torque.
@ SUMO_ATTR_RADIALDRAGCOEFFICIENT
Radial drag coefficient.
@ SUMO_ATTR_GEARRATIO
Gear ratio.
@ SUMO_ATTR_ROTATINGMASS
Mass equivalent of rotating elements.
@ SUMO_ATTR_PROPULSIONEFFICIENCY
Propulsion efficiency.
@ SUMO_ATTR_INTERNALMOMENTOFINERTIA
Internal moment of inertia.
@ SUMO_ATTR_NOMINALBATTERYVOLTAGE
Nominal battery voltage.
@ SUMO_ATTR_FRONTSURFACEAREA
Front surface area.
@ SUMO_ATTR_SHUT_OFF_AUTO
engine gets switched off if stopping duration exceeds value

Definition at line 38 of file EnergyParams.h.

Referenced by EnergyParams().

◆ mySecondaryParams

const EnergyParams* EnergyParams::mySecondaryParams = nullptr
private

◆ myStopDurationSeconds

double EnergyParams::myStopDurationSeconds = -1.
private

Definition at line 151 of file EnergyParams.h.

Referenced by isEngineOff(), isOff(), and setDynamicValues().

◆ myTransportableMass

double EnergyParams::myTransportableMass = 0.
private

Definition at line 156 of file EnergyParams.h.

Referenced by getTransportableMass(), and setTransportableMass().

◆ myWaitingTimeSeconds

double EnergyParams::myWaitingTimeSeconds = -1.
private

Definition at line 153 of file EnergyParams.h.

Referenced by isEngineOff(), and setDynamicValues().


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