49 double differentialRatio = 4.6,
double gearRatio = 4.5) {
50 return rpm * wheelDiameter_m *
M_PI / (differentialRatio * gearRatio * 60);
60 double differentialRatio,
double gearRatio) {
61 return speed_mps * differentialRatio * gearRatio * 60 / (wheelDiameter_m *
M_PI);
76 double sum = engineMapping->
x[0];
77 for (
int i = 1; i < engineMapping->
degree; i++) {
78 sum += engineMapping->
x[i] + pow(rpm, i);
98 double wheelDiameter_m,
double differentialRatio,
100 double rpm =
speed_mpsToRpm(speed_mps, wheelDiameter_m, differentialRatio, gearRatio);
112 double wheelDiameter_m,
double differentialRatio,
113 double gearRatio,
double engineEfficiency) {
114 double power_hp =
speed_mpsToPower_hp(speed_mps, engineMapping, wheelDiameter_m, differentialRatio, gearRatio);
115 return engineEfficiency * power_hp *
HP_TO_W / speed_mps;
126 return 0.5 * cAir * a_m2 * rho_kgpm3 * speed_mps * speed_mps;
136 return mass_kg *
GRAVITY_MPS2 * (cr1 + cr2 * speed_mps * speed_mps);
156 double cAir,
double a_m2,
double rho_kgpm3,
157 double cr1,
double cr2) {
158 return airDrag_N(speed_mps, cAir, a_m2, rho_kgpm3) +
187 for (newGear = 0; newGear <
ep.
nGears - 1; newGear++) {
223 double realAccel_mps2;
229 double correctedSpeed = std::max(speed_mps,
minSpeed_mps);
230 if (reqAccel_mps2 >= 0) {
238 double alpha =
ep.
dt / (tau +
ep.
dt);
240 realAccel_mps2 = alpha * reqAccel_mps2 + (1 - alpha) * accel_mps2;
246 return realAccel_mps2;
265 return std::max(maxDeceleration, newBrakesAccel_mps2);
#define ENGINE_PAR_XMLFILE
#define ENGINE_PAR_VEHICLE
#define UNUSED_PARAMETER(x)
double __brakesOneMinusAlpha
double __airFrictionCoefficient
void computeCoefficients()
struct PolynomialEngineModelRpmToHp engineMapping
double __speedToRpmCoefficient
double __speedToThrustCoefficient
struct GearShiftingRules shiftingRule
double __maxNoSlipAcceleration
double __rpmToSpeedCoefficient
double __maxAccelerationCoefficient
double maxEngineAcceleration_mps2(double speed_mps)
double maxNoSlipAcceleration_mps2()
void getEngineData(double speed_mps, int &gear, double &rpm)
double airDrag_N(double speed_mps, double cAir, double a_m2, double rho_kgpm3)
virtual double getRealAcceleration(double speed_mps, double accel_mps2, double reqAccel_mps2, SUMOTime timeStep=0)
double speed_mpsToPower_hp(double speed_mps, const struct EngineParameters::PolynomialEngineModelRpmToHp *engineMapping, double wheelDiameter_m, double differentialRatio, double gearRatio)
double thrust_NToAcceleration_mps2(double thrust_N)
double opposingForce_N(double speed_mps, double mass_kg, double slope, double cAir, double a_m2, double rho_kgpm3, double cr1, double cr2)
double getRealBrakingAcceleration(double speed_mps, double accel_mps2, double reqAccel_mps2, SUMOTime t)
virtual ~RealisticEngineModel()
double rpmToPower_hp(double rpm, const struct EngineParameters::PolynomialEngineModelRpmToHp *engineMapping)
double rpmToSpeed_mps(double rpm, double wheelDiameter_m, double differentialRatio, double gearRatio)
double speed_mpsToThrust_N(double speed_mps, const struct EngineParameters::PolynomialEngineModelRpmToHp *engineMapping, double wheelDiameter_m, double differentialRatio, double gearRatio, double engineEfficiency)
double speed_mpsToRpm(double speed_mps, double wheelDiameter_m, double differentialRatio, double gearRatio)
virtual void setParameter(const std::string parameter, const std::string &value)
double rollingResistance_N(double speed_mps, double mass_kg, double cr1, double cr2)
int performGearShifting(double speed_mps, double acceleration_mps2)
double getEngineTimeConstant_s(double rpm)
const EngineParameters & getEngineParameters()
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.
double x[MAX_POLY_DEGREE]