Implement postCrankingFuelCorrection (#485)
This commit is contained in:
parent
bd2894f198
commit
d4974a783d
|
@ -193,6 +193,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
efitick_t nowNt = getTimeNowNt();
|
||||
if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
||||
crankingTime = nowNt;
|
||||
timeSinceCranking = 0.0f;
|
||||
} else {
|
||||
timeSinceCranking = nowNt - crankingTime;
|
||||
}
|
||||
|
@ -223,6 +224,18 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
cltFuelCorrection = getCltFuelCorrection(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
}
|
||||
|
||||
// post-cranking fuel enrichment.
|
||||
// for compatibility reasons, apply only if the factor is greater than zero (0.01 margin used)
|
||||
if (engineConfiguration->postCrankingFactor > 0.01f) {
|
||||
// convert to microsecs and then to seconds
|
||||
float timeSinceCrankingInSecs = NT2US(timeSinceCranking) / 1000000.0f;
|
||||
// use interpolation for correction taper
|
||||
postCrankingFuelCorrection = interpolateClamped(0.0f, engineConfiguration->postCrankingFactor,
|
||||
engineConfiguration->postCrankingDurationSec, 1.0f, timeSinceCrankingInSecs);
|
||||
} else {
|
||||
postCrankingFuelCorrection = 1.0f;
|
||||
}
|
||||
|
||||
cltTimingCorrection = getCltTimingCorrection(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
engineNoiseHipLevel = interpolate2d("knock", rpm, engineConfiguration->knockNoiseRpmBins,
|
||||
|
|
|
@ -164,10 +164,12 @@ floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
floatms_t getRunningFuel(floatms_t baseFuel DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
float iatCorrection = ENGINE(engineState.iatFuelCorrection);
|
||||
float cltCorrection = ENGINE(engineState.cltFuelCorrection);
|
||||
float postCrankingFuelCorrection = ENGINE(engineState.postCrankingFuelCorrection);
|
||||
efiAssert(!cisnan(iatCorrection), "NaN iatCorrection", 0);
|
||||
efiAssert(!cisnan(cltCorrection), "NaN cltCorrection", 0);
|
||||
efiAssert(!cisnan(postCrankingFuelCorrection), "NaN postCrankingFuelCorrection", 0);
|
||||
|
||||
floatms_t runningFuel = baseFuel * iatCorrection * cltCorrection + ENGINE(engineState.fuelPidCorrection);
|
||||
floatms_t runningFuel = baseFuel * iatCorrection * cltCorrection * postCrankingFuelCorrection + ENGINE(engineState.fuelPidCorrection);
|
||||
efiAssert(!cisnan(runningFuel), "NaN runningFuel", 0);
|
||||
ENGINE(engineState.runningFuel) = runningFuel;
|
||||
|
||||
|
|
Loading…
Reference in New Issue