2019-10-16 13:46:34 -07:00
|
|
|
/*
|
|
|
|
* @file test_fuel_wall_wetting.cpp
|
|
|
|
*
|
|
|
|
* See also test_accel_enrichment.cpp
|
|
|
|
*
|
|
|
|
* @date Oct 16, 2019
|
2020-01-07 21:02:40 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2019-10-16 13:46:34 -07:00
|
|
|
*/
|
|
|
|
|
2021-08-03 19:05:01 -07:00
|
|
|
#include "pch.h"
|
2019-10-16 13:46:34 -07:00
|
|
|
|
2019-10-16 19:10:38 -07:00
|
|
|
TEST(fuel, testWallWettingEnrichmentMath) {
|
2019-10-16 13:46:34 -07:00
|
|
|
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
|
|
|
|
|
|
|
engineConfiguration->wwaeTau = 1.0f;
|
|
|
|
engineConfiguration->wwaeBeta = 0.40f;
|
|
|
|
|
2020-09-05 15:49:42 -07:00
|
|
|
engine->rpmCalculator.setRpmValue(3000);
|
2019-10-16 13:46:34 -07:00
|
|
|
|
2020-07-20 00:04:05 -07:00
|
|
|
WallFuel wallFuel;
|
|
|
|
|
2019-10-16 19:10:38 -07:00
|
|
|
// each invocation of 'adjust' changes WallWetting internal state
|
2021-11-16 01:15:29 -08:00
|
|
|
ASSERT_NEAR(16.6666, wallFuel.adjust(10.0), EPS4D);
|
|
|
|
ASSERT_NEAR(16.198, wallFuel.adjust(10.0), EPS4D);
|
2019-10-16 19:10:38 -07:00
|
|
|
}
|
2019-10-16 13:46:34 -07:00
|
|
|
|
2019-10-16 19:10:38 -07:00
|
|
|
TEST(fuel, testWallWettingEnrichmentScheduling) {
|
2019-10-16 13:46:34 -07:00
|
|
|
|
2019-10-16 19:10:38 -07:00
|
|
|
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
|
|
|
|
|
|
|
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
|
|
|
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
eth.setTriggerType(TT_ONE);
|
2019-10-16 19:10:38 -07:00
|
|
|
|
|
|
|
|
|
|
|
eth.fireTriggerEvents2(/* count */ 5, 25 /* ms */);
|
|
|
|
ASSERT_EQ( 1200, GET_RPM()) << "RPM";
|
|
|
|
|
2019-10-16 21:06:54 -07:00
|
|
|
int expectedInvocationCounter = 1;
|
|
|
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
2020-07-20 00:04:05 -07:00
|
|
|
ASSERT_EQ(expectedInvocationCounter, ENGINE(injectionEvents.elements[i]).wallFuel.invocationCounter);
|
2019-10-16 21:06:54 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Cylinder 5 doesn't exist - shouldn't have been called!
|
2020-07-20 00:04:05 -07:00
|
|
|
ASSERT_EQ(0, ENGINE(injectionEvents.elements[5]).wallFuel.invocationCounter);
|
2019-10-16 13:46:34 -07:00
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
eth.engine.periodicFastCallback();
|
|
|
|
eth.engine.periodicFastCallback();
|
|
|
|
eth.engine.periodicFastCallback();
|
2019-10-16 13:46:34 -07:00
|
|
|
|
2019-10-16 21:06:54 -07:00
|
|
|
// still same 1 per cylinder - wall wetting is NOT invoked from 'periodicFastCallback'
|
|
|
|
for (int i = 0; i < 4; i++) {
|
2020-07-20 00:04:05 -07:00
|
|
|
ASSERT_EQ(expectedInvocationCounter, ENGINE(injectionEvents.elements[i]).wallFuel.invocationCounter);
|
2019-10-16 21:06:54 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Cylinder 5 doesn't exist - shouldn't have been called!
|
2020-07-20 00:04:05 -07:00
|
|
|
ASSERT_EQ(0, ENGINE(injectionEvents.elements[5]).wallFuel.invocationCounter);
|
2019-10-16 13:46:34 -07:00
|
|
|
}
|