Staged injection support; use two sets of injectors on the same engine #5247
This commit is contained in:
parent
1f64950e33
commit
81831abb97
|
@ -284,6 +284,12 @@ percent_t getInjectorDutyCycle(int rpm) {
|
|||
return 100 * totalInjectiorAmountPerCycle / engineCycleDuration;
|
||||
}
|
||||
|
||||
percent_t getInjectorDutyCycleStage2(int rpm) {
|
||||
floatms_t totalInjectiorAmountPerCycle = engine->engineState.injectionDurationStage2 * getNumberOfInjections(engineConfiguration->injectionMode);
|
||||
floatms_t engineCycleDuration = getEngineCycleDuration(rpm);
|
||||
return 100 * totalInjectiorAmountPerCycle / engineCycleDuration;
|
||||
}
|
||||
|
||||
static float getCycleFuelMass(bool isCranking, float baseFuelMass) {
|
||||
if (isCranking) {
|
||||
return getCrankingFuel(baseFuelMass);
|
||||
|
@ -317,6 +323,10 @@ float getInjectionMass(int rpm) {
|
|||
// Prepare injector flow rate & deadtime
|
||||
engine->module<InjectorModelPrimary>()->prepare();
|
||||
|
||||
if (engineConfiguration->enableStagedInjection) {
|
||||
engine->module<InjectorModelSecondary>()->prepare();
|
||||
}
|
||||
|
||||
floatms_t tpsAccelEnrich = engine->tpsAccelEnrichment.getTpsEnrichment();
|
||||
efiAssert(ObdCode::CUSTOM_ERR_ASSERT, !cisnan(tpsAccelEnrich), "NaN tpsAccelEnrich", 0);
|
||||
engine->engineState.tpsAccelEnrich = tpsAccelEnrich;
|
||||
|
@ -442,5 +452,31 @@ float getCylinderFuelTrim(size_t cylinderNumber, int rpm, float fuelLoad) {
|
|||
return (100 + trimPercent) / 100;
|
||||
}
|
||||
|
||||
static Hysteresis stage2Hysteresis;
|
||||
|
||||
float getStage2InjectionFraction(int rpm, float load) {
|
||||
if (!engineConfiguration->enableStagedInjection) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
float frac = 0.01f * interpolate3d(
|
||||
config->injectorStagingTable,
|
||||
config->injectorStagingLoadBins, load,
|
||||
config->injectorStagingRpmBins, rpm
|
||||
);
|
||||
|
||||
// don't allow very small fraction, with some hysteresis
|
||||
if (!stage2Hysteresis.test(frac, 0.1, 0.03)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Clamp to 90%
|
||||
if (frac > 0.9) {
|
||||
frac = 0.9;
|
||||
}
|
||||
|
||||
return frac;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue