46 if (param ==
nullptr) {
62 power += 0.5 * mass * (v * v - lastV * lastV) /
TS;
86 if (angleDiff != 0.) {
88 double radius =
SPEED2DIST(v) / fabs(angleDiff);
91 if (radius < 0.0001) {
93 }
else if (radius > 10000) {
128 return power / 3600.;
138 if (param ==
nullptr) {
162 double const1, const2, const3;
195 const1 += 0.5 * mass * (2 * v);
196 const2 = 0.5 * mass * (
TS);
201 const1 += 0.5 * rotMass * (2 * v);
202 const2 += 0.5 * rotMass * (
TS);
208 Prest -= drag * (v * v * v);
209 const1 += drag * (3 * v * v *
TS);
210 const2 += drag * (3 * v *
TS *
TS);
211 const3 = drag * (
TS *
TS *
TS);
225 return MAX3(x1, x2, x3);
227 WRITE_ERROR(
TL(
"An acceleration given by the power was not found."));
@ 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_RADIALDRAGCOEFFICIENT
Radial drag coefficient.
@ SUMO_ATTR_ROTATINGMASS
Mass equivalent of rotating elements.
@ SUMO_ATTR_PROPULSIONEFFICIENCY
Propulsion efficiency.
@ SUMO_ATTR_FRONTSURFACEAREA
Front surface area.
An upper class for objects with additional parameters.
bool isOff() const
Returns whether the vehicle is currently consuming any energy derived from the parking state.
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 ...
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_FRONTSURFACE...
static const EnergyParams * getDefault()
double getAngleDiff() const
Returns the angle difference between the last two calls of setDynamicValues (usually the last two tim...
static constexpr double myDefaultRadialDragCoefficient
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.
static constexpr double myDefaultFrontSurfaceArea
static constexpr double myDefaultRollDragCoefficient
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.
static constexpr double myDefaultRecuperationEfficiency
HelpersEnergy()
Constructor (initializes myEmissionClassStrings)
static constexpr double myDefaultMass
static constexpr double myDefaultRotatingMass
static constexpr double myDefaultRecuperationEfficiencyByDeceleration
static constexpr double myDefaultAirDragCoefficient
static constexpr double myDefaultConstantPowerIntake
static constexpr double myDefaultPropulsionEfficiency
Helper methods for PHEMlight-based emission computation.
EmissionType
Enumerating all emission types, including fuel.
static std::tuple< int, double, double, double > cubicSolve(double a, double b, double c, double d)
Solver of cubic equation ax^3 + bx^2 + cx + d = 0.