Remove engine load acceleration enrichment fix #3357
This commit is contained in:
parent
bac43abe99
commit
61e2b3d5db
|
@ -141,9 +141,9 @@ struct TunerStudioOutputChannels {
|
||||||
scaled_channel<int16_t, 1000> wallFuelCorrection; // 74
|
scaled_channel<int16_t, 1000> wallFuelCorrection; // 74
|
||||||
|
|
||||||
// TPS/load AE
|
// TPS/load AE
|
||||||
scaled_percent engineLoadDelta; // 76
|
scaled_percent unused76; // 76
|
||||||
scaled_percent deltaTps; // 78
|
scaled_percent deltaTps; // 78
|
||||||
scaled_percent engineLoadAccelExtra; // 80
|
scaled_percent unused80; // 80
|
||||||
scaled_ms tpsAccelFuel; // 82
|
scaled_ms tpsAccelFuel; // 82
|
||||||
|
|
||||||
// Ignition
|
// Ignition
|
||||||
|
|
|
@ -752,10 +752,6 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
||||||
|
|
||||||
tsOutputChannels->tpsAccelFuel = engine->engineState.tpsAccelEnrich;
|
tsOutputChannels->tpsAccelFuel = engine->engineState.tpsAccelEnrich;
|
||||||
|
|
||||||
tsOutputChannels->engineLoadAccelExtra = engine->engineLoadAccelEnrichment.getEngineLoadEnrichment(PASS_ENGINE_PARAMETER_SIGNATURE) * 100 / Sensor::getOrZero(SensorType::Map);
|
|
||||||
|
|
||||||
tsOutputChannels->engineLoadDelta = engine->engineLoadAccelEnrichment.getMaxDelta();
|
|
||||||
|
|
||||||
tsOutputChannels->checkEngine = hasErrorCodes();
|
tsOutputChannels->checkEngine = hasErrorCodes();
|
||||||
|
|
||||||
#if EFI_MAX_31855
|
#if EFI_MAX_31855
|
||||||
|
|
|
@ -115,37 +115,6 @@ floatms_t TpsAccelEnrichment::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATUR
|
||||||
return extraFuel;
|
return extraFuel;
|
||||||
}
|
}
|
||||||
|
|
||||||
float LoadAccelEnrichment::getEngineLoadEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|
||||||
int index = getMaxDeltaIndex(PASS_ENGINE_PARAMETER_SIGNATURE);
|
|
||||||
|
|
||||||
float d = (cb.get(index) - (cb.get(index - 1))) * CONFIG(specs.cylindersCount);
|
|
||||||
|
|
||||||
float result = 0;
|
|
||||||
int distance = 0;
|
|
||||||
float taper = 0;
|
|
||||||
if (d > engineConfiguration->engineLoadAccelEnrichmentThreshold) {
|
|
||||||
|
|
||||||
distance = cb.currentIndex - index;
|
|
||||||
if (distance <= 0) // checking if indexes are out of order due to circular buffer nature
|
|
||||||
distance += minI(cb.getCount(), cb.getSize());
|
|
||||||
|
|
||||||
taper = interpolate2d(distance, engineConfiguration->mapAccelTaperBins, engineConfiguration->mapAccelTaperMult);
|
|
||||||
|
|
||||||
result = taper * d * engineConfiguration->engineLoadAccelEnrichmentMultiplier;
|
|
||||||
} else if (d < -engineConfiguration->engineLoadDecelEnleanmentThreshold) {
|
|
||||||
result = d * engineConfiguration->engineLoadAccelEnrichmentMultiplier;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (engineConfiguration->debugMode == DBG_EL_ACCEL) {
|
|
||||||
#if EFI_TUNER_STUDIO
|
|
||||||
tsOutputChannels.debugIntField1 = distance;
|
|
||||||
tsOutputChannels.debugFloatField1 = result;
|
|
||||||
tsOutputChannels.debugFloatField2 = taper;
|
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AccelEnrichment::resetAE() {
|
void AccelEnrichment::resetAE() {
|
||||||
cb.clear();
|
cb.clear();
|
||||||
}
|
}
|
||||||
|
@ -201,10 +170,6 @@ void TpsAccelEnrichment::onEngineCycleTps(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadAccelEnrichment::onEngineCycle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|
||||||
onNewValue(getFuelingLoad(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX);
|
|
||||||
}
|
|
||||||
|
|
||||||
AccelEnrichment::AccelEnrichment() {
|
AccelEnrichment::AccelEnrichment() {
|
||||||
resetAE();
|
resetAE();
|
||||||
cb.setSize(4);
|
cb.setSize(4);
|
||||||
|
@ -213,26 +178,12 @@ AccelEnrichment::AccelEnrichment() {
|
||||||
#if ! EFI_UNIT_TEST
|
#if ! EFI_UNIT_TEST
|
||||||
|
|
||||||
static void accelInfo() {
|
static void accelInfo() {
|
||||||
// efiPrintf("EL accel length=%d", mapInstance.cb.getSize());
|
|
||||||
efiPrintf("EL accel th=%.2f/mult=%.2f", engineConfiguration->engineLoadAccelEnrichmentThreshold, engineConfiguration->engineLoadAccelEnrichmentMultiplier);
|
|
||||||
efiPrintf("EL decel th=%.2f/mult=%.2f", engineConfiguration->engineLoadDecelEnleanmentThreshold, engineConfiguration->engineLoadDecelEnleanmentMultiplier);
|
|
||||||
|
|
||||||
// efiPrintf("TPS accel length=%d", tpsInstance.cb.getSize());
|
// efiPrintf("TPS accel length=%d", tpsInstance.cb.getSize());
|
||||||
efiPrintf("TPS accel th=%.2f/mult=%.2f", engineConfiguration->tpsAccelEnrichmentThreshold, -1);
|
efiPrintf("TPS accel th=%.2f/mult=%.2f", engineConfiguration->tpsAccelEnrichmentThreshold, -1);
|
||||||
|
|
||||||
efiPrintf("beta=%.2f/tau=%.2f", engineConfiguration->wwaeBeta, engineConfiguration->wwaeTau);
|
efiPrintf("beta=%.2f/tau=%.2f", engineConfiguration->wwaeBeta, engineConfiguration->wwaeTau);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setEngineLoadAccelThr(float value) {
|
|
||||||
engineConfiguration->engineLoadAccelEnrichmentThreshold = value;
|
|
||||||
accelInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setEngineLoadAccelMult(float value) {
|
|
||||||
engineConfiguration->engineLoadAccelEnrichmentMultiplier = value;
|
|
||||||
accelInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setTpsAccelThr(float value) {
|
void setTpsAccelThr(float value) {
|
||||||
engineConfiguration->tpsAccelEnrichmentThreshold = value;
|
engineConfiguration->tpsAccelEnrichmentThreshold = value;
|
||||||
accelInfo();
|
accelInfo();
|
||||||
|
@ -267,17 +218,7 @@ void setTpsAccelLen(int length) {
|
||||||
accelInfo();
|
accelInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setEngineLoadAccelLen(int length) {
|
|
||||||
if (length < 1) {
|
|
||||||
efiPrintf("Length should be positive");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
engine->engineLoadAccelEnrichment.setLength(length);
|
|
||||||
accelInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
void updateAccelParameters() {
|
void updateAccelParameters() {
|
||||||
setEngineLoadAccelLen(engineConfiguration->engineLoadAccelLength);
|
|
||||||
setTpsAccelLen(engineConfiguration->tpsAccelLength);
|
setTpsAccelLen(engineConfiguration->tpsAccelLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,15 +31,6 @@ public:
|
||||||
int onUpdateInvocationCounter = 0;
|
int onUpdateInvocationCounter = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LoadAccelEnrichment : public AccelEnrichment {
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @return Extra engine load value for fuel logic calculation
|
|
||||||
*/
|
|
||||||
float getEngineLoadEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
|
||||||
void onEngineCycle(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
|
||||||
};
|
|
||||||
|
|
||||||
class TpsAccelEnrichment : public AccelEnrichment {
|
class TpsAccelEnrichment : public AccelEnrichment {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -62,10 +53,6 @@ private:
|
||||||
|
|
||||||
void initAccelEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void initAccelEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
void setEngineLoadAccelLen(int len);
|
|
||||||
void setEngineLoadAccelThr(float value);
|
|
||||||
void setEngineLoadAccelMult(float value);
|
|
||||||
|
|
||||||
void setTpsAccelThr(float value);
|
void setTpsAccelThr(float value);
|
||||||
void setTpsDecelThr(float value);
|
void setTpsDecelThr(float value);
|
||||||
void setTpsDecelMult(float value);
|
void setTpsDecelMult(float value);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "maf.h"
|
#include "maf.h"
|
||||||
|
|
||||||
AirmassResult MafAirmass::getAirmass(int rpm) {
|
AirmassResult MafAirmass::getAirmass(int rpm) {
|
||||||
float maf = Sensor::getOrZero(SensorType::Maf) + engine->engineLoadAccelEnrichment.getEngineLoadEnrichment(PASS_ENGINE_PARAMETER_SIGNATURE);
|
float maf = Sensor::getOrZero(SensorType::Maf);
|
||||||
return getAirmassImpl(maf, rpm);
|
return getAirmassImpl(maf, rpm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,7 @@ AirmassResult SpeedDensityAirmass::getAirmass(int rpm) {
|
||||||
|
|
||||||
auto map = getMap(rpm);
|
auto map = getMap(rpm);
|
||||||
|
|
||||||
engine->engineState.sd.manifoldAirPressureAccelerationAdjustment = engine->engineLoadAccelEnrichment.getEngineLoadEnrichment(PASS_ENGINE_PARAMETER_SIGNATURE);
|
float adjustedMap = engine->engineState.sd.adjustedManifoldAirPressure = map;
|
||||||
|
|
||||||
float adjustedMap = engine->engineState.sd.adjustedManifoldAirPressure = map + engine->engineState.sd.manifoldAirPressureAccelerationAdjustment;
|
|
||||||
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(adjustedMap), "NaN adjustedMap", {});
|
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(adjustedMap), "NaN adjustedMap", {});
|
||||||
|
|
||||||
float ve = getVe(rpm, adjustedMap);
|
float ve = getVe(rpm, adjustedMap);
|
||||||
|
|
|
@ -231,11 +231,6 @@ void setDefaultFuel(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
// Decel fuel cut
|
// Decel fuel cut
|
||||||
setDefaultFuelCutParameters(PASS_CONFIG_PARAMETER_SIGNATURE);
|
setDefaultFuelCutParameters(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
// Accel Enrich
|
|
||||||
engineConfiguration->engineLoadAccelLength = 6;
|
|
||||||
engineConfiguration->engineLoadAccelEnrichmentThreshold = 5; // kPa
|
|
||||||
engineConfiguration->engineLoadAccelEnrichmentMultiplier = 0; // todo: improve implementation and re-enable by default
|
|
||||||
|
|
||||||
engineConfiguration->tpsAccelLength = 12;
|
engineConfiguration->tpsAccelLength = 12;
|
||||||
engineConfiguration->tpsAccelEnrichmentThreshold = 40; // TPS % change, per engine cycle
|
engineConfiguration->tpsAccelEnrichmentThreshold = 40; // TPS % change, per engine cycle
|
||||||
|
|
||||||
|
|
|
@ -249,7 +249,6 @@ public:
|
||||||
*/
|
*/
|
||||||
angle_t engineCycle;
|
angle_t engineCycle;
|
||||||
|
|
||||||
LoadAccelEnrichment engineLoadAccelEnrichment;
|
|
||||||
TpsAccelEnrichment tpsAccelEnrichment;
|
TpsAccelEnrichment tpsAccelEnrichment;
|
||||||
|
|
||||||
TriggerCentral triggerCentral;
|
TriggerCentral triggerCentral;
|
||||||
|
|
|
@ -183,7 +183,6 @@ efitimesec_t getTimeNowSeconds(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resetAccel(void) {
|
static void resetAccel(void) {
|
||||||
engine->engineLoadAccelEnrichment.resetAE();
|
|
||||||
engine->tpsAccelEnrichment.resetAE();
|
engine->tpsAccelEnrichment.resetAE();
|
||||||
|
|
||||||
for (size_t i = 0; i < efi::size(engine->injectionEvents.elements); i++)
|
for (size_t i = 0; i < efi::size(engine->injectionEvents.elements); i++)
|
||||||
|
|
|
@ -314,7 +314,6 @@ static void handleFuel(const bool limitedFuel, uint32_t trgEventIndex, int rpm,
|
||||||
ENGINE(tpsAccelEnrichment.onNewValue(Sensor::getOrZero(SensorType::Tps1) PASS_ENGINE_PARAMETER_SUFFIX));
|
ENGINE(tpsAccelEnrichment.onNewValue(Sensor::getOrZero(SensorType::Tps1) PASS_ENGINE_PARAMETER_SUFFIX));
|
||||||
if (trgEventIndex == 0) {
|
if (trgEventIndex == 0) {
|
||||||
ENGINE(tpsAccelEnrichment.onEngineCycleTps(PASS_ENGINE_PARAMETER_SIGNATURE));
|
ENGINE(tpsAccelEnrichment.onEngineCycleTps(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||||
ENGINE(engineLoadAccelEnrichment.onEngineCycle(PASS_ENGINE_PARAMETER_SIGNATURE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (limitedFuel) {
|
if (limitedFuel) {
|
||||||
|
|
|
@ -915,7 +915,6 @@ const plain_get_integer_s getI_plain[] = {
|
||||||
{"trigger_type", (int*)&engineConfiguration->trigger.type},
|
{"trigger_type", (int*)&engineConfiguration->trigger.type},
|
||||||
// {"idle_solenoid_freq", setIdleSolenoidFrequency},
|
// {"idle_solenoid_freq", setIdleSolenoidFrequency},
|
||||||
// {"tps_accel_len", setTpsAccelLen},
|
// {"tps_accel_len", setTpsAccelLen},
|
||||||
// {"engine_load_accel_len", setEngineLoadAccelLen},
|
|
||||||
// {"bor", setBor},
|
// {"bor", setBor},
|
||||||
// {"can_mode", setCanType},
|
// {"can_mode", setCanType},
|
||||||
// {"idle_rpm", setTargetIdleRpm},
|
// {"idle_rpm", setTargetIdleRpm},
|
||||||
|
@ -1039,8 +1038,6 @@ const command_f_s commandsF[] = {
|
||||||
{"tps_decel_threshold", setTpsDecelThr},
|
{"tps_decel_threshold", setTpsDecelThr},
|
||||||
{"tps_decel_multiplier", setTpsDecelMult},
|
{"tps_decel_multiplier", setTpsDecelMult},
|
||||||
{"cranking_priming_pulse", setCrankingPrimingPulse},
|
{"cranking_priming_pulse", setCrankingPrimingPulse},
|
||||||
{"engine_load_accel_threshold", setEngineLoadAccelThr},
|
|
||||||
{"engine_load_accel_multiplier", setEngineLoadAccelMult},
|
|
||||||
{"engine_decel_threshold", setDecelThr},
|
{"engine_decel_threshold", setDecelThr},
|
||||||
{"engine_decel_multiplier", setDecelMult},
|
{"engine_decel_multiplier", setDecelMult},
|
||||||
{"flat_injector_lag", setFlatInjectorLag},
|
{"flat_injector_lag", setFlatInjectorLag},
|
||||||
|
@ -1104,7 +1101,6 @@ const command_i_s commandsI[] = {{"ignition_mode", setIgnitionMode},
|
||||||
{"trigger_type", setTriggerType},
|
{"trigger_type", setTriggerType},
|
||||||
{"idle_solenoid_freq", setIdleSolenoidFrequency},
|
{"idle_solenoid_freq", setIdleSolenoidFrequency},
|
||||||
{"tps_accel_len", setTpsAccelLen},
|
{"tps_accel_len", setTpsAccelLen},
|
||||||
{"engine_load_accel_len", setEngineLoadAccelLen},
|
|
||||||
#endif // EFI_ENGINE_CONTROL
|
#endif // EFI_ENGINE_CONTROL
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
{"bor", setBor},
|
{"bor", setBor},
|
||||||
|
|
|
@ -1322,10 +1322,10 @@ int16_t tps2Max;Full throttle#2. tpsMax value as 10 bit ADC value. Not Voltage!\
|
||||||
|
|
||||||
int engineLoadAccelLength;;"cycles", 1, 0, 1, 200, 0
|
int engineLoadAccelLength;;"cycles", 1, 0, 1, 200, 0
|
||||||
|
|
||||||
float engineLoadDecelEnleanmentThreshold;;"roc", 1, 0, 0, 200, 3
|
float unusedEL1;;"roc", 1, 0, 0, 200, 3
|
||||||
float engineLoadDecelEnleanmentMultiplier;;"coeff", 1, 0, 0, 200, 3
|
float unusedEL1;;"coeff", 1, 0, 0, 200, 3
|
||||||
float engineLoadAccelEnrichmentThreshold;;"roc", 1, 0, 0, 200, 3
|
float unusedEL1;;"roc", 1, 0, 0, 200, 3
|
||||||
float engineLoadAccelEnrichmentMultiplier;;"coeff", 1, 0, 0, 200, 3
|
float unusedEL1;;"coeff", 1, 0, 0, 200, 3
|
||||||
|
|
||||||
|
|
||||||
uint32_t uartConsoleSerialSpeed;Band rate for primary TTL;"BPs", 1, 0, 0, 1000000, 0
|
uint32_t uartConsoleSerialSpeed;Band rate for primary TTL;"BPs", 1, 0, 0, 1000000, 0
|
||||||
|
|
Loading…
Reference in New Issue