Closes #781: add a realistic fuel-cut type rev limiter

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5379 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 04bb66437aab5a37b46f7d043b31ad99c19ded6e
Former-commit-id: 79be5047231b4f749c9bbefa950b4157cba403ce
This commit is contained in:
kakukri 2013-04-01 17:42:14 +00:00
parent 0a6a95873e
commit 4d9deafdb5
2 changed files with 16 additions and 7 deletions

View file

@ -47,6 +47,7 @@ SimEngineConfig(tCar *car)
car->engine.exhaust_refract = 0.1f;
car->engine.Tq_response = 0.0f;
car->engine.I_joint = car->engine.I;
car->engine.timeInLimiter = 0.0f;
sprintf(idx, "%s/%s", SECT_ENGINE, ARR_DATAPTS);
car->engine.curve.nbPts = GfParmGetEltNb(hdle, idx);
@ -151,7 +152,14 @@ SimEngineUpdateTq(tCar *car)
tdble alpha = car->ctrl->accelCmd;
if (engine->rads > engine->revsLimiter) {
alpha = 0.0;
if (car->features & FEAT_REVLIMIT) {
engine->timeInLimiter = 0.1;
}
}
if ( (car->features & FEAT_REVLIMIT) && (engine->timeInLimiter > 0.0f) ) {
alpha = 0.0;
engine->timeInLimiter -= SimDeltaTime;
}
tdble Tq_cur = (Tq_max + EngBrkK) * alpha;
engine->Tq = Tq_cur;
engine->Tq -= EngBrkK;

View file

@ -43,16 +43,17 @@ typedef struct
tdble revsMax;
tdble tickover;
tdble I;
tdble rads; /* revs in rad/s ... */
tdble Tq; /* output torque */
tdble Tq_response; /* response Tq due to mismatch */
tdble I_joint; /* joint inertia */
tdble rads; /* revs in rad/s ... */
tdble Tq; /* output torque */
tdble Tq_response; /* response Tq due to mismatch */
tdble I_joint; /* joint inertia */
tdble fuelcons;
tdble brakeCoeff; /* coefficient for constant engine brake */
tdble brakeLinCoeff; /* coefficient for RPM dependent engine brake */
tdble pressure;
tdble exhaust_pressure;
tdble exhaust_refract;
tdble pressure;
tdble exhaust_pressure;
tdble exhaust_refract;
tdble timeInLimiter; /* time to still spend with fuel cut, in secundum */
} tEngine;
#endif /* _ENGINE_H_ */