rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
HpfpLobe Class Reference

#include <high_pressure_fuel_pump.h>

Collaboration diagram for HpfpLobe:
Collaboration graph
[legend]

Public Member Functions

angle_t findNextLobe ()
 Calculate the angle (after crank TDC) for the top of the next lobe.
 

Data Fields

uint8_t m_lobe_index = 0
 0-based index of the last lobe returned
 

Detailed Description

Definition at line 27 of file high_pressure_fuel_pump.h.

Member Function Documentation

◆ findNextLobe()

angle_t HpfpLobe::findNextLobe ( )

Calculate the angle (after crank TDC) for the top of the next lobe.

Definition at line 41 of file high_pressure_fuel_pump.cpp.

41 {
42 // TODO: Ideally we figure out where we are in the engine cycle and pick the next lobe
43 // based on that. At least we should do that when cranking, so we can start that much
44 // sooner.
45
47 if (!lobes) {
48 return 0;
49 }
50
51 // Which lobe are we on?
52 int next_index = m_lobe_index + 1;
53 // Note, this will be insufficient if the # of cam lobes is
54 // dynamically changed rapidly by more than 2x, but it will
55 // correct itself rather quickly.
56 if (next_index >= lobes) {
57 next_index -= lobes;
58 }
59 m_lobe_index = next_index;
60
61 // Calculate impact of VVT
62 angle_t vvt = 0;
63 if (engineConfiguration->hpfpCam != HPFP_CAM_NONE) {
64 // pump operates in cam-angle domain which is different speed from crank-angle domain on 4 stroke engines
65 int mult = (int)getEngineCycle(getEngineRotationState()->getOperationMode()) / 360;
66 int camIndex = engineConfiguration->hpfpCam - 1;
67 // TODO: Is the sign correct here? + means ATDC?
69 BANK_BY_INDEX(camIndex),
70 CAM_BY_INDEX(camIndex)) / mult;
71 }
72
73 // heh, looks like we assume 4 stroke here?
74 return engineConfiguration->hpfpPeakPos + vvt + next_index * 720 / lobes;
75}
TriggerCentral triggerCentral
Definition engine.h:318
virtual operation_mode_e getOperationMode() const =0
uint8_t m_lobe_index
0-based index of the last lobe returned
angle_t getVVTPosition(uint8_t bankIndex, uint8_t camIndex)
EngineRotationState * getEngineRotationState()
Definition engine.cpp:573
static EngineAccessor engine
Definition engine.h:413
static constexpr engine_configuration_s * engineConfiguration
float angle_t
angle_t getEngineCycle(operation_mode_e operationMode)

Referenced by HpfpController::scheduleNextCycle().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ m_lobe_index

uint8_t HpfpLobe::m_lobe_index = 0

0-based index of the last lobe returned

Definition at line 29 of file high_pressure_fuel_pump.h.

Referenced by findNextLobe(), and HpfpController::scheduleNextCycle().


The documentation for this class was generated from the following files: