mirror of https://github.com/FOME-Tech/fome-fw.git
This commit is contained in:
parent
7dfabdbe4d
commit
b33ac53f28
|
@ -5,6 +5,7 @@ TEST_SRC_CPP = test_util.cpp \
|
||||||
test_basic_math/test_find_index.cpp \
|
test_basic_math/test_find_index.cpp \
|
||||||
test_basic_math/test_interpolation_3d.cpp \
|
test_basic_math/test_interpolation_3d.cpp \
|
||||||
test_cj125.cpp \
|
test_cj125.cpp \
|
||||||
|
test_hip9011.cpp \
|
||||||
test_data_structures/test_engine_math.cpp \
|
test_data_structures/test_engine_math.cpp \
|
||||||
test_startOfCrankingPrimingPulse.cpp \
|
test_startOfCrankingPrimingPulse.cpp \
|
||||||
test_fasterEngineSpinningUp.cpp \
|
test_fasterEngineSpinningUp.cpp \
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* @file test_hip9011.cpp
|
||||||
|
*
|
||||||
|
* Created on: Mar 22, 2018
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "unit_test_framework.h"
|
||||||
|
#include "hip9011_lookup.h"
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
TEST(hip9011, lookup) {
|
||||||
|
assertEqualsM2("", 3183.1013, getRpmByAngleWindowAndTimeUs(600, 360), 0.1);
|
||||||
|
assertEqualsM2("40us", 47746.5195, getRpmByAngleWindowAndTimeUs(40, 360), 0.1);
|
||||||
|
|
||||||
|
assertEqualsM2("600us 50 degree", 442.0974, getRpmByAngleWindowAndTimeUs(600, 50), 0.1);
|
||||||
|
assertEqualsM2("240us 50 degree", 1105.2435, getRpmByAngleWindowAndTimeUs(240, 50), 0.1);
|
||||||
|
assertEqualsM2("240us 50 degree", 6631.4619, getRpmByAngleWindowAndTimeUs(40, 50), 0.1);
|
||||||
|
|
||||||
|
EXPECT_EQ(0, getHip9011GainIndex(3));
|
||||||
|
EXPECT_EQ(0, getHip9011GainIndex(2));
|
||||||
|
EXPECT_EQ(47, getHip9011GainIndex(0.234));
|
||||||
|
EXPECT_EQ(63, getHip9011GainIndex(0.000001));
|
||||||
|
|
||||||
|
prepareHip9011RpmLookup(50);
|
||||||
|
|
||||||
|
EXPECT_EQ(31, getIntegrationIndexByRpm(1));
|
||||||
|
EXPECT_EQ(21, getIntegrationIndexByRpm(1100));
|
||||||
|
EXPECT_EQ(1, getIntegrationIndexByRpm(6600));
|
||||||
|
EXPECT_EQ(0, getIntegrationIndexByRpm(16600));
|
||||||
|
}
|
|
@ -8,7 +8,6 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "thermistors.h"
|
#include "thermistors.h"
|
||||||
#include "allsensors.h"
|
#include "allsensors.h"
|
||||||
#include "hip9011_lookup.h"
|
|
||||||
#include "engine_test_helper.h"
|
#include "engine_test_helper.h"
|
||||||
|
|
||||||
static ThermistorConf tc;
|
static ThermistorConf tc;
|
||||||
|
@ -58,35 +57,11 @@ void testTpsRateOfChange(void) {
|
||||||
// assertEquals(25, getTpsRateOfChange());
|
// assertEquals(25, getTpsRateOfChange());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void testHip9011lookup(void) {
|
|
||||||
print("************************************************** testHip9011lookup\r\n");
|
|
||||||
|
|
||||||
assertEqualsM2("", 3183.1013, getRpmByAngleWindowAndTimeUs(600, 360), 0.1);
|
|
||||||
assertEqualsM2("40us", 47746.5195, getRpmByAngleWindowAndTimeUs(40, 360), 0.1);
|
|
||||||
|
|
||||||
assertEqualsM2("600us 50 degree", 442.0974, getRpmByAngleWindowAndTimeUs(600, 50), 0.1);
|
|
||||||
assertEqualsM2("240us 50 degree", 1105.2435, getRpmByAngleWindowAndTimeUs(240, 50), 0.1);
|
|
||||||
assertEqualsM2("240us 50 degree", 6631.4619, getRpmByAngleWindowAndTimeUs(40, 50), 0.1);
|
|
||||||
|
|
||||||
assertEquals(0, getHip9011GainIndex(3));
|
|
||||||
assertEquals(0, getHip9011GainIndex(2));
|
|
||||||
assertEquals(47, getHip9011GainIndex(0.234));
|
|
||||||
assertEquals(63, getHip9011GainIndex(0.000001));
|
|
||||||
|
|
||||||
prepareHip9011RpmLookup(50);
|
|
||||||
|
|
||||||
assertEquals(31, getIntegrationIndexByRpm(1));
|
|
||||||
assertEquals(21, getIntegrationIndexByRpm(1100));
|
|
||||||
assertEquals(1, getIntegrationIndexByRpm(6600));
|
|
||||||
assertEquals(0, getIntegrationIndexByRpm(16600));
|
|
||||||
}
|
|
||||||
|
|
||||||
void testSensors(void) {
|
void testSensors(void) {
|
||||||
print("************************************************** testSensors\r\n");
|
print("************************************************** testSensors\r\n");
|
||||||
testMapDecoding();
|
testMapDecoding();
|
||||||
testTps();
|
testTps();
|
||||||
testTpsRateOfChange();
|
testTpsRateOfChange();
|
||||||
testHip9011lookup();
|
|
||||||
|
|
||||||
ThermistorMath tm;
|
ThermistorMath tm;
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue