get rid of hysteresis functionality - see https://github.com/rusefi/rusefi/issues/6566#issuecomment-2166719232 (#6566)
This commit is contained in:
parent
ea1df222c4
commit
23f1466a85
|
@ -77,13 +77,11 @@ LaunchCondition LaunchControlBase::calculateRPMLaunchCondition(const int rpm) {
|
||||||
const int launchRpm = engineConfiguration->launchRpm;
|
const int launchRpm = engineConfiguration->launchRpm;
|
||||||
const int preLaunchRpm = launchRpm - engineConfiguration->launchRpmWindow;
|
const int preLaunchRpm = launchRpm - engineConfiguration->launchRpmWindow;
|
||||||
if (rpm < preLaunchRpm) {
|
if (rpm < preLaunchRpm) {
|
||||||
isAfterLaunch = false;
|
|
||||||
return LaunchCondition::NotMet;
|
return LaunchCondition::NotMet;
|
||||||
} else if (launchRpm <= rpm) {
|
} else if (launchRpm <= rpm) {
|
||||||
isAfterLaunch = true;
|
|
||||||
return LaunchCondition::Launch;
|
return LaunchCondition::Launch;
|
||||||
} else {
|
} else {
|
||||||
return (isAfterLaunch ? LaunchCondition::Launch : LaunchCondition::PreLaunch);
|
return LaunchCondition::PreLaunch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ bit isLaunchCondition
|
||||||
bit isSwitchActivated
|
bit isSwitchActivated
|
||||||
bit isClutchActivated
|
bit isClutchActivated
|
||||||
bit isValidInputPin
|
bit isValidInputPin
|
||||||
bit isAfterLaunch
|
|
||||||
|
|
||||||
bit activateSwitchCondition;
|
bit activateSwitchCondition;
|
||||||
bit rpmLaunchCondition;
|
bit rpmLaunchCondition;
|
||||||
|
|
|
@ -20,34 +20,34 @@ static void updateRpm(const int rpm) {
|
||||||
engine->launchController.update();
|
engine->launchController.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(rpmCondition, IncreasingRpm) {
|
TEST(rpmCondition, increasingRpm) {
|
||||||
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
||||||
|
|
||||||
setUpTestParameters();
|
setUpTestParameters();
|
||||||
|
|
||||||
/* RPM hasn't reached Launch RPM parameter - rpmCondition isn't satisfied: */
|
/* RPM hasn't reached Launch RPM parameter - rpmCondition isn't satisfied: */
|
||||||
EXPECT_FALSE(engine->launchController.rpmLaunchCondition); // check default value
|
EXPECT_FALSE(engine->launchController.rpmLaunchCondition); // check default value
|
||||||
EXPECT_FALSE(engine->launchController.isAfterLaunch); // check default value
|
EXPECT_FALSE(engine->launchController.rpmPreLaunchCondition); // check default value
|
||||||
|
|
||||||
updateRpm(TEST_PRELAUNCH_RPM - 1);
|
updateRpm(TEST_PRELAUNCH_RPM - 1);
|
||||||
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_FALSE(engine->launchController.isAfterLaunch);
|
EXPECT_FALSE(engine->launchController.rpmPreLaunchCondition);
|
||||||
|
|
||||||
updateRpm(TEST_PRELAUNCH_RPM);
|
updateRpm(TEST_PRELAUNCH_RPM);
|
||||||
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_FALSE(engine->launchController.isAfterLaunch);
|
EXPECT_TRUE(engine->launchController.rpmPreLaunchCondition);
|
||||||
|
|
||||||
updateRpm(TEST_LAUNCH_RPM - 1);
|
updateRpm(TEST_LAUNCH_RPM - 1);
|
||||||
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_FALSE(engine->launchController.isAfterLaunch);
|
EXPECT_TRUE(engine->launchController.rpmPreLaunchCondition);
|
||||||
|
|
||||||
updateRpm(TEST_LAUNCH_RPM);
|
updateRpm(TEST_LAUNCH_RPM);
|
||||||
/* RPM reached Launch RPM parameter - now rpmCondition is satisfied: */
|
/* RPM reached Launch RPM parameter - now rpmCondition is satisfied: */
|
||||||
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_TRUE(engine->launchController.isAfterLaunch);
|
EXPECT_FALSE(engine->launchController.rpmPreLaunchCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(rpmCondition, HysterisisOnDecreasingRpm) {
|
TEST(rpmCondition, decreasingRpm) {
|
||||||
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
||||||
|
|
||||||
setUpTestParameters();
|
setUpTestParameters();
|
||||||
|
@ -55,24 +55,24 @@ TEST(rpmCondition, HysterisisOnDecreasingRpm) {
|
||||||
updateRpm(TEST_LAUNCH_RPM);
|
updateRpm(TEST_LAUNCH_RPM);
|
||||||
/* RPM reached Launch RPM parameter - rpmCondition is satisfied: */
|
/* RPM reached Launch RPM parameter - rpmCondition is satisfied: */
|
||||||
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_TRUE(engine->launchController.isAfterLaunch);
|
EXPECT_FALSE(engine->launchController.rpmPreLaunchCondition);
|
||||||
|
|
||||||
updateRpm(TEST_LAUNCH_RPM - 1);
|
updateRpm(TEST_LAUNCH_RPM - 1);
|
||||||
/* RPM is below Launch RPM parameter, but still in Launch Control Window - so rpmCondition is still satisfied: */
|
/* RPM is below Launch RPM parameter, but still in Launch Control Window - so rpmCondition is still satisfied: */
|
||||||
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_TRUE(engine->launchController.isAfterLaunch);
|
EXPECT_TRUE(engine->launchController.rpmPreLaunchCondition);
|
||||||
|
|
||||||
updateRpm(TEST_PRELAUNCH_RPM);
|
updateRpm(TEST_PRELAUNCH_RPM);
|
||||||
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_TRUE(engine->launchController.isAfterLaunch);
|
EXPECT_TRUE(engine->launchController.rpmPreLaunchCondition);
|
||||||
|
|
||||||
updateRpm(TEST_PRELAUNCH_RPM - 1);
|
updateRpm(TEST_PRELAUNCH_RPM - 1);
|
||||||
/* RPM went down below Launch Control Window parameter - now rpmCondition is not satisfied: */
|
/* RPM went down below Launch Control Window parameter - now rpmCondition is not satisfied: */
|
||||||
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_FALSE(engine->launchController.isAfterLaunch);
|
EXPECT_FALSE(engine->launchController.rpmPreLaunchCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(rpmCondition, HysterisisRpmOscillation) {
|
TEST(rpmCondition, rpmOscillation) {
|
||||||
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
||||||
|
|
||||||
setUpTestParameters();
|
setUpTestParameters();
|
||||||
|
@ -80,39 +80,39 @@ TEST(rpmCondition, HysterisisRpmOscillation) {
|
||||||
updateRpm(TEST_LAUNCH_RPM);
|
updateRpm(TEST_LAUNCH_RPM);
|
||||||
/* RPM reached Launch RPM parameter - rpmCondition is satisfied: */
|
/* RPM reached Launch RPM parameter - rpmCondition is satisfied: */
|
||||||
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_TRUE(engine->launchController.isAfterLaunch);
|
EXPECT_FALSE(engine->launchController.rpmPreLaunchCondition);
|
||||||
|
|
||||||
updateRpm(TEST_LAUNCH_RPM - 1);
|
updateRpm(TEST_LAUNCH_RPM - 1);
|
||||||
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_TRUE(engine->launchController.isAfterLaunch);
|
EXPECT_TRUE(engine->launchController.rpmPreLaunchCondition);
|
||||||
|
|
||||||
updateRpm(TEST_LAUNCH_RPM + 1);
|
updateRpm(TEST_LAUNCH_RPM + 1);
|
||||||
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_TRUE(engine->launchController.isAfterLaunch);
|
EXPECT_FALSE(engine->launchController.rpmPreLaunchCondition);
|
||||||
|
|
||||||
updateRpm(TEST_PRELAUNCH_RPM);
|
updateRpm(TEST_PRELAUNCH_RPM);
|
||||||
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_TRUE(engine->launchController.isAfterLaunch);
|
EXPECT_TRUE(engine->launchController.rpmPreLaunchCondition);
|
||||||
|
|
||||||
updateRpm(TEST_LAUNCH_RPM + 2);
|
updateRpm(TEST_LAUNCH_RPM + 2);
|
||||||
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_TRUE(engine->launchController.isAfterLaunch);
|
EXPECT_FALSE(engine->launchController.rpmPreLaunchCondition);
|
||||||
|
|
||||||
updateRpm(TEST_PRELAUNCH_RPM - 1);
|
updateRpm(TEST_PRELAUNCH_RPM - 1);
|
||||||
/* RPM went down below Launch Control Window parameter - now rpmCondition is not satisfied: */
|
/* RPM went down below Launch Control Window parameter - now rpmCondition is not satisfied: */
|
||||||
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_FALSE(engine->launchController.isAfterLaunch);
|
EXPECT_FALSE(engine->launchController.rpmPreLaunchCondition);
|
||||||
|
|
||||||
updateRpm(TEST_PRELAUNCH_RPM);
|
updateRpm(TEST_PRELAUNCH_RPM);
|
||||||
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_FALSE(engine->launchController.isAfterLaunch);
|
EXPECT_TRUE(engine->launchController.rpmPreLaunchCondition);
|
||||||
|
|
||||||
updateRpm(TEST_LAUNCH_RPM - 1);
|
updateRpm(TEST_LAUNCH_RPM - 1);
|
||||||
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
EXPECT_FALSE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_FALSE(engine->launchController.isAfterLaunch);
|
EXPECT_TRUE(engine->launchController.rpmPreLaunchCondition);
|
||||||
|
|
||||||
/* RPM reached Launch RPM parameter again - now rpmCondition is satisfied: */
|
/* RPM reached Launch RPM parameter again - now rpmCondition is satisfied: */
|
||||||
updateRpm(TEST_LAUNCH_RPM);
|
updateRpm(TEST_LAUNCH_RPM);
|
||||||
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
EXPECT_TRUE(engine->launchController.rpmLaunchCondition);
|
||||||
EXPECT_TRUE(engine->launchController.isAfterLaunch);
|
EXPECT_FALSE(engine->launchController.rpmPreLaunchCondition);
|
||||||
}
|
}
|
Loading…
Reference in New Issue