73 double c_d,
double A_front,
double i_gear,
double eta_gear,
double M_max,
74 double P_max,
double M_recup_max,
double P_recup_max,
double R_battery,
75 double U_battery_0,
double P_const,
77 double alpha,
double& ref_powerConsumption) {
78 const double EPS = 1e-6;
79 const double RHO_AIR = 1.204;
80 bool b_stateValid =
true;
83 const double e_i = 1.0 + Theta / (m * r_wheel * r_wheel);
85 const double v_mean = v - 0.5 * a * dt;
88 double F_a = m * a * e_i;
93 if (std::abs(v_mean) <=
EPS) {
97 double F_d = 0.5 * c_d * A_front * RHO_AIR * v_mean * v_mean;
99 const double F_tractive = F_a + F_gr + F_rr + F_d;
102 const double n_motor = v_mean / (2 *
M_PI * r_wheel) * 60 * i_gear;
104 double omega_motor = 2 *
M_PI * n_motor / 60;
105 if (omega_motor == 0) {
111 double M_motor = F_tractive * r_wheel / i_gear;
112 if (F_tractive < 0) {
118 double P_motor = M_motor * omega_motor;
123 if (M_motor > M_max) {
125 P_motor = M_motor * omega_motor;
126 b_stateValid =
false;
128 if (P_motor > P_max) {
130 M_motor = P_motor / omega_motor;
131 b_stateValid =
false;
138 if (M_motor < -M_recup_max) {
139 M_motor = -M_recup_max;
140 P_motor = M_motor * omega_motor;
142 if (P_motor < -P_recup_max) {
143 P_motor = -P_recup_max;
144 M_motor = P_motor / omega_motor;
149 double P_loss_motor =
150 ref_powerLossMap.
eval(std::vector<double> {n_motor, M_motor})[0];
151 if (std::isnan(P_loss_motor)) {
153 b_stateValid =
false;
157 double P_battery = P_motor + P_loss_motor + P_const;
159 double P_total = (U_battery_0 * U_battery_0) / (2.0 * R_battery)
160 - U_battery_0 * std::sqrt((U_battery_0 * U_battery_0
161 - 4.0 * R_battery * P_battery) / (4.0 * R_battery * R_battery));
163 ref_powerConsumption = P_total;
194 const double slope,
const EnergyParams* ptr_energyParams)
const {
235 A_front, i_gear, eta_gear, M_max, P_max, M_recup_max, P_recup_max,
236 R_battery, U_battery_0, P_const, ref_powerLossMap,
TS, v, a, slope, P);
bool calcPowerConsumption(double m, double r_wheel, double Theta, double c_rr, double c_d, double A_front, double i_gear, double eta_gear, double M_max, double P_max, double M_recup_max, double P_recup_max, double R_battery, double U_battery_0, double P_const, const CharacteristicMap &ref_powerLossMap, double dt, double v, double a, double alpha, double &ref_powerConsumption)
Compute the power consumption of an EV powertrain in a certain state.
@ 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_AIRDRAGCOEFFICIENT
Air drag coefficient.
@ SUMO_ATTR_POWERLOSSMAP
A string encoding the power loss map.
@ SUMO_ATTR_MAXIMUMRECUPERATIONPOWER
Maximum recuperation power.
@ SUMO_ATTR_MAXIMUMRECUPERATIONTORQUE
Maximum recuperation torque.
@ SUMO_ATTR_GEARRATIO
Gear ratio.
@ SUMO_ATTR_INTERNALMOMENTOFINERTIA
Internal moment of inertia.
@ SUMO_ATTR_NOMINALBATTERYVOLTAGE
Nominal battery voltage.
@ SUMO_ATTR_FRONTSURFACEAREA
Front surface area.
The purpose of this class is to store a characteristic map (German: Kennfeld) of arbitrary dimensions...
std::vector< double > eval(const std::vector< double > &ref_p, double eps=1e-6) const
Evaluate a point in the map using linear interpolation.
An upper class for objects with additional parameters.
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...
const CharacteristicMap & getCharacteristicMap(SumoXMLAttr attr) const
Return the CharacteristicMap that belongs to a given attribute.
HelpersMMPEVEM()
Constructor.
double compute(const SUMOEmissionClass, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const EnergyParams *ptr_energyParams) const
Compute the amount of emitted pollutants for an emission class in a given state.
double getWeight(const SUMOEmissionClass) const
Returns a reference weight in kg described by this emission class This implementation returns the def...
Helper methods for PHEMlight-based emission computation.
EmissionType
Enumerating all emission types, including fuel.