make the implementation match what the UI claims (#2779)
This commit is contained in:
parent
a50f8e0077
commit
7d773bfb1d
|
@ -229,9 +229,14 @@ IIdleController::Phase IdleController::determinePhase(int rpm, int targetRpm, Se
|
|||
}
|
||||
|
||||
float IdleController::getCrankingOpenLoop(float clt) const {
|
||||
return
|
||||
CONFIG(crankingIACposition) // Base cranking position (cranking page)
|
||||
* interpolate2d(clt, config->cltCrankingCorrBins, config->cltCrankingCorr);
|
||||
float mult =
|
||||
CONFIG(overrideCrankingIacSetting)
|
||||
// Override to separate table
|
||||
? interpolate2d(clt, config->cltCrankingCorrBins, config->cltCrankingCorr)
|
||||
// Otherwise use plain running table
|
||||
: interpolate2d(clt, config->cltIdleCorrBins, config->cltIdleCorr);
|
||||
|
||||
return CONFIG(crankingIACposition) * mult;
|
||||
}
|
||||
|
||||
float IdleController::getRunningOpenLoop(float clt, SensorResult tps) const {
|
||||
|
@ -256,9 +261,7 @@ float IdleController::getRunningOpenLoop(float clt, SensorResult tps) const {
|
|||
|
||||
float IdleController::getOpenLoop(Phase phase, float clt, SensorResult tps) const {
|
||||
float running = getRunningOpenLoop(clt, tps);
|
||||
|
||||
// Cranking value is either its own table, or the running value if not overriden
|
||||
float cranking = CONFIG(overrideCrankingIacSetting) ? getCrankingOpenLoop(clt) : running;
|
||||
float cranking = getCrankingOpenLoop(clt);
|
||||
|
||||
// if we're cranking, nothing more to do.
|
||||
if (phase == Phase::Cranking) {
|
||||
|
|
|
@ -162,8 +162,18 @@ TEST(idle_v2, crankingOpenLoop) {
|
|||
for (size_t i = 0; i < efi::size(config->cltCrankingCorrBins); i++) {
|
||||
config->cltCrankingCorrBins[i] = i * 10;
|
||||
config->cltCrankingCorr[i] = i * 0.1f;
|
||||
|
||||
// different values in running so we can tell which one is used
|
||||
config->cltIdleCorrBins[i] = i * 10;
|
||||
config->cltIdleCorr[i] = i * 0.2f;
|
||||
}
|
||||
|
||||
// First test without override (ie, normal running CLT corr table)
|
||||
EXPECT_FLOAT_EQ(10, dut.getCrankingOpenLoop(10));
|
||||
EXPECT_FLOAT_EQ(50, dut.getCrankingOpenLoop(50));
|
||||
|
||||
// Test with override (use separate table)
|
||||
engineConfiguration->overrideCrankingIacSetting = true;
|
||||
EXPECT_FLOAT_EQ(5, dut.getCrankingOpenLoop(10));
|
||||
EXPECT_FLOAT_EQ(25, dut.getCrankingOpenLoop(50));
|
||||
}
|
||||
|
@ -214,17 +224,7 @@ struct MockOpenLoopIdler : public IdleController {
|
|||
MOCK_METHOD(float, getRunningOpenLoop, (float clt, SensorResult tps), (const, override));
|
||||
};
|
||||
|
||||
TEST(idle_v2, testOpenLoopCrankingNoOverride) {
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
StrictMock<MockOpenLoopIdler> dut;
|
||||
INJECT_ENGINE_REFERENCE(&dut);
|
||||
|
||||
EXPECT_CALL(dut, getRunningOpenLoop(30, SensorResult(0))).WillOnce(Return(33));
|
||||
|
||||
EXPECT_FLOAT_EQ(33, dut.getOpenLoop(ICP::Cranking, 30, 0));
|
||||
}
|
||||
|
||||
TEST(idle_v2, testOpenLoopCrankingOverride) {
|
||||
TEST(idle_v2, testOpenLoopCranking) {
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
StrictMock<MockOpenLoopIdler> dut;
|
||||
INJECT_ENGINE_REFERENCE(&dut);
|
||||
|
@ -243,7 +243,6 @@ TEST(idle_v2, openLoopRunningTaper) {
|
|||
StrictMock<MockOpenLoopIdler> dut;
|
||||
INJECT_ENGINE_REFERENCE(&dut);
|
||||
|
||||
CONFIG(overrideCrankingIacSetting) = true;
|
||||
CONFIG(afterCrankingIACtaperDuration) = 500;
|
||||
|
||||
EXPECT_CALL(dut, getRunningOpenLoop(30, SensorResult(0))).WillRepeatedly(Return(25));
|
||||
|
|
Loading…
Reference in New Issue