adjust taper behavior (#3051)
* adjust taper behavior * check that taper works in running state too
This commit is contained in:
parent
ca34562d5d
commit
617c2886d9
|
@ -285,21 +285,17 @@ float IdleController::getOpenLoop(Phase phase, float clt, SensorResult tps, floa
|
|||
return cranking;
|
||||
}
|
||||
|
||||
float running = getRunningOpenLoop(clt, tps);
|
||||
|
||||
if (phase == Phase::CrankToRunTaper) {
|
||||
// Interpolate between cranking and running over a short time
|
||||
// This clamps once you fall off the end, so no explicit check for >1 required
|
||||
return interpolateClamped(0, cranking, 1, running, crankingTaperFraction);
|
||||
}
|
||||
|
||||
// If coasting (and enabled), use the coasting position table instead of normal open loop
|
||||
// TODO: this should be a table of open loop mult vs. RPM, not vs. clt
|
||||
if (CONFIG(useIacTableForCoasting) && phase == Phase::Coasting) {
|
||||
return interpolate2d(clt, CONFIG(iacCoastingBins), CONFIG(iacCoasting));
|
||||
}
|
||||
|
||||
return running;
|
||||
float running = getRunningOpenLoop(clt, tps);
|
||||
|
||||
// Interpolate between cranking and running over a short time
|
||||
// This clamps once you fall off the end, so no explicit check for >1 required
|
||||
return interpolateClamped(0, cranking, 1, running, crankingTaperFraction);
|
||||
}
|
||||
|
||||
float IdleController::getIdleTimingAdjustment(int rpm) {
|
||||
|
|
|
@ -292,15 +292,19 @@ TEST(idle_v2, openLoopRunningTaper) {
|
|||
EXPECT_CALL(dut, getCrankingOpenLoop(30)).WillRepeatedly(Return(75));
|
||||
|
||||
// 0 cycles - no taper yet, pure cranking value
|
||||
EXPECT_FLOAT_EQ(75, dut.getOpenLoop(ICP::Running, 30, 0, 0));
|
||||
EXPECT_FLOAT_EQ(75, dut.getOpenLoop(ICP::CrankToRunTaper, 30, 0, 0));
|
||||
|
||||
// 1/2 taper - half way, 50% each value -> outputs 50
|
||||
EXPECT_FLOAT_EQ(50, dut.getOpenLoop(ICP::Running, 30, 0, 0.5f));
|
||||
EXPECT_FLOAT_EQ(50, dut.getOpenLoop(ICP::CrankToRunTaper, 30, 0, 0.5f));
|
||||
|
||||
// 1x taper - fully tapered, should be running value
|
||||
EXPECT_FLOAT_EQ(25, dut.getOpenLoop(ICP::Running, 30, 0, 1.0f));
|
||||
EXPECT_FLOAT_EQ(25, dut.getOpenLoop(ICP::CrankToRunTaper, 30, 0, 1.0f));
|
||||
|
||||
// 2x taper - still fully tapered, should be running value
|
||||
EXPECT_FLOAT_EQ(25, dut.getOpenLoop(ICP::Running, 30, 0, 2.0f));
|
||||
EXPECT_FLOAT_EQ(25, dut.getOpenLoop(ICP::CrankToRunTaper, 30, 0, 2.0f));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue