2015-12-14 10:01:18 -08:00
|
|
|
/*
|
|
|
|
* @file trigger_toyota.cpp
|
|
|
|
*
|
|
|
|
* https://thedeltaecho.wordpress.com/2010/03/14/2jz-ge-cam-crank-signals/
|
|
|
|
*
|
|
|
|
* @date Dec 14, 2015
|
2020-01-13 18:57:43 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2015-12-14 10:01:18 -08:00
|
|
|
*/
|
|
|
|
|
2022-04-25 17:38:16 -07:00
|
|
|
#include "pch.h"
|
|
|
|
|
2015-12-14 10:01:18 -08:00
|
|
|
#include "trigger_toyota.h"
|
|
|
|
|
2020-05-04 19:31:47 -07:00
|
|
|
/**
|
|
|
|
* https://rusefi.com/forum/viewtopic.php?f=5&t=1720
|
|
|
|
*/
|
2020-05-08 22:15:55 -07:00
|
|
|
void initialize2jzGE3_34_simulation_shape(TriggerWaveform *s) {
|
2022-09-23 17:39:41 -07:00
|
|
|
s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::Rise);
|
2020-05-08 22:15:55 -07:00
|
|
|
|
|
|
|
float camD = 720 / 6; // 120
|
|
|
|
|
2020-05-08 22:51:04 -07:00
|
|
|
float crankDelta = 720 / 36 / 2; // 10
|
|
|
|
|
|
|
|
float camAngle = 1;
|
|
|
|
float crankAngle = 2 * crankDelta; // skipping two teeth
|
2020-05-08 22:15:55 -07:00
|
|
|
|
|
|
|
for (int i = 0; i < 10; i++) {
|
2022-11-16 11:28:43 -08:00
|
|
|
s->addEvent720(crankAngle + 5, TriggerValue::RISE, TriggerWheel::T_SECONDARY);
|
|
|
|
s->addEvent720(crankAngle + crankDelta, TriggerValue::FALL, TriggerWheel::T_SECONDARY); // 120
|
2020-05-08 22:15:55 -07:00
|
|
|
crankAngle += 10;
|
|
|
|
} // 2 + 10
|
|
|
|
|
|
|
|
camAngle += camD;
|
2022-11-16 11:28:43 -08:00
|
|
|
s->addEvent720(camAngle, TriggerValue::RISE, TriggerWheel::T_PRIMARY); // 120
|
|
|
|
s->addEvent720(camAngle + 3, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
|
2020-05-08 22:15:55 -07:00
|
|
|
|
|
|
|
for (int i = 0; i < 12; i++) {
|
2022-11-16 11:28:43 -08:00
|
|
|
s->addEvent720(crankAngle + 5, TriggerValue::RISE, TriggerWheel::T_SECONDARY);
|
|
|
|
s->addEvent720(crankAngle + crankDelta, TriggerValue::FALL, TriggerWheel::T_SECONDARY); // 120
|
2020-05-08 22:15:55 -07:00
|
|
|
crankAngle += 10;
|
|
|
|
} // 2 + 22
|
|
|
|
|
|
|
|
|
|
|
|
camAngle += camD;
|
|
|
|
|
|
|
|
for (int i = 0; i < 12; i++) {
|
2022-11-16 11:28:43 -08:00
|
|
|
s->addEvent720(crankAngle + 5, TriggerValue::RISE, TriggerWheel::T_SECONDARY);
|
|
|
|
s->addEvent720(crankAngle + crankDelta, TriggerValue::FALL, TriggerWheel::T_SECONDARY); // 120
|
2020-05-08 22:51:04 -07:00
|
|
|
crankAngle += crankDelta;
|
2020-05-08 22:15:55 -07:00
|
|
|
} // 2 + 34
|
2015-12-14 18:01:30 -08:00
|
|
|
|
2020-05-08 22:15:55 -07:00
|
|
|
camAngle += camD;
|
2022-11-16 11:28:43 -08:00
|
|
|
s->addEvent720(camAngle, TriggerValue::RISE, TriggerWheel::T_PRIMARY); // 360
|
|
|
|
s->addEvent720(camAngle + 3, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
|
2020-05-08 22:15:55 -07:00
|
|
|
|
|
|
|
crankAngle += 20; // skipping two teeth one more time
|
|
|
|
for (int i = 0; i < 10; i++) {
|
2022-11-16 11:28:43 -08:00
|
|
|
s->addEvent720(crankAngle + 5, TriggerValue::RISE, TriggerWheel::T_SECONDARY);
|
|
|
|
s->addEvent720(crankAngle + crankDelta, TriggerValue::FALL, TriggerWheel::T_SECONDARY); // 120
|
2020-05-08 22:51:04 -07:00
|
|
|
crankAngle += crankDelta;
|
2020-05-08 22:15:55 -07:00
|
|
|
} // 2 + 10
|
|
|
|
|
|
|
|
camAngle += camD;
|
|
|
|
|
|
|
|
for (int i = 0; i < 12; i++) {
|
2022-11-16 11:28:43 -08:00
|
|
|
s->addEvent720(crankAngle + 5, TriggerValue::RISE, TriggerWheel::T_SECONDARY);
|
|
|
|
s->addEvent720(crankAngle + crankDelta, TriggerValue::FALL, TriggerWheel::T_SECONDARY); // 120
|
2020-05-08 22:51:04 -07:00
|
|
|
crankAngle += crankDelta;
|
2020-05-08 22:15:55 -07:00
|
|
|
} // 2 + 22
|
|
|
|
|
|
|
|
camAngle += camD;
|
2022-11-16 11:28:43 -08:00
|
|
|
s->addEvent720(camAngle, TriggerValue::RISE, TriggerWheel::T_PRIMARY); // 600
|
|
|
|
s->addEvent720(camAngle + 3, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
|
2020-05-08 22:15:55 -07:00
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 12; i++) {
|
2022-11-16 11:28:43 -08:00
|
|
|
s->addEvent720(crankAngle + 5, TriggerValue::RISE, TriggerWheel::T_SECONDARY);
|
|
|
|
s->addEvent720(crankAngle + crankDelta, TriggerValue::FALL, TriggerWheel::T_SECONDARY); // 120
|
2020-05-08 22:15:55 -07:00
|
|
|
crankAngle += 10;
|
|
|
|
} // 2 + 32
|
|
|
|
camAngle += camD;
|
|
|
|
|
|
|
|
s->shapeWithoutTdc = true;
|
|
|
|
s->isSynchronizationNeeded = false;
|
2015-12-14 18:01:30 -08:00
|
|
|
}
|