diff --git a/src/foreign/PHEMlight/V5/cpp/CEP.cpp b/src/foreign/PHEMlight/V5/cpp/CEP.cpp index d3a933030172..5ce3568d88fc 100644 --- a/src/foreign/PHEMlight/V5/cpp/CEP.cpp +++ b/src/foreign/PHEMlight/V5/cpp/CEP.cpp @@ -193,49 +193,12 @@ namespace PHEMlightdllV5 { privateRatedPower = value; } - double CEP::CalcPower(double speed, double acc, double gradient, bool HBEV) { - //Declaration - double power = 0; - double rotFactor = GetRotationalCoeffecient(speed); - double powerAux = (_auxPower * getRatedPower()); - - //Calculate the power - power += (_massVehicle + _vehicleLoading) * Constants::GRAVITY_CONST * (_resistanceF0 + _resistanceF1 * speed + _resistanceF4 * std::pow(speed, 4)) * speed; - power += (_crossSectionalArea * _cWValue * Constants::AIR_DENSITY_CONST / 2) * std::pow(speed, 3); - power += (_massVehicle * rotFactor + _vehicleMassRot + _vehicleLoading) * acc * speed; - power += (_massVehicle + _vehicleLoading) * Constants::GRAVITY_CONST * gradient * 0.01 * speed; - power /= 1000; - power /= Constants::_DRIVE_TRAIN_EFFICIENCY; - if (!HBEV) { - power += powerAux; - } - - //Return result - return power; - } - - double CEP::CalcWheelPower(double speed, double acc, double gradient) { - //Declaration - double power = 0; - double rotFactor = GetRotationalCoeffecient(speed); - - //Calculate the power - power += (_massVehicle + _vehicleLoading) * Constants::GRAVITY_CONST * (_resistanceF0 + _resistanceF1 * speed + _resistanceF4 * std::pow(speed, 4)) * speed; - power += (_crossSectionalArea * _cWValue * Constants::AIR_DENSITY_CONST / 2) * std::pow(speed, 3); - power += (_massVehicle * rotFactor + _vehicleMassRot + _vehicleLoading) * acc * speed; - power += (_massVehicle + _vehicleLoading) * Constants::GRAVITY_CONST * gradient * 0.01 * speed; - power /= 1000; - - //Return result - return power; - } - - double CEP::CalcEngPower(double power) { - if (power < _normalizedPowerPatternFCvalues.front() * getRatedPower()) { - return _normalizedPowerPatternFCvalues.front() * getRatedPower(); + double CEP::CalcEngPower(double power, const double ratedPower) { + if (power < _normalizedPowerPatternFCvalues.front() * ratedPower) { + return _normalizedPowerPatternFCvalues.front() * ratedPower; } - if (power > _normalizedPowerPatternFCvalues.back() * getRatedPower()) { - return _normalizedPowerPatternFCvalues.back() * getRatedPower(); + if (power > _normalizedPowerPatternFCvalues.back() * ratedPower) { + return _normalizedPowerPatternFCvalues.back() * ratedPower; } return power; @@ -495,13 +458,6 @@ namespace PHEMlightdllV5 { return e1 + (px - p1) / (p2 - p1) * (e2 - e1); } - double CEP::GetMaxAccel(double speed, double gradient, bool HBEV) { - double rotFactor = GetRotationalCoeffecient(speed); - double pMaxForAcc = GetPMaxNorm(speed) * getRatedPower() - CalcPower(speed, 0, gradient, HBEV); - - return (pMaxForAcc * 1000) / ((_massVehicle * rotFactor + _vehicleMassRot + _vehicleLoading) * speed); - } - double CEP::GetPMaxNorm(double speed) { // Linear function between v0 and v1, constant elsewhere if (speed <= _pNormV0) { diff --git a/src/foreign/PHEMlight/V5/cpp/CEP.h b/src/foreign/PHEMlight/V5/cpp/CEP.h index 091977d7aee9..a240bfc3e146 100644 --- a/src/foreign/PHEMlight/V5/cpp/CEP.h +++ b/src/foreign/PHEMlight/V5/cpp/CEP.h @@ -128,11 +128,7 @@ namespace PHEMlightdllV5 { std::vector _dragNormTable; public: - double CalcPower(double speed, double acc, double gradient, bool HBEV); - - double CalcWheelPower(double speed, double acc, double gradient); - - double CalcEngPower(double power); + double CalcEngPower(double power, const double ratedPower); double GetEmission(const std::string& pollutant, double power, double speed, Helpers* VehicleClass, const double drivingPower, const double ratedPower); @@ -157,8 +153,6 @@ namespace PHEMlightdllV5 { double Interpolate(double px, double p1, double p2, double e1, double e2); public: - double GetMaxAccel(double speed, double gradient, bool HBEV); - double GetPMaxNorm(double speed); //-------------------------------------------------------------------------------------------------- diff --git a/src/utils/emissions/HelpersPHEMlight5.cpp b/src/utils/emissions/HelpersPHEMlight5.cpp index ba379b7107b1..79d2d832c297 100644 --- a/src/utils/emissions/HelpersPHEMlight5.cpp +++ b/src/utils/emissions/HelpersPHEMlight5.cpp @@ -172,7 +172,8 @@ HelpersPHEMlight5::getModifiedAccel(const SUMOEmissionClass c, const double v, c const double mass = param->getDoubleOptional(SUMO_ATTR_MASS, currCep->getVehicleMass()); const double massRot = currCep->getVehicleMassRot(); const double load = param->getDoubleOptional(SUMO_ATTR_LOADING, currCep->getVehicleLoading()); - const double pMaxForAcc = currCep->GetPMaxNorm(v) * currCep->getRatedPower() - calcPower(currCep, v, 0, slope, param); + const double ratedPower = param->getDoubleOptional(SUMO_ATTR_MAXIMUMPOWER, currCep->getRatedPower()); + const double pMaxForAcc = currCep->GetPMaxNorm(v) * ratedPower - calcPower(currCep, v, 0, slope, param); const double maxAcc = (pMaxForAcc * 1000) / ((mass * rotFactor + massRot + load) * v); return MIN2(a, maxAcc); } @@ -213,13 +214,13 @@ HelpersPHEMlight5::compute(const SUMOEmissionClass c, const PollutantsInterface: const bool isBEV = currCep->getFuelType() == PHEMlightdllV5::Constants::strBEV; const bool isHybrid = currCep->getCalcType() == PHEMlightdllV5::Constants::strHybrid; const double power_raw = calcPower(currCep, corrSpeed, corrAcc, slope, param); - const double power = isHybrid ? calcWheelPower(currCep, corrSpeed, corrAcc, slope, param) : currCep->CalcEngPower(power_raw); + const double ratedPower = param->getDoubleOptional(SUMO_ATTR_MAXIMUMPOWER, currCep->getRatedPower()); + const double power = isHybrid ? calcWheelPower(currCep, corrSpeed, corrAcc, slope, param) : currCep->CalcEngPower(power_raw, ratedPower); if (!isBEV && corrAcc < getCoastingDecel(c, corrSpeed, corrAcc, slope, param) && corrSpeed > PHEMlightdllV5::Constants::ZERO_SPEED_ACCURACY) { return 0.; } - const double ratedPower = param->getDoubleOptional(SUMO_ATTR_MAXIMUMPOWER, currCep->getRatedPower()); // TODO: this is probably only needed for non-heavy vehicles, so if execution speed becomes an issue this could be optimized out const double drivingPower = calcPower(currCep, PHEMlightdllV5::Constants::NORMALIZING_SPEED, PHEMlightdllV5::Constants::NORMALIZING_ACCELARATION, 0, param); switch (e) {