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 {
|
float IdleController::getCrankingOpenLoop(float clt) const {
|
||||||
return
|
float mult =
|
||||||
CONFIG(crankingIACposition) // Base cranking position (cranking page)
|
CONFIG(overrideCrankingIacSetting)
|
||||||
* interpolate2d(clt, config->cltCrankingCorrBins, config->cltCrankingCorr);
|
// 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 {
|
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 IdleController::getOpenLoop(Phase phase, float clt, SensorResult tps) const {
|
||||||
float running = getRunningOpenLoop(clt, tps);
|
float running = getRunningOpenLoop(clt, tps);
|
||||||
|
float cranking = getCrankingOpenLoop(clt);
|
||||||
// Cranking value is either its own table, or the running value if not overriden
|
|
||||||
float cranking = CONFIG(overrideCrankingIacSetting) ? getCrankingOpenLoop(clt) : running;
|
|
||||||
|
|
||||||
// if we're cranking, nothing more to do.
|
// if we're cranking, nothing more to do.
|
||||||
if (phase == Phase::Cranking) {
|
if (phase == Phase::Cranking) {
|
||||||
|
|
|
@ -162,8 +162,18 @@ TEST(idle_v2, crankingOpenLoop) {
|
||||||
for (size_t i = 0; i < efi::size(config->cltCrankingCorrBins); i++) {
|
for (size_t i = 0; i < efi::size(config->cltCrankingCorrBins); i++) {
|
||||||
config->cltCrankingCorrBins[i] = i * 10;
|
config->cltCrankingCorrBins[i] = i * 10;
|
||||||
config->cltCrankingCorr[i] = i * 0.1f;
|
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(5, dut.getCrankingOpenLoop(10));
|
||||||
EXPECT_FLOAT_EQ(25, dut.getCrankingOpenLoop(50));
|
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));
|
MOCK_METHOD(float, getRunningOpenLoop, (float clt, SensorResult tps), (const, override));
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(idle_v2, testOpenLoopCrankingNoOverride) {
|
TEST(idle_v2, testOpenLoopCranking) {
|
||||||
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) {
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||||
StrictMock<MockOpenLoopIdler> dut;
|
StrictMock<MockOpenLoopIdler> dut;
|
||||||
INJECT_ENGINE_REFERENCE(&dut);
|
INJECT_ENGINE_REFERENCE(&dut);
|
||||||
|
@ -243,7 +243,6 @@ TEST(idle_v2, openLoopRunningTaper) {
|
||||||
StrictMock<MockOpenLoopIdler> dut;
|
StrictMock<MockOpenLoopIdler> dut;
|
||||||
INJECT_ENGINE_REFERENCE(&dut);
|
INJECT_ENGINE_REFERENCE(&dut);
|
||||||
|
|
||||||
CONFIG(overrideCrankingIacSetting) = true;
|
|
||||||
CONFIG(afterCrankingIACtaperDuration) = 500;
|
CONFIG(afterCrankingIACtaperDuration) = 500;
|
||||||
|
|
||||||
EXPECT_CALL(dut, getRunningOpenLoop(30, SensorResult(0))).WillRepeatedly(Return(25));
|
EXPECT_CALL(dut, getRunningOpenLoop(30, SensorResult(0))).WillRepeatedly(Return(25));
|
||||||
|
|
Loading…
Reference in New Issue