Eclipse SUMO - Simulation of Urban MObility
|
An upper class for objects with additional parameters. More...
#include <EnergyParams.h>
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 CharacteristicMap & | getCharacteristicMap (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 EnergyParams * | getDefault () |
Private Member Functions | |
EnergyParams (const EnergyParams &s)=delete | |
invalidate copy constructor | |
EnergyParams & | operator= (const EnergyParams &s)=delete |
invalidate assignment operator | |
Private Attributes | |
bool | myAmParking = false |
double | myAngle = INVALID_DOUBLE |
std::map< SumoXMLAttr, CharacteristicMap > | myCharacteristicMapMap |
bool | myHaveDefaultFrontSurfaceArea = false |
bool | myHaveDefaultMass = false |
double | myLastAngle = INVALID_DOUBLE |
std::map< SumoXMLAttr, double > | myMap |
The key->value maps. | |
const EnergyParams * | mySecondaryParams = nullptr |
double | myStopDurationSeconds = -1. |
double | myTransportableMass = 0. |
double | myWaitingTimeSeconds = -1. |
Static Private Attributes | |
static const EnergyParams * | myDefault = nullptr |
static const std::vector< SumoXMLAttr > | myParamAttrs |
An upper class for objects with additional parameters.
Definition at line 45 of file EnergyParams.h.
EnergyParams::EnergyParams | ( | const SUMOVTypeParameter * | typeParams = nullptr | ) |
Constructor.
Definition at line 53 of file EnergyParams.cpp.
References DEFAULT_VEH_HEIGHT, DEFAULT_VEH_MASS, DEFAULT_VEH_WIDTH, SUMOVTypeParameter::emissionClass, Parameterised::getDouble(), PollutantsInterface::getName(), Parameterised::getParameter(), PollutantsInterface::getWeight(), Parameterised::hasParameter(), SUMOVTypeParameter::height, SUMOVTypeParameter::id, INVALID_DOUBLE, M_PI, SUMOVTypeParameter::mass, myCharacteristicMapMap, myHaveDefaultFrontSurfaceArea, myHaveDefaultMass, myMap, myParamAttrs, StringUtils::startsWith(), SUMO_ATTR_FRONTSURFACEAREA, SUMO_ATTR_INTERNALMOMENTOFINERTIA, SUMO_ATTR_MASS, SUMO_ATTR_POWERLOSSMAP, SUMO_ATTR_ROTATINGMASS, SVC_E_VEHICLE, SVC_HOV, SVC_PASSENGER, SVC_TAXI, TL, toString(), SUMOVTypeParameter::vehicleClass, VTYPEPARS_MASS_SET, SUMOVTypeParameter::wasSet(), SUMOVTypeParameter::width, WRITE_WARNING, and WRITE_WARNINGF.
|
inline |
Constructor.
Definition at line 51 of file EnergyParams.h.
EnergyParams::~EnergyParams | ( | ) |
Destructor.
Definition at line 107 of file EnergyParams.cpp.
|
privatedelete |
invalidate copy constructor
|
inline |
Returns a complete inner description.
Definition at line 123 of file EnergyParams.h.
References dump(), joinToString(), myMap, and mySecondaryParams.
Referenced by dump().
double EnergyParams::getAngleDiff | ( | ) | const |
Returns the angle difference between the last two calls of setDynamicValues (usually the last two time steps)
Definition at line 142 of file EnergyParams.cpp.
References GeomHelper::angleDiff(), INVALID_DOUBLE, myAngle, and myLastAngle.
Referenced by HelpersEnergy::compute().
const CharacteristicMap & EnergyParams::getCharacteristicMap | ( | SumoXMLAttr | attr | ) | const |
Return the CharacteristicMap that belongs to a given attribute.
[in] | attr | Name of an attribute |
Definition at line 184 of file EnergyParams.cpp.
References getCharacteristicMap(), myCharacteristicMapMap, mySecondaryParams, and toString().
Referenced by HelpersMMPEVEM::compute(), and getCharacteristicMap().
|
inlinestatic |
Definition at line 137 of file EnergyParams.h.
References myDefault.
Referenced by HelpersEnergy::acceleration(), HelpersEnergy::compute(), and PollutantsInterface::Helper::getCoastingDecel().
double EnergyParams::getDouble | ( | SumoXMLAttr | attr | ) | const |
Returns the value for a given key.
[in] | key | The key to ask for |
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().
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.
[in] | key | The key to ask for |
[in] | def | The default value if no value is stored or the stored value is flagged as default |
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().
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.
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().
|
inline |
Returns the mass of all transportables in the vehicle.
Definition at line 80 of file EnergyParams.h.
References myTransportableMass.
Referenced by MSBaseVehicle::addTransportable(), HelpersPHEMlight5::calcWheelPower(), HelpersPHEMlight5::getCoastingDecel(), HelpersPHEMlight5::getModifiedAccel(), getTotalMass(), and MSBaseVehicle::removeTransportable().
bool EnergyParams::isEngineOff | ( | ) | const |
Returns the state of the engine when the vehicle is not moving.
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().
bool EnergyParams::isOff | ( | ) | const |
Returns whether the vehicle is currently consuming any energy derived from the parking state.
Definition at line 204 of file EnergyParams.cpp.
References DEFAULT_VEH_SHUT_OFF_STOP, getDoubleOptional(), myAmParking, myStopDurationSeconds, and SUMO_ATTR_SHUT_OFF_STOP.
|
privatedelete |
invalidate assignment operator
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.
[in] | stopDuration | the total duration of the current stop (-1 means no current stop) |
[in] | parking | whether the current stop is a parking stop (only meaningful if stopDuration != -1) |
[in] | waitingTime | the current total waiting time |
[in] | angle | the 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().
void EnergyParams::setMass | ( | const double | mass | ) |
Sets the empty mass of the vehicle (type) This is to be used by traci/libsumo.
[in] | mass | the new mass |
Definition at line 123 of file EnergyParams.cpp.
References myHaveDefaultMass, myMap, and SUMO_ATTR_MASS.
|
inline |
Set secondary params.
[in] | secondaryParams | The secondary parameters |
Definition at line 59 of file EnergyParams.h.
References mySecondaryParams.
Referenced by MSBaseVehicle::replaceVehicleType().
void EnergyParams::setTransportableMass | ( | const double | mass | ) |
Sets the mass of all transportables in the vehicle.
[in] | mass | the new mass |
Definition at line 130 of file EnergyParams.cpp.
References myTransportableMass.
Referenced by MSBaseVehicle::addTransportable(), and MSBaseVehicle::removeTransportable().
|
private |
Definition at line 152 of file EnergyParams.h.
Referenced by isOff(), and setDynamicValues().
|
private |
Definition at line 155 of file EnergyParams.h.
Referenced by getAngleDiff(), and setDynamicValues().
|
private |
Definition at line 147 of file EnergyParams.h.
Referenced by EnergyParams(), and getCharacteristicMap().
|
staticprivate |
Definition at line 158 of file EnergyParams.h.
Referenced by getDefault().
|
private |
Definition at line 150 of file EnergyParams.h.
Referenced by EnergyParams(), and getDoubleOptional().
|
private |
Definition at line 149 of file EnergyParams.h.
Referenced by EnergyParams(), getDoubleOptional(), and setMass().
|
private |
Definition at line 154 of file EnergyParams.h.
Referenced by getAngleDiff(), and setDynamicValues().
|
private |
The key->value maps.
Definition at line 146 of file EnergyParams.h.
Referenced by dump(), EnergyParams(), getDouble(), getDoubleOptional(), and setMass().
|
staticprivate |
Definition at line 38 of file EnergyParams.h.
Referenced by EnergyParams().
|
private |
Definition at line 148 of file EnergyParams.h.
Referenced by dump(), getCharacteristicMap(), getDouble(), getDoubleOptional(), and setSecondary().
|
private |
Definition at line 151 of file EnergyParams.h.
Referenced by isEngineOff(), isOff(), and setDynamicValues().
|
private |
Definition at line 156 of file EnergyParams.h.
Referenced by getTransportableMass(), and setTransportableMass().
|
private |
Definition at line 153 of file EnergyParams.h.
Referenced by isEngineOff(), and setDynamicValues().