rusefi-full/unit_tests/tests/test_fuel_wall_wetting.cpp

50 lines
1.5 KiB
C++
Raw Normal View History

/*
* @file test_fuel_wall_wetting.cpp
*
* See also test_accel_enrichment.cpp
*
* @date Oct 16, 2019
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#include "engine_test_helper.h"
2019-10-16 19:10:38 -07:00
TEST(fuel, testWallWettingEnrichmentMath) {
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
engineConfiguration->wwaeTau = 1.0f;
engineConfiguration->wwaeBeta = 0.40f;
engine->rpmCalculator.setRpmValue(3000 PASS_ENGINE_PARAMETER_SUFFIX);
2019-10-16 19:10:38 -07:00
// each invocation of 'adjust' changes WallWetting internal state
ASSERT_NEAR(16.6666, ENGINE(wallFuel).adjust(0, 10.0 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
2019-10-16 19:10:38 -07:00
ASSERT_NEAR(16.198, ENGINE(wallFuel).adjust(0, 10.0 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
}
2019-10-16 19:10:38 -07:00
TEST(fuel, testWallWettingEnrichmentScheduling) {
2019-10-16 19:10:38 -07:00
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
eth.setTriggerType(TT_ONE PASS_ENGINE_PARAMETER_SUFFIX);
eth.fireTriggerEvents2(/* count */ 5, 25 /* ms */);
ASSERT_EQ( 1200, GET_RPM()) << "RPM";
int expectedInvocationCounter = 4;
ASSERT_EQ(expectedInvocationCounter, ENGINE(wallFuel).invocationCounter);
2019-10-16 19:10:38 -07:00
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2019-10-16 19:10:38 -07:00
// still same 4 - wall wetting is NOT invoked from 'periodicFastCallback'
ASSERT_EQ(expectedInvocationCounter, ENGINE(wallFuel).invocationCounter);
}