adjust nb2 vvt sync (#3019)
* test existing implementation * nb2 vvt pattern sync * update test
This commit is contained in:
parent
a8afb6eb85
commit
d520d12490
|
@ -180,14 +180,16 @@ void configureMazdaProtegeLx(TriggerWaveform *s) {
|
||||||
void initializeMazdaMiataVVtCamShape(TriggerWaveform *s) {
|
void initializeMazdaMiataVVtCamShape(TriggerWaveform *s) {
|
||||||
s->initialize(FOUR_STROKE_CAM_SENSOR);
|
s->initialize(FOUR_STROKE_CAM_SENSOR);
|
||||||
|
|
||||||
s->setTriggerSynchronizationGap2(8.50 * TRIGGER_GAP_DEVIATION_LOW, 14.0);
|
// Nominal gap is 8.92
|
||||||
|
s->setTriggerSynchronizationGap2(7, 13);
|
||||||
|
// Nominal gap is 0.128
|
||||||
|
s->setSecondTriggerSynchronizationGap2(0.06f, 0.16f);
|
||||||
|
|
||||||
s->addEvent720(325, T_PRIMARY, TV_FALL);
|
s->addEvent720(325, T_PRIMARY, TV_FALL);
|
||||||
s->addEvent720(360, T_PRIMARY, TV_RISE);
|
s->addEvent720(360, T_PRIMARY, TV_RISE);
|
||||||
|
|
||||||
s->addEvent720(641, T_PRIMARY, TV_FALL);
|
s->addEvent720(641, T_PRIMARY, TV_FALL);
|
||||||
s->addEvent720(677, T_PRIMARY, TV_RISE);
|
s->addEvent720(679, T_PRIMARY, TV_RISE);
|
||||||
|
|
||||||
s->addEvent720(700, T_PRIMARY, TV_FALL);
|
s->addEvent720(700, T_PRIMARY, TV_FALL);
|
||||||
s->addEvent720(720, T_PRIMARY, TV_RISE);
|
s->addEvent720(720, T_PRIMARY, TV_RISE);
|
||||||
|
|
|
@ -128,14 +128,14 @@ TEST(trigger, testNB2CamInput) {
|
||||||
|
|
||||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||||
|
|
||||||
ASSERT_EQ( 0, GET_RPM()) << "testNB2CamInput RPM";
|
ASSERT_EQ( 0, GET_RPM());
|
||||||
for (int i = 0; i < 7;i++) {
|
for (int i = 0; i < 7;i++) {
|
||||||
eth.fireRise(25);
|
eth.fireRise(25);
|
||||||
ASSERT_EQ( 0, GET_RPM()) << "testNB2CamInput RPM";
|
ASSERT_EQ( 0, GET_RPM());
|
||||||
}
|
}
|
||||||
eth.fireRise(25);
|
eth.fireRise(25);
|
||||||
// first time we have RPM
|
// first time we have RPM
|
||||||
ASSERT_EQ(1200, GET_RPM()) << "testNB2CamInput RPM";
|
ASSERT_EQ(1200, GET_RPM());
|
||||||
|
|
||||||
int totalRevolutionCountBeforeVvtSync = 10;
|
int totalRevolutionCountBeforeVvtSync = 10;
|
||||||
// need to be out of VVT sync to see VVT sync in action
|
// need to be out of VVT sync to see VVT sync in action
|
||||||
|
@ -146,34 +146,39 @@ TEST(trigger, testNB2CamInput) {
|
||||||
|
|
||||||
eth.moveTimeForwardUs(MS2US(3)); // shifting VVT phase a few angles
|
eth.moveTimeForwardUs(MS2US(3)); // shifting VVT phase a few angles
|
||||||
|
|
||||||
// this would be ignored since we only consume the other kind of fronts here
|
|
||||||
hwHandleVvtCamSignal(TV_FALL, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
|
||||||
eth.moveTimeForwardUs(MS2US(20));
|
|
||||||
// this would be be first VVT signal - gap duration would be calculated against 'DEEP_IN_THE_PAST_SECONDS' initial value
|
|
||||||
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
|
// first gap - long
|
||||||
|
|
||||||
|
eth.moveTimeForwardUs(MS2US(130));
|
||||||
|
hwHandleVvtCamSignal(TV_FALL, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
eth.moveTimeForwardUs(MS2US( 30));
|
||||||
|
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
|
// second gap - short
|
||||||
|
|
||||||
eth.moveTimeForwardUs(MS2US(10));
|
eth.moveTimeForwardUs(MS2US(10));
|
||||||
hwHandleVvtCamSignal(TV_FALL, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
hwHandleVvtCamSignal(TV_FALL, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
eth.moveTimeForwardUs(MS2US(10));
|
eth.moveTimeForwardUs(MS2US(10));
|
||||||
// this second important front would give us first real VVT gap duration
|
|
||||||
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, engine->triggerCentral.getVVTPosition(0, 0));
|
ASSERT_FLOAT_EQ(0, engine->triggerCentral.getVVTPosition(0, 0));
|
||||||
ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
||||||
|
|
||||||
eth.moveTimeForwardUs(MS2US(100));
|
// Third gap - long
|
||||||
|
|
||||||
|
eth.moveTimeForwardUs(MS2US(130));
|
||||||
hwHandleVvtCamSignal(TV_FALL, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
hwHandleVvtCamSignal(TV_FALL, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
eth.moveTimeForwardUs(MS2US( 30));
|
eth.moveTimeForwardUs(MS2US( 30));
|
||||||
// this third important front would give us first comparison between two real gaps
|
|
||||||
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
ASSERT_NEAR(-67.6, engine->triggerCentral.getVVTPosition(0, 0), EPS3D);
|
EXPECT_NEAR(148.4f, engine->triggerCentral.getVVTPosition(0, 0), EPS3D);
|
||||||
// actually position based on VVT!
|
// actually position based on VVT!
|
||||||
ASSERT_EQ(totalRevolutionCountBeforeVvtSync + 2, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
ASSERT_EQ(totalRevolutionCountBeforeVvtSync + 2, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
|
||||||
|
|
||||||
float dutyCycleNt = engine->triggerCentral.vvtState[0][0].currentCycle.totalTimeNtCopy[0];
|
float dutyCycleNt = engine->triggerCentral.vvtState[0][0].currentCycle.totalTimeNtCopy[0];
|
||||||
ASSERT_FLOAT_EQ(6'000'000, dutyCycleNt);
|
EXPECT_FLOAT_EQ(27'000'000, dutyCycleNt);
|
||||||
ASSERT_FLOAT_EQ(0.059722222, engine->triggerCentral.vvtShape[0].expectedDutyCycle[0]);
|
EXPECT_FLOAT_EQ(0.056944445f, engine->triggerCentral.vvtShape[0].expectedDutyCycle[0]);
|
||||||
|
|
||||||
ASSERT_EQ(26, waveChart.getSize());
|
EXPECT_EQ(28, waveChart.getSize());
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ TEST(realCrankingNB2, crankingMissingInjector) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// VVT position nearly zero!
|
// VVT position nearly zero!
|
||||||
EXPECT_NEAR(engine->triggerCentral.getVVTPosition(0, 0), -17.8867f, 1e-4);
|
EXPECT_NEAR(engine->triggerCentral.getVVTPosition(0, 0), -7.1926f, 1e-4);
|
||||||
|
|
||||||
ASSERT_EQ(209, GET_RPM());
|
ASSERT_EQ(209, GET_RPM());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue