idle data

This commit is contained in:
Matthew Kennedy 2023-05-05 12:48:38 -07:00
parent 5f1e14825c
commit ea81fdfc64
5 changed files with 43 additions and 41 deletions

View File

@ -32,7 +32,6 @@ bit isWarnNow;Warning: Active
bit isPedalError;Error: Pedal
bit launchTriggered;Launch Control Triggered
bit isTps2Error;Error: TPS2
bit isIdleClosedLoop;Idle: Closed Loop
bit injectorFault;Injector Fault
bit ignitionFault;Ignition Fault
@ -97,7 +96,6 @@ uint16_t rpmAcceleration;dRPM;"RPM acceleration",1, 0, 0, 5, 2
uint16_t autoscale coilDutyCycle;@@GAUGE_NAME_DWELL_DUTY@@;"%",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 0
! Idle & ETB
uint16_t autoscale idleAirValvePosition;@@GAUGE_NAME_IAC@@;"%",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 1
int16_t autoscale etbTarget;ETB Target;"%",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 2
int16_t autoscale etb1DutyCycle;@@GAUGE_NAME_ETB_DUTY@@;"%",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 1
! Fuel system
@ -131,6 +129,8 @@ uint16_t rpmAcceleration;dRPM;"RPM acceleration",1, 0, 0, 5, 2
int16_t autoscale lowFuelPressure;@@GAUGE_NAME_FUEL_PRESSURE_LOW@@;"kpa",{1/@@PACK_MULT_PRESSURE@@}, 0, 0, 0, 0
int16_t autoscale highFuelPressure;@@GAUGE_NAME_FUEL_PRESSURE_HIGH@@;"bar",{1/@@PACK_MULT_HIGH_PRESSURE@@}, 0, 0, 0, 0
int16_t autoscale rawPpsSecondary;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int8_t tcuDesiredGear;@@GAUGE_NAME_DESIRED_GEAR@@;"gear",1, 0, -1, 10, 0
uint8_t autoscale flexPercent;@@GAUGE_NAME_FLEX@@;"%",{1/2}, 0, 0, 0, 1
@ -190,8 +190,6 @@ uint16_t rpmAcceleration;dRPM;"RPM acceleration",1, 0, 0, 5, 2
uint8_t fuelClosedLoopBinIdx;;"", 1, 0, 0, 0, 0
int8_t tcuCurrentGear;@@GAUGE_NAME_CURRENT_GEAR@@;"gear", 1, 0, -1, 10, 0
int16_t autoscale rawPpsSecondary;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int8_t[12 iterate] knock;Knock: Cyl;"dBv",1, 0, 0, 0, 0
uint16_t autoscale AFRValue;@@GAUGE_NAME_AFR@@;"AFR",{1/@@PACK_MULT_AFR@@}, 0, 0, 0, 2

View File

@ -1,40 +1,41 @@
struct_no_prefix idle_state_s
custom idle_state_e 4 bits, S32, @OFFSET@, [0:2], "not important"
idle_state_e idleState
idle_state_e idleState
custom percent_t 4 scalar, F32, @OFFSET@, "", 1, 0, 0, 100, 2
percent_t currentIdlePosition;"idle: current position\nthat's current position with CLT and IAT corrections"
percent_t baseIdlePosition;"idle: base value\ncurrent position without adjustments (iacByTpsTaper, afterCrankingIACtaperDuration)"
percent_t iacByTpsTaper;idle: iacByTpsTaper portion
int throttlePedalUpState;idle: throttlePedalUpState\ntrue in IDLE throttle pedal state, false if driver is touching the pedal\ntodo: better name for this field?
percent_t currentIdlePosition;@@GAUGE_NAME_IAC@@;"%", 1, 0, 0, 0, 1
percent_t baseIdlePosition;Idle: Open loop
percent_t idleClosedLoop;Idle: Closed loop
percent_t iacByTpsTaper;Idle: iacByTpsTaper portion
int throttlePedalUpState;Idle: throttlePedalUpState\ntrue in IDLE throttle pedal state, false if driver is touching the pedal\ntodo: better name for this field?
bit mightResetPid;idle: mightResetPid\nThe idea of 'mightResetPid' is to reset PID only once - each time when TPS > idlePidDeactivationTpsThreshold.\nThe throttle pedal can be pressed for a long time, making the PID data obsolete (thus the reset is required).\nWe set 'mightResetPid' to true only if PID was actually used (i.e. idlePid.getOutput() was called) to save some CPU resources.\nSee automaticIdleController().
bit mightResetPid;Idle: mightResetPid\nThe idea of 'mightResetPid' is to reset PID only once - each time when TPS > idlePidDeactivationTpsThreshold.\nThe throttle pedal can be pressed for a long time, making the PID data obsolete (thus the reset is required).\nWe set 'mightResetPid' to true only if PID was actually used (i.e. idlePid.getOutput() was called) to save some CPU resources.\nSee automaticIdleController().
bit shouldResetPid;idle: shouldResetPid
bit wasResetPid;idle: wasResetPid\nThis is needed to slowly turn on the PID back after it was reset.
bit mustResetPid;idle: mustResetPid\nThis is used when the PID configuration is changed, to guarantee the reset
bit isCranking;idle: cranking
bit isIacTableForCoasting
bit notIdling
bit needReset;idle: reset
bit isInDeadZone;idle: dead zone
bit isBlipping
bit useClosedLoop
bit badTps
bit looksLikeRunning
bit looksLikeCoasting
bit looksLikeCrankToIdle
bit isVerboseIAC
bit isIdleCoasting;idle: coasting
bit shouldResetPid;Idle: shouldResetPid
bit wasResetPid;Idle: wasResetPid\nThis is needed to slowly turn on the PID back after it was reset.
bit mustResetPid;Idle: mustResetPid\nThis is used when the PID configuration is changed, to guarantee the reset
bit isCranking;Idle: cranking
bit isIacTableForCoasting
bit notIdling
bit needReset;Idle: reset
bit isInDeadZone;Idle: dead zone
bit isBlipping
bit looksLikeRunning
bit looksLikeCoasting
bit looksLikeCrankToIdle
bit isVerboseIAC
bit isIdleCoasting;Idle: coasting
bit isIdleClosedLoop;Idle: Closed loop active
int targetRpmByClt;idle: target by CLT
int targetRpmAcBump;idle: A/C bump
int idleTarget;Idle: Target RPM
int targetRpmByClt;Idle: Target RPM base
int targetRpmAcBump;Idle: Target A/C bump
percent_t iacByRpmTaper;idle: iacByRpmTaper portion
percent_t iacByRpmTaper;Idle: iacByRpmTaper portion
percent_t luaAdd;idle: Lua Adder
percent_t luaAdd;Idle: Lua Adder
! end of idle_state_s structure definition
end_struct

View File

@ -32,7 +32,9 @@ int IdleController::getTargetRpm(float clt) {
// alternator duty cycle has a similar logic
targetRpmAcBump = engine->module<AcController>().unmock().acButtonState ? engineConfiguration->acIdleRpmBump : 0;
return targetRpmByClt + targetRpmAcBump;
auto target = targetRpmByClt + targetRpmAcBump;
idleTarget = target;
return target;
}
IIdleController::Phase IdleController::determinePhase(int rpm, int targetRpm, SensorResult tps, float vss, float crankingTaperFraction) {
@ -40,9 +42,8 @@ IIdleController::Phase IdleController::determinePhase(int rpm, int targetRpm, Se
if (!engine->rpmCalculator.isRunning()) {
return Phase::Cranking;
}
badTps = !tps;
if (badTps) {
if (!tps) {
// If the TPS has failed, assume the engine is running
return Phase::Running;
}
@ -336,29 +337,30 @@ float IdleController::getIdlePosition(float rpm) {
iacPosition = getOpenLoop(phase, rpm, clt, tps, crankingTaper);
baseIdlePosition = iacPosition;
useClosedLoop = tps.Valid && engineConfiguration->idleMode == IM_AUTO;
// If TPS is working and automatic mode enabled, add any closed loop correction
if (useClosedLoop) {
iacPosition += getClosedLoop(phase, tps.Value, rpm, targetRpm);
if (tps.Valid && engineConfiguration->idleMode == IM_AUTO) {
auto closedLoop = getClosedLoop(phase, tps.Value, rpm, targetRpm);
idleClosedLoop = closedLoop;
iacPosition += closedLoop;
} else {
idleClosedLoop = 0;
}
iacPosition = clampPercentValue(iacPosition);
}
#if EFI_TUNER_STUDIO && (EFI_PROD_CODE || EFI_SIMULATOR)
engine->outputChannels.isIdleClosedLoop = phase == Phase::Idling;
if (engineConfiguration->idleMode == IM_AUTO) {
// see also tsOutputChannels->idlePosition
getIdlePid()->postState(engine->outputChannels.idleStatus);
}
engine->outputChannels.idleAirValvePosition = iacPosition;
extern StepperMotor iacMotor;
engine->outputChannels.idleTargetPosition = iacMotor.getTargetPosition();
#endif /* EFI_TUNER_STUDIO */
currentIdlePosition = iacPosition;
isIdleClosedLoop = phase == Phase::Idling;
return iacPosition;
#else
return 0;

View File

@ -130,6 +130,7 @@ Usages:
- name: idle_state
java: IdleState.java
folder: controllers/actuators
prepend: integration/rusefi_config_shared.txt
output_name: idle
- name: electronic_throttle

View File

@ -1248,7 +1248,7 @@ gaugeCategory = Boost PID
boostStatus_resetCounterGauge = boostStatus_resetCounter,"Boost PID resetCounter", "", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 0,0
gaugeCategory = Idle
idleAirValvePositionGauge = idleAirValvePosition, "Idle position", "%", 0, 100, 0, 0, 100, 100, 1, 1
idleAirValvePositionGauge = currentIdlePosition, "Idle position", "%", 0, 100, 0, 0, 100, 100, 1, 1
idleStatus_iTermGauge = idleStatus_iTerm,"Idle PID iTerm", "", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 3,3
idleStatus_dTermGauge = idleStatus_dTerm,"Idle PID dTerm", "", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 3,3
idleStatus_outputGauge = idleStatus_output,"Idle PID output", "", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 3,3
@ -1561,7 +1561,7 @@ gaugeCategory = GPPWM Outputs
indicator = { isIdleClosedLoop }, "Not idling", "Idling", white, black, green, black
indicator = { isIdleCoasting }, "Not coasting", "Coasting", white, black, green, black
indicator = { dfcoActive }, "Not decel fuel cut", "Decel fuel cut", white, black, yellow, black
indicator = { tpsAccelActive }, "No TPS accel", "TPS accel active", white, black, yellow, black
indicator = { isAboveAccelThreshold }, "No TPS accel", "TPS accel active", white, black, yellow, black
; error codes
indicator = { isTpsError }, "TPS OK", "TPS error", white, black, red, black