2018-03-04 13:13:23 -08:00
|
|
|
/*
|
|
|
|
* test_startOfCrankingPrimingPulse.cpp
|
|
|
|
*
|
|
|
|
* Created on: Mar 4, 2018
|
2020-01-13 18:57:43 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2018-03-04 13:13:23 -08:00
|
|
|
*/
|
|
|
|
|
2019-01-15 18:36:13 -08:00
|
|
|
#include "engine_test_helper.h"
|
2018-03-04 20:32:25 -08:00
|
|
|
|
2019-01-13 19:15:21 -08:00
|
|
|
TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
|
2019-01-19 17:42:29 -08:00
|
|
|
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
2018-03-04 13:13:23 -08:00
|
|
|
|
2020-11-03 11:12:26 -08:00
|
|
|
engineConfiguration->cranking.baseFuel = 12;
|
|
|
|
|
2018-03-04 13:30:03 -08:00
|
|
|
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
2019-01-21 18:48:58 -08:00
|
|
|
ASSERT_EQ( 0, GET_RPM()) << "RPM=0";
|
2018-03-04 13:13:23 -08:00
|
|
|
|
2019-01-10 22:18:35 -08:00
|
|
|
eth.fireTriggerEventsWithDuration(/* durationMs */ 200);
|
2018-03-04 15:12:52 -08:00
|
|
|
// still no RPM since need to cycles measure cycle duration
|
2019-01-21 18:48:58 -08:00
|
|
|
ASSERT_EQ( 0, GET_RPM()) << "start-RPM#1";
|
2018-03-04 20:32:25 -08:00
|
|
|
|
2018-07-28 16:51:41 -07:00
|
|
|
|
2019-01-10 22:18:35 -08:00
|
|
|
eth.fireRise(/* delayMs */ 200);
|
2019-01-21 18:48:58 -08:00
|
|
|
ASSERT_EQ( 300, GET_RPM()) << "RPM#2";
|
2018-03-04 20:32:25 -08:00
|
|
|
// two simultaneous injections
|
2019-01-14 15:38:20 -08:00
|
|
|
ASSERT_EQ( 4, engine->executor.size()) << "plain#2";
|
2018-03-04 13:13:23 -08:00
|
|
|
|
2021-06-01 22:21:36 -07:00
|
|
|
eth.assertEvent5("sim start", 0, (void*)startSimultaniousInjection, 100000 - 1625);
|
2020-10-26 04:23:13 -07:00
|
|
|
// -1 because ugh floating point math
|
|
|
|
eth.assertEvent5("sim end", 1, (void*)endSimultaniousInjection, 100000 - 1);
|
2018-03-04 13:13:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-01-13 19:15:21 -08:00
|
|
|
TEST(engine, testStartOfCrankingPrimingPulse) {
|
2019-01-19 17:42:29 -08:00
|
|
|
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
2018-03-04 20:32:25 -08:00
|
|
|
|
|
|
|
engineConfiguration->startOfCrankingPrimingPulse = 4;
|
|
|
|
|
2019-01-21 18:48:58 -08:00
|
|
|
ASSERT_EQ( 0, GET_RPM()) << "RPM=0";
|
2018-03-04 20:53:48 -08:00
|
|
|
|
2018-03-05 05:25:20 -08:00
|
|
|
// we need below freezing temperature to get prime fuel
|
2020-04-15 06:48:17 -07:00
|
|
|
Sensor::setMockValue(SensorType::Clt, -10);
|
2018-03-05 05:25:20 -08:00
|
|
|
|
2018-03-04 20:53:48 -08:00
|
|
|
// prod code invokes this on ECU start, here we have to mimic this behavior
|
|
|
|
startPrimeInjectionPulse(PASS_ENGINE_PARAMETER_SIGNATURE);
|
|
|
|
|
|
|
|
|
2019-01-14 15:38:20 -08:00
|
|
|
ASSERT_EQ( 1, engine->executor.size()) << "prime fuel";
|
2018-03-04 13:13:23 -08:00
|
|
|
}
|
|
|
|
|