parent
27207dde9c
commit
10c1ad7698
|
@ -263,8 +263,6 @@ void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
#if EFI_MC33816
|
||||
initMc33816IfNeeded();
|
||||
#endif // EFI_MC33816
|
||||
|
||||
engineState.running.injectorLag = getInjectorLag(sensors.vBatt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,10 @@ EXTERN_ENGINE;
|
|||
|
||||
void InjectorModelBase::prepare() {
|
||||
m_massFlowRate = getInjectorMassFlowRate();
|
||||
m_deadtime = getDeadtime();
|
||||
float deadtime = getDeadtime();
|
||||
m_deadtime = deadtime;
|
||||
|
||||
postState(deadtime);
|
||||
}
|
||||
|
||||
constexpr float convertToGramsPerSecond(float ccPerMinute) {
|
||||
|
@ -27,6 +30,10 @@ float InjectorModel::getDeadtime() const {
|
|||
);
|
||||
}
|
||||
|
||||
void InjectorModel::postState(float deadtime) const {
|
||||
engine->engineState.running.injectorLag = deadtime;
|
||||
}
|
||||
|
||||
float InjectorModelBase::getInjectionDuration(float fuelMassGram) const {
|
||||
// TODO: support injector nonlinearity correction
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ public:
|
|||
virtual floatms_t getDeadtime() const = 0;
|
||||
virtual float getInjectorMassFlowRate() const = 0;
|
||||
|
||||
virtual void postState(float deadTime) const {};
|
||||
|
||||
private:
|
||||
float m_deadtime = 0;
|
||||
float m_massFlowRate = 0;
|
||||
|
@ -24,6 +26,7 @@ class InjectorModel final : public InjectorModelBase {
|
|||
public:
|
||||
DECLARE_ENGINE_PTR;
|
||||
|
||||
void postState(float deadtime) const override;
|
||||
floatms_t getDeadtime() const override;
|
||||
float getInjectorMassFlowRate() const override;
|
||||
};
|
||||
|
|
|
@ -159,20 +159,6 @@ floatms_t getRunningFuel(floatms_t baseFuel DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
|
||||
/* DISPLAY_ENDIF */
|
||||
|
||||
constexpr float convertToGramsPerSecond(float ccPerMinute) {
|
||||
float ccPerSecond = ccPerMinute / 60;
|
||||
return ccPerSecond * 0.72f; // 0.72g/cc fuel density
|
||||
}
|
||||
|
||||
/**
|
||||
* @return per cylinder injection time, in seconds
|
||||
*/
|
||||
static float getInjectionDurationForFuelMass(float fuelMass DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
float gPerSec = convertToGramsPerSecond(CONFIG(injector.flow));
|
||||
|
||||
return fuelMass / gPerSec;
|
||||
}
|
||||
|
||||
static SpeedDensityAirmass sdAirmass(veMap);
|
||||
static MafAirmass mafAirmass(veMap);
|
||||
static AlphaNAirmass alphaNAirmass(veMap);
|
||||
|
@ -218,7 +204,10 @@ floatms_t getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
ENGINE(engineState.ignitionLoad) = getLoadOverride(airmass.EngineLoadPercent, CONFIG(ignOverrideMode) PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
float baseFuelMass = ENGINE(fuelComputer)->getCycleFuel(airmass.CylinderAirmass, rpm, airmass.EngineLoadPercent);
|
||||
float baseFuel = getInjectionDurationForFuelMass(baseFuelMass PASS_ENGINE_PARAMETER_SUFFIX) * 1000;
|
||||
|
||||
ENGINE(injectorModel)->prepare();
|
||||
float baseFuel = ENGINE(injectorModel)->getInjectionDuration(baseFuelMass);
|
||||
|
||||
if (cisnan(baseFuel)) {
|
||||
// todo: we should not have this here but https://github.com/rusefi/rusefi/issues/1690
|
||||
return 0;
|
||||
|
@ -347,20 +336,6 @@ floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Injector lag correction
|
||||
* @param vBatt Battery voltage.
|
||||
* @return Time in ms for injection opening time based on current battery voltage
|
||||
*/
|
||||
floatms_t getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
if (cisnan(vBatt)) {
|
||||
warning(OBD_System_Voltage_Malfunction, "vBatt=%.2f", vBatt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return interpolate2d("lag", vBatt, engineConfiguration->injector.battLagCorrBins, engineConfiguration->injector.battLagCorr);
|
||||
}
|
||||
|
||||
static FuelComputer fuelComputer(afrMap);
|
||||
static InjectorModel injectorModel;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ float getBaroCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
|||
int getNumberOfInjections(injection_mode_e mode DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
angle_t getInjectionOffset(float rpm, float load DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
float getIatFuelCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
floatms_t getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
float getCltFuelCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
float getFuelCutOffCorrection(efitick_t nowNt, int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
angle_t getCltTimingCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
|
|
@ -200,7 +200,7 @@ static void showLine(lcd_line_e line, int screenY) {
|
|||
lcdPrintf("IAT corr %.2f", getIatFuelCorrection(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
return;
|
||||
case LL_FUEL_INJECTOR_LAG:
|
||||
lcdPrintf("ING LAG %.2f", getInjectorLag(engine->sensors.vBatt PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
lcdPrintf("ING LAG %.2f", engine->engineState.running.injectorLag);
|
||||
return;
|
||||
case LL_VBATT:
|
||||
lcdPrintf("Battery %.2fv", getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
|
|
|
@ -22,9 +22,6 @@ TEST(misc, testFuelMap) {
|
|||
printf("Setting up FORD_ASPIRE_1996\r\n");
|
||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
||||
|
||||
printf("*** getInjectorLag\r\n");
|
||||
assertEqualsM("lag", 1.04, getInjectorLag(12 PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
||||
for (int i = 0; i < VBAT_INJECTOR_CURVE_SIZE; i++) {
|
||||
eth.engine.engineConfigurationPtr->injector.battLagCorrBins[i] = i;
|
||||
eth.engine.engineConfigurationPtr->injector.battLagCorr[i] = 0.5 + 2 * i;
|
||||
|
@ -62,8 +59,6 @@ TEST(misc, testFuelMap) {
|
|||
ASSERT_EQ( 6, iatCorrection) << "IAT";
|
||||
float cltCorrection = getCltFuelCorrection(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
ASSERT_EQ( 7, cltCorrection) << "CLT";
|
||||
float injectorLag = getInjectorLag(getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
ASSERT_EQ( 0, injectorLag) << "injectorLag";
|
||||
|
||||
|
||||
engineConfiguration->mafAdcChannel = EFI_ADC_10;
|
||||
|
|
Loading…
Reference in New Issue