Implement `Secondary injector flow compensation mode` and `Secondary injector reference pressure` settings #6972 (#7079)

This commit is contained in:
kifir23917 2024-11-18 17:11:57 +02:00 committed by GitHub
parent 8633bd92ef
commit 1e87f77a70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 41 additions and 10 deletions

View File

@ -49,6 +49,9 @@ Release template (copy/paste this for new release):
- fix detect cylinder for knock then wasted_spark #7062
- Change BMW E46 CAN interval to 10 ms #6974
### Breaking Changes
- Now secondary injectors use `Secondary injector flow compensation mode` and `Secondary injector reference pressure` instead of `Injector flow compensation mode` and `Injector reference pressure` Tuner Studio settings #6972
## August 2024 "Day 898"
### Added

View File

@ -44,6 +44,14 @@ InjectorNonlinearMode InjectorModelPrimary::getNonlinearMode() const {
return engineConfiguration->injectorNonlinearMode;
}
injector_compensation_mode_e InjectorModelPrimary::getInjectorCompensationMode() const {
return engineConfiguration->injectorCompensationMode;
}
float InjectorModelPrimary::getFuelReferencePressure() const {
return engineConfiguration->fuelReferencePressure;
}
float InjectorModelSecondary::getSmallPulseFlowRate() const {
// not supported on second bank
return 0;
@ -54,6 +62,14 @@ float InjectorModelSecondary::getSmallPulseBreakPoint() const {
return 0;
}
injector_compensation_mode_e InjectorModelSecondary::getInjectorCompensationMode() const {
return engineConfiguration->secondaryInjectorCompensationMode;
}
float InjectorModelSecondary::getFuelReferencePressure() const {
return engineConfiguration->secondaryInjectorFuelReferencePressure;
}
InjectorNonlinearMode InjectorModelSecondary::getNonlinearMode() const {
// nonlinear not supported on second bank
return InjectorNonlinearMode::INJ_None;
@ -68,11 +84,10 @@ expected<float> InjectorModelWithConfig::getFuelDifferentialPressure() const {
baroKpa = 101.325f;
}
switch (engineConfiguration->injectorCompensationMode) {
switch (getInjectorCompensationMode()) {
case ICM_FixedRailPressure:
// Add barometric pressure, as "fixed" really means "fixed pressure above atmosphere"
return
engineConfiguration->fuelReferencePressure
return getFuelReferencePressure()
+ baroKpa
- map.value_or(101.325);
case ICM_SensedRailPressure: {
@ -112,11 +127,11 @@ expected<float> InjectorModelWithConfig::getFuelDifferentialPressure() const {
float InjectorModelWithConfig::getInjectorFlowRatio() {
// Compensation disabled, use reference flow.
if (engineConfiguration->injectorCompensationMode == ICM_None) {
if (getInjectorCompensationMode() == ICM_None) {
return 1.0f;
}
float referencePressure = engineConfiguration->fuelReferencePressure;
const float referencePressure = getFuelReferencePressure();
if (referencePressure < 50) {
// impossibly low fuel ref pressure

View File

@ -54,12 +54,14 @@ public:
expected<float> getFuelDifferentialPressure() const override;
using interface_t = IInjectorModel; // Mock interface
private:
[[nodiscard]] virtual injector_compensation_mode_e getInjectorCompensationMode() const = 0;
[[nodiscard]] virtual float getFuelReferencePressure() const = 0;
const injector_s* const m_cfg;
};
struct InjectorModelPrimary : public InjectorModelWithConfig {
struct InjectorModelPrimary : InjectorModelWithConfig {
InjectorModelPrimary();
InjectorNonlinearMode getNonlinearMode() const override;
@ -67,9 +69,12 @@ struct InjectorModelPrimary : public InjectorModelWithConfig {
// Ford small pulse model
float getSmallPulseFlowRate() const override;
float getSmallPulseBreakPoint() const override;
private:
[[nodiscard]] injector_compensation_mode_e getInjectorCompensationMode() const final;
[[nodiscard]] float getFuelReferencePressure() const final;
};
struct InjectorModelSecondary : public InjectorModelWithConfig {
struct InjectorModelSecondary : InjectorModelWithConfig {
InjectorModelSecondary();
InjectorNonlinearMode getNonlinearMode() const override;
@ -77,4 +82,7 @@ struct InjectorModelSecondary : public InjectorModelWithConfig {
// Ford small pulse model
float getSmallPulseFlowRate() const override;
float getSmallPulseBreakPoint() const override;
private:
[[nodiscard]] injector_compensation_mode_e getInjectorCompensationMode() const final;
[[nodiscard]] float getFuelReferencePressure() const final;
};

View File

@ -1718,7 +1718,10 @@ uint8_t autoscale knockFuelTrim;Fuel trim when knock, max 30%;"%", 1, 0, 0, 30,
float knockSpectrumSensitivity;;"sense", 1, 0, 0, 1, 2
float knockFrequency;"Estimated knock frequency, ignore cylinderBore if this one > 0";"Hz", 1, 0, 0, 20000, 2
#define END_OF_CALIBRATION_PADDING 116
injector_compensation_mode_e secondaryInjectorCompensationMode;None = I have a MAP-referenced fuel pressure regulator\nFixed rail pressure = I have an atmosphere-referenced fuel pressure regulator (returnless, typically)\nSensed rail pressure = I have a fuel pressure sensor;
float secondaryInjectorFuelReferencePressure;This is the pressure at which your injector flow is known.\nFor example if your injectors flow 400cc/min at 3.5 bar, enter 350kpa here.;"kPa", 1, 0, 50, 700000, 0
#define END_OF_CALIBRATION_PADDING 111
uint8_t[END_OF_CALIBRATION_PADDING] unusedOftenChangesDuringFirmwareUpdate;;"units", 1, 0, 0, 1, 0
! end of engine_configuration_s

View File

@ -2762,7 +2762,9 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
dialog = stagedInjection, "", yAxis
field = "Enable", enableStagedInjection, {isInjectionEnabled}
field = ""
field = "Secondary injector flow", injectorSecondary_flow {isInjectionEnabled && enableStagedInjection}
field = "Secondary injector flow", injectorSecondary_flow, {isInjectionEnabled && enableStagedInjection}
field = "Secondary injector flow compensation mode", secondaryInjectorCompensationMode, { isInjectionEnabled && enableStagedInjection }
field = "Secondary injector reference pressure", secondaryInjectorFuelReferencePressure, { isInjectionEnabled && enableStagedInjection && secondaryInjectorCompensationMode != 0 }
field = ""
panel = injectorsSecondaryDeadTime, {isInjectionEnabled && enableStagedInjection}