fan/AC idle improvements (#2818)

* fan 2 open loop bump

* we had an AC target bump all this time?!

* format

* enable test

* I can't type
This commit is contained in:
Matthew Kennedy 2021-06-15 14:30:35 -07:00 committed by GitHub
parent f10607e6d5
commit a4973a6f3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 13 deletions

View File

@ -196,11 +196,15 @@ void IdleController::init(pid_s* idlePidConfig) {
} }
int IdleController::getTargetRpm(float clt) const { int IdleController::getTargetRpm(float clt) const {
// TODO: bump target rpm based on AC and/or fan(s)? auto target = interpolate2d(clt, CONFIG(cltIdleRpmBins), CONFIG(cltIdleRpm));
float fsioBump = engine->fsioState.fsioIdleTargetRPMAdjustment; // Bump for AC
target += engine->acSwitchState ? CONFIG(acIdleRpmBump) : 0;
return fsioBump + interpolate2d(clt, CONFIG(cltIdleRpmBins), CONFIG(cltIdleRpm)); // Bump by FSIO
target += engine->fsioState.fsioIdleTargetRPMAdjustment;
return target;
} }
IIdleController::Phase IdleController::determinePhase(int rpm, int targetRpm, SensorResult tps) const { IIdleController::Phase IdleController::determinePhase(int rpm, int targetRpm, SensorResult tps) const {
@ -247,9 +251,7 @@ float IdleController::getRunningOpenLoop(float clt, SensorResult tps) const {
// Now we bump it by the AC/fan amount if necessary // Now we bump it by the AC/fan amount if necessary
running += engine->acSwitchState ? CONFIG(acIdleExtraOffset) : 0; running += engine->acSwitchState ? CONFIG(acIdleExtraOffset) : 0;
running += enginePins.fanRelay.getLogicValue() ? CONFIG(fan1ExtraIdle) : 0; running += enginePins.fanRelay.getLogicValue() ? CONFIG(fan1ExtraIdle) : 0;
running += enginePins.fanRelay2.getLogicValue() ? CONFIG(fan2ExtraIdle) : 0;
// TODO: once we have dual fans, enable
//running += enginePins.fanRelay2.getLogicValue() ? CONFIG(fan2ExtraIdle) : 0;
// Now bump it by the specified amount when the throttle is opened (if configured) // Now bump it by the specified amount when the throttle is opened (if configured)
// nb: invalid tps will make no change, no explicit check required // nb: invalid tps will make no change, no explicit check required

View File

@ -1148,8 +1148,7 @@ bit unused_1484_bit_31
! todo: start using these parameters! ! todo: start using these parameters!
int16_t acCutoffLowRpm;;"RPM", 1, 0, 1, 15000, 0 int16_t acCutoffLowRpm;;"RPM", 1, 0, 1, 15000, 0
int16_t acCutoffHighRpm;;"RPM", 1, 0, 1, 15000, 0 int16_t acCutoffHighRpm;;"RPM", 1, 0, 1, 15000, 0
int16_t acIdleRpmBump;;"RPM", 1, 0, 1, 15000, 0 int16_t acIdleRpmBump;+Extra idle target speed when A/C is enabled. Some cars need the extra speed to keep the AC efficient while idling.;"RPM", 1, 0, 0, 1000, 0
int16_t warningPeriod;set warningPeriod X;"seconds", 1, 0, 0, 60, 0 int16_t warningPeriod;set warningPeriod X;"seconds", 1, 0, 0, 60, 0

View File

@ -2631,8 +2631,9 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
dialog = idleOpenLoop, "Open Loop Idle" dialog = idleOpenLoop, "Open Loop Idle"
slider = "Open loop base position", manIdlePosition, horizontal slider = "Open loop base position", manIdlePosition, horizontal
field = "A/C adder", acIdleExtraOffset field = "A/C adder", acIdleExtraOffset
field = "A/C target adder", acIdleRpmBump
field = "Fan #1 adder", fan1ExtraIdle field = "Fan #1 adder", fan1ExtraIdle
;field = "Fan #2 adder", fan2ExtraIdle field = "Fan #2 adder", fan2ExtraIdle
field = "Extra idle air if throttle pressed", iacByTpsTaper field = "Extra idle air if throttle pressed", iacByTpsTaper
dialog = idleGating, "Idle Detection Thresholds" dialog = idleGating, "Idle Detection Thresholds"

View File

@ -223,14 +223,14 @@ TEST(idle_v2, runningFanAcBump) {
enginePins.fanRelay.setValue(0); enginePins.fanRelay.setValue(0);
// Turn on the other fan! // Turn on the other fan!
//enginePins.fanRelay2.setValue(1); enginePins.fanRelay2.setValue(1);
//EXPECT_FLOAT_EQ(50 + 3, dut.getRunningOpenLoop(10, 0)); EXPECT_FLOAT_EQ(50 + 3, dut.getRunningOpenLoop(10, 0));
// Turn on everything! // Turn on everything!
engine->acSwitchState = true; engine->acSwitchState = true;
enginePins.fanRelay.setValue(1); enginePins.fanRelay.setValue(1);
///nginePins.fanRelay2.setValue(1); enginePins.fanRelay2.setValue(1);
EXPECT_FLOAT_EQ(50 + 9 + 7 /* + 3 */, dut.getRunningOpenLoop(10, 0)); EXPECT_FLOAT_EQ(50 + 9 + 7 + 3, dut.getRunningOpenLoop(10, 0));
} }
TEST(idle_v2, runningOpenLoopTpsTaper) { TEST(idle_v2, runningOpenLoopTpsTaper) {