rusefi-1/unit_tests/test_speed_density.cpp

41 lines
1.1 KiB
C++
Raw Normal View History

2015-07-10 06:01:56 -07:00
/**
* @file test_speed_density.cpp
*
* @date Jun 26, 2014
2018-07-28 09:42:37 -07:00
* @author Andrey Belomutskiy, (c) 2012-2018
2015-07-10 06:01:56 -07:00
*/
#include "main.h"
#include "engine_test_helper.h"
#include "speed_density.h"
#include "test_speed_density.h"
2016-08-27 07:03:11 -07:00
#include "event_queue.h"
extern EventQueue schedulingQueue;
2015-07-10 06:01:56 -07:00
void testSpeedDensity(void) {
printf("*************************************************** testSpeedDensity\r\n");
EngineTestHelper eth(FORD_INLINE_6_1995);
EXPAND_EngineTestHelper;
2016-08-27 07:03:11 -07:00
schedulingQueue.clear(); // todo: there must be a better place for this
2015-07-10 06:01:56 -07:00
2018-07-28 12:24:07 -07:00
engineConfiguration->trigger.customTotalToothCount = 8;
2016-08-26 17:03:06 -07:00
eth.applyTriggerShape();
2015-07-10 06:01:56 -07:00
2016-01-24 22:02:55 -08:00
eth.fireTriggerEvents(36);
2017-05-15 20:33:22 -07:00
assertEqualsM("RPM", 1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
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
2018-07-28 12:24:07 -07:00
float airMass = getCylinderAirMass(engineConfiguration, 0.92, 98, 293.16);
2015-12-02 17:10:06 -08:00
assertEquals(0.9371, airMass);
2015-07-10 06:01:56 -07:00
// 0.01414 sec or 14.14 ms
2018-07-28 12:24:07 -07:00
assertEquals(0.01414, sdMath(engineConfiguration, airMass, 12.5));
2015-07-10 06:01:56 -07:00
}