mirror of https://github.com/FOME-Tech/fome-fw.git
more ETB test coverage (#2039)
* test no pedal map * test open loop * open loop but not throttle Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
parent
cd2d568b74
commit
ab8248427c
|
@ -295,6 +295,15 @@ TEST(etb, setpointIdle) {
|
||||||
EXPECT_FLOAT_EQ(55, etb.getSetpoint().value_or(-1));
|
EXPECT_FLOAT_EQ(55, etb.getSetpoint().value_or(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(etb, setpointNoPedalMap) {
|
||||||
|
EtbController etb;
|
||||||
|
|
||||||
|
// Don't pass a pedal map
|
||||||
|
etb.init(ETB_Throttle1, nullptr, nullptr, nullptr);
|
||||||
|
|
||||||
|
EXPECT_EQ(etb.getSetpoint(), unexpected);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(etb, setpointIdleValveController) {
|
TEST(etb, setpointIdleValveController) {
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
|
|
||||||
|
@ -488,3 +497,40 @@ TEST(etb, closedLoopPid) {
|
||||||
EXPECT_FLOAT_EQ(etb.getClosedLoop(50, 70).value_or(-1), -60);
|
EXPECT_FLOAT_EQ(etb.getClosedLoop(50, 70).value_or(-1), -60);
|
||||||
EXPECT_FLOAT_EQ(etb.getClosedLoop(50, 30).value_or(-1), 75);
|
EXPECT_FLOAT_EQ(etb.getClosedLoop(50, 30).value_or(-1), 75);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(etb, openLoopThrottle) {
|
||||||
|
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||||
|
|
||||||
|
EtbController etb;
|
||||||
|
INJECT_ENGINE_REFERENCE(&etb);
|
||||||
|
etb.init(ETB_Throttle1, nullptr, nullptr, nullptr);
|
||||||
|
|
||||||
|
// Map [0, 100] -> [-50, 50]
|
||||||
|
setLinearCurve(engineConfiguration->etbBiasBins, 0, 100);
|
||||||
|
setLinearCurve(engineConfiguration->etbBiasValues, -50, 50);
|
||||||
|
|
||||||
|
EXPECT_NEAR(-50, etb.getOpenLoop(0).value_or(-1), EPS4D);
|
||||||
|
EXPECT_NEAR(-25, etb.getOpenLoop(25).value_or(-1), EPS4D);
|
||||||
|
EXPECT_NEAR(0, etb.getOpenLoop(50).value_or(-1), EPS4D);
|
||||||
|
EXPECT_NEAR(25, etb.getOpenLoop(75).value_or(-1), EPS4D);
|
||||||
|
EXPECT_NEAR(50, etb.getOpenLoop(100).value_or(-1), EPS4D);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(etb, openLoopNonThrottle) {
|
||||||
|
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||||
|
|
||||||
|
EtbController etb;
|
||||||
|
INJECT_ENGINE_REFERENCE(&etb);
|
||||||
|
etb.init(ETB_Wastegate, nullptr, nullptr, nullptr);
|
||||||
|
|
||||||
|
// Map [0, 100] -> [-50, 50]
|
||||||
|
setLinearCurve(engineConfiguration->etbBiasBins, 0, 100);
|
||||||
|
setLinearCurve(engineConfiguration->etbBiasValues, -50, 50);
|
||||||
|
|
||||||
|
// Should all return 0, as non-throttles don't use open loop table
|
||||||
|
EXPECT_EQ(0, etb.getOpenLoop(0).value_or(-1));
|
||||||
|
EXPECT_EQ(0, etb.getOpenLoop(25).value_or(-1));
|
||||||
|
EXPECT_EQ(0, etb.getOpenLoop(50).value_or(-1));
|
||||||
|
EXPECT_EQ(0, etb.getOpenLoop(75).value_or(-1));
|
||||||
|
EXPECT_EQ(0, etb.getOpenLoop(100).value_or(-1));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue