NA6 pnp: automatic idle VS TPS #800

This commit is contained in:
rusefi 2019-08-30 18:17:10 -04:00
parent ad2714c2b8
commit 840b165f12
5 changed files with 29 additions and 12 deletions

View File

@ -178,12 +178,21 @@ static void undoIdleBlipIfNeeded() {
} }
} }
static bool isOutOfAutomaticIdleCondition(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
percent_t tpsPos = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
if (CONFIG(throttlePedalUpPin) != GPIO_UNASSIGNED)
return !engine->engineState.idle.throttlePedalUpState;
return tpsPos > CONFIGB(idlePidDeactivationTpsThreshold);
}
/** /**
* @return idle valve position percentage for automatic closed loop mode * @return idle valve position percentage for automatic closed loop mode
*/ */
static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) { static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
percent_t tpsPos = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE); if (isOutOfAutomaticIdleCondition(PASS_ENGINE_PARAMETER_SIGNATURE)) {
if (tpsPos > CONFIGB(idlePidDeactivationTpsThreshold)) {
// Don't store old I and D terms if PID doesn't work anymore. // Don't store old I and D terms if PID doesn't work anymore.
// Otherwise they will affect the idle position much later, when the throttle is closed. // Otherwise they will affect the idle position much later, when the throttle is closed.
if (mightResetPid) { if (mightResetPid) {
@ -221,6 +230,8 @@ static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// the state of PID has been changed, so we might reset it now, but only when needed (see idlePidDeactivationTpsThreshold) // the state of PID has been changed, so we might reset it now, but only when needed (see idlePidDeactivationTpsThreshold)
mightResetPid = true; mightResetPid = true;
percent_t tpsPos = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
#if EFI_IDLE_INCREMENTAL_PID_CIC #if EFI_IDLE_INCREMENTAL_PID_CIC
// Treat the 'newValue' as if it contains not an actual IAC position, but an incremental delta. // Treat the 'newValue' as if it contains not an actual IAC position, but an incremental delta.
// So we add this delta to the base IAC position, with a smooth taper for TPS transients. // So we add this delta to the base IAC position, with a smooth taper for TPS transients.
@ -294,7 +305,7 @@ public:
engine->clutchUpState = efiReadPin(CONFIGB(clutchUpPin)); engine->clutchUpState = efiReadPin(CONFIGB(clutchUpPin));
} }
if (CONFIG(throttlePedalUpPin) != GPIO_UNASSIGNED) { if (CONFIG(throttlePedalUpPin) != GPIO_UNASSIGNED) {
engine->engineState.idle.throttleUpState = efiReadPin(CONFIG(throttlePedalUpPin)); engine->engineState.idle.throttlePedalUpState = efiReadPin(CONFIG(throttlePedalUpPin));
} }
if (engineConfiguration->brakePedalPin != GPIO_UNASSIGNED) { if (engineConfiguration->brakePedalPin != GPIO_UNASSIGNED) {
@ -514,8 +525,10 @@ void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
DISPLAY_TEXT(Position_with_Adjustments); DISPLAY_TEXT(Position_with_Adjustments);
engine->engineState.idle.DISPLAY_FIELD(currentIdlePosition) = -100.0f; engine->engineState.idle.DISPLAY_FIELD(currentIdlePosition) = -100.0f;
DISPLAY_TEXT(EOL); DISPLAY_TEXT(EOL);
DISPLAY_TEXT(EOL);
DISPLAY_SENSOR(TPS);
DISPLAY_TEXT(Throttle_Up_State); DISPLAY_TEXT(Throttle_Up_State);
DISPLAY(DISPLAY_FIELD(throttleUpState)); DISPLAY(DISPLAY_FIELD(throttlePedalUpState));
DISPLAY(DISPLAY_CONFIG(throttlePedalUpPin)); DISPLAY(DISPLAY_CONFIG(throttlePedalUpPin));

View File

@ -1,4 +1,4 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Fri Aug 30 17:08:45 EDT 2019 // this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Fri Aug 30 18:02:22 EDT 2019
// by class com.rusefi.output.CHeaderConsumer // by class com.rusefi.output.CHeaderConsumer
// begin // begin
#ifndef CONTROLLERS_GENERATED_ENGINE_STATE_GENERATED_H #ifndef CONTROLLERS_GENERATED_ENGINE_STATE_GENERATED_H
@ -97,9 +97,11 @@ struct idle_state_s {
*/ */
percent_t baseIdlePosition = (percent_t)0; percent_t baseIdlePosition = (percent_t)0;
/** /**
* true in IDLE throttle pedal state, false if driver is touching the pedal
* todo: better name for this field?
* offset 12 * offset 12
*/ */
int throttleUpState = (int)0; int throttlePedalUpState = (int)0;
/** total size 16*/ /** total size 16*/
}; };
@ -243,4 +245,4 @@ typedef struct engine_state2_s engine_state2_s;
#endif #endif
// end // end
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Fri Aug 30 17:08:45 EDT 2019 // this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Fri Aug 30 18:02:22 EDT 2019

View File

@ -40,7 +40,7 @@ struct_no_prefix idle_state_s
idle_state_e idleState idle_state_e idleState
percent_t currentIdlePosition;that's current position with CLT and IAT corrections percent_t currentIdlePosition;that's current position with CLT and IAT corrections
percent_t baseIdlePosition;current position without adjustments (iacByTpsTaper, afterCrankingIACtaperDuration) percent_t baseIdlePosition;current position without adjustments (iacByTpsTaper, afterCrankingIACtaperDuration)
int throttleUpState int throttlePedalUpState;true in IDLE throttle pedal state, false if driver is touching the pedal\ntodo: better name for this field?
! end of idle_state_s structure definition ! end of idle_state_s structure definition
end_struct end_struct

View File

@ -1,6 +1,6 @@
package com.rusefi.config.generated; package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Fri Aug 30 17:08:45 EDT 2019 // this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Fri Aug 30 18:02:22 EDT 2019
// by class com.rusefi.output.JavaFieldsConsumer // by class com.rusefi.output.JavaFieldsConsumer
import com.rusefi.config.*; import com.rusefi.config.*;
@ -23,7 +23,7 @@ public class EngineState {
public static final Field IDLESTATE = Field.create("IDLESTATE", 32, FieldType.INT); public static final Field IDLESTATE = Field.create("IDLESTATE", 32, FieldType.INT);
public static final Field CURRENTIDLEPOSITION = Field.create("CURRENTIDLEPOSITION", 36, FieldType.FLOAT); public static final Field CURRENTIDLEPOSITION = Field.create("CURRENTIDLEPOSITION", 36, FieldType.FLOAT);
public static final Field BASEIDLEPOSITION = Field.create("BASEIDLEPOSITION", 40, FieldType.FLOAT); public static final Field BASEIDLEPOSITION = Field.create("BASEIDLEPOSITION", 40, FieldType.FLOAT);
public static final Field THROTTLEUPSTATE = Field.create("THROTTLEUPSTATE", 44, FieldType.INT); public static final Field THROTTLEPEDALUPSTATE = Field.create("THROTTLEPEDALUPSTATE", 44, FieldType.INT);
public static final Field TARGETAFR = Field.create("TARGETAFR", 48, FieldType.FLOAT); public static final Field TARGETAFR = Field.create("TARGETAFR", 48, FieldType.FLOAT);
public static final Field ENGINECYCLEDURATIONMS = Field.create("ENGINECYCLEDURATIONMS", 52, FieldType.FLOAT); public static final Field ENGINECYCLEDURATIONMS = Field.create("ENGINECYCLEDURATIONMS", 52, FieldType.FLOAT);
public static final Field MINRPMKCURRENTTPS = Field.create("MINRPMKCURRENTTPS", 56, FieldType.FLOAT); public static final Field MINRPMKCURRENTTPS = Field.create("MINRPMKCURRENTTPS", 56, FieldType.FLOAT);
@ -64,7 +64,7 @@ public class EngineState {
IDLESTATE, IDLESTATE,
CURRENTIDLEPOSITION, CURRENTIDLEPOSITION,
BASEIDLEPOSITION, BASEIDLEPOSITION,
THROTTLEUPSTATE, THROTTLEPEDALUPSTATE,
TARGETAFR, TARGETAFR,
ENGINECYCLEDURATIONMS, ENGINECYCLEDURATIONMS,
MINRPMKCURRENTTPS, MINRPMKCURRENTTPS,

View File

@ -12,8 +12,10 @@ public class IdleThreadMeta {
new TextRequest("Position_with_Adjustments"), new TextRequest("Position_with_Adjustments"),
new FieldRequest("currentIdlePosition"), new FieldRequest("currentIdlePosition"),
new TextRequest("EOL"), new TextRequest("EOL"),
new TextRequest("EOL"),
new SensorRequest("TPS"),
new TextRequest("Throttle_Up_State"), new TextRequest("Throttle_Up_State"),
new FieldRequest("throttleUpState"), new FieldRequest("throttlePedalUpState"),
new ConfigRequest("throttlePedalUpPin"), new ConfigRequest("throttlePedalUpPin"),
}; };
} }