2018-03-04 13:13:23 -08:00
|
|
|
/*
|
|
|
|
* test_startOfCrankingPrimingPulse.cpp
|
|
|
|
*
|
|
|
|
* Created on: Mar 4, 2018
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2018
|
|
|
|
*/
|
|
|
|
|
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) {
|
2018-03-04 13:13:23 -08:00
|
|
|
printf("*************************************************** testPlainCrankingWithoutAdvancedFeatures\r\n");
|
|
|
|
|
2019-01-19 17:42:29 -08:00
|
|
|
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
2018-03-04 13:13:23 -08:00
|
|
|
|
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
|
|
|
|
2019-10-07 20:02:47 -07:00
|
|
|
eth.assertEvent5("sim start", 0, (void*)startSimultaniousInjection, 100000 - 1875);
|
|
|
|
eth.assertEvent5("sim end", 1, (void*)endSimultaniousInjection, 100000);
|
2018-03-04 13:13:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-01-13 19:15:21 -08:00
|
|
|
TEST(engine, testStartOfCrankingPrimingPulse) {
|
2018-03-04 20:32:25 -08:00
|
|
|
printf("*************************************************** testStartOfCrankingPrimingPulse\r\n");
|
2018-03-04 13:13:23 -08:00
|
|
|
|
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
|
|
|
// this -70 value comes from CLT error handling code
|
2019-01-14 15:38:20 -08:00
|
|
|
ASSERT_NEAR( 70, engine->sensors.clt, EPS4D) << "CLT#1";
|
2018-03-05 05:25:20 -08:00
|
|
|
|
|
|
|
// we need below freezing temperature to get prime fuel
|
|
|
|
// todo: less cruel CLT value assignment which would survive 'updateSlowSensors'
|
|
|
|
engine->sensors.clt = -10;
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|