rusefi-1/unit_tests/tests/test_speed_density.cpp

35 lines
1009 B
C++
Raw Normal View History

2015-07-10 06:01:56 -07:00
/**
* @file test_speed_density.cpp
*
* @date Jun 26, 2014
2020-01-13 18:57:43 -08:00
* @author Andrey Belomutskiy, (c) 2012-2020
2015-07-10 06:01:56 -07:00
*/
#include "engine_test_helper.h"
#include "speed_density.h"
2020-06-03 18:12:12 -07:00
#include "fuel_math.h"
2015-07-10 06:01:56 -07:00
2019-01-13 19:34:36 -08:00
TEST(big, testSpeedDensity) {
2015-07-10 06:01:56 -07:00
printf("*************************************************** testSpeedDensity\r\n");
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
2015-07-10 06:01:56 -07:00
2018-07-28 12:24:07 -07:00
engineConfiguration->trigger.customTotalToothCount = 8;
eth.applyTriggerWaveform();
2015-07-10 06:01:56 -07:00
2016-01-24 22:02:55 -08:00
eth.fireTriggerEvents(36);
2019-01-21 18:48:58 -08:00
ASSERT_EQ( 1500, GET_RPM()) << "RPM";
2015-07-10 06:01:56 -07:00
// 427 cubic inches, that's a LOT of engine
2018-07-28 12:31:01 -07:00
engineConfiguration->specs.displacement = 6.99728;
2018-07-28 12:24:07 -07:00
engineConfiguration->specs.cylindersCount = 8;
2015-07-10 06:01:56 -07:00
2018-07-28 12:24:07 -07:00
engineConfiguration->injector.flow = gramm_second_to_cc_minute(5.303);
2015-07-10 06:01:56 -07:00
2020-07-22 13:11:07 -07:00
float airMass = SpeedDensityBase::getAirmassImpl(0.92, 98, 293.16 PASS_ENGINE_PARAMETER_SUFFIX);
2015-12-02 17:10:06 -08:00
2019-01-14 15:20:20 -08:00
ASSERT_FLOAT_EQ(0.9371106624, airMass);
2015-12-02 17:10:06 -08:00
2015-07-10 06:01:56 -07:00
// 0.01414 sec or 14.14 ms
2020-06-03 18:12:12 -07:00
EXPECT_NEAR(0.014137, getInjectionDurationForAirmass(airMass, 12.5 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
2015-07-10 06:01:56 -07:00
}