34#if !EFI_SHAFT_POSITION_INPUT
35 fail(
"EFI_SHAFT_POSITION_INPUT required to have EFI_EMULATE_POSITION_SENSORS")
39static constexpr int rpm_spinning_cutoff = 60;
56 if (next_index >= lobes) {
69 BANK_BY_INDEX(camIndex),
70 CAM_BY_INDEX(camIndex)) / mult;
79 float fuel_requested_cc_per_cycle =
92 case engine_load_mode_e::LM_ALPHA_N:
103 (FAST_CALLBACK_PERIOD_MS / 1000.));
115 float pressureError_kPa =
119 float i_factor_divisor =
127 (FAST_CALLBACK_PERIOD_MS /
135 100.f - calc_fuel_percent);
148 return interpolate2d(fuel_requested_percentTotal,
167#if EFI_PROD_CODE && EFI_SHAFT_POSITION_INPUT
171 float deadtime_ms = interpolate2d(
175 m_deadangle = deadtime_ms * rpm * (360.f / 60.f / 1000.f);
188#define HPFP_CONTROLLER "hpfp"
207 action_s::make<pinTurnOff>( self ));
244 action_s::make<pinTurnOn>(
this ));
255 action_s::make<pinTurnOff>(
this ));
TriggerCentral triggerCentral
constexpr auto & module()
RegisteredNamedOutputPin hpfpValve
virtual operation_mode_e getOperationMode() const =0
volatile bool m_running
Whether events are being scheduled or not.
static void pinTurnOff(HpfpController *self)
static void pinTurnOn(HpfpController *self)
void onFastCallback() final
angle_t m_deadangle
Computed solenoid deadtime in degrees.
uint8_t m_lobe_index
0-based index of the last lobe returned
angle_t findNextLobe()
Calculate the angle (after crank TDC) for the top of the next lobe.
float calcPI(float rpm, float calc_fuel_percent, HpfpController *model)
float calcFuelPercent(float rpm)
angle_t pumpAngleFuel(float rpm, HpfpController *model)
virtual void setLow(const char *msg)
virtual void setHigh(const char *msg)
bool isInitialized() const
virtual SensorResult get() const =0
static float getOrZero(SensorType type)
angle_t getVVTPosition(uint8_t bankIndex, uint8_t camIndex)
TriggerWaveform triggerShape
expected< float > getCurrentEnginePhase(efitick_t nowNt) const
TriggerCentral * getTriggerCentral()
EngineRotationState * getEngineRotationState()
static EngineAccessor engine
static constexpr persistent_config_s * config
static constexpr engine_configuration_s * engineConfiguration
constexpr float fuelDensity
fail("EFI_SHAFT_POSITION_INPUT required to have EFI_EMULATE_POSITION_SENSORS") static const expr int rpm_spinning_cutoff
efitick_t scheduleByAngle(scheduling_s *timer, efitick_t nowNt, angle_t angle, action_s const &action)
scheduling_s eventScheduling
engine_load_mode_e fuelAlgorithm
scaled_channel< uint16_t, 100000, 1 > hpfpPidI
scaled_channel< uint16_t, 1000, 1 > hpfpPidP
uint8_t hpfpActivationAngle
scaled_channel< uint16_t, 1000, 1 > hpfpPumpVolume
float injectionMass[MAX_CYLINDER_COUNT]
float hpfp_i_control_percent
float HpfdActivationPhase
float hpfp_p_control_percent
float fuel_requested_percent_pi
float fuel_requested_percent
float HpfdDeactivationPhase
float m_pressureTarget_kPa
scaled_channel< uint8_t, 2, 1 > hpfpLobeProfileQuantityBins[HPFP_LOBE_PROFILE_SIZE]
scaled_channel< uint16_t, 1000, 1 > hpfpCompensationLoadBins[HPFP_COMPENSATION_SIZE]
uint8_t hpfpDeadtimeVoltsBins[HPFP_DEADTIME_SIZE]
scaled_channel< uint8_t, 1, 50 > hpfpTargetRpmBins[HPFP_TARGET_SIZE]
scaled_channel< uint16_t, 1000, 1 > hpfpDeadtimeMS[HPFP_DEADTIME_SIZE]
int8_t hpfpCompensation[HPFP_COMPENSATION_SIZE][HPFP_COMPENSATION_SIZE]
uint16_t hpfpTarget[HPFP_TARGET_SIZE][HPFP_TARGET_SIZE]
scaled_channel< uint8_t, 1, 50 > hpfpCompensationRpmBins[HPFP_COMPENSATION_SIZE]
scaled_channel< uint16_t, 10, 1 > hpfpTargetLoadBins[HPFP_TARGET_SIZE]
scaled_channel< uint8_t, 2, 1 > hpfpLobeProfileAngle[HPFP_LOBE_PROFILE_SIZE]
efitick_t getMomentNt() const
void wrapAngle(angle_t &angle, const char *msg, ObdCode code)
angle_t getEngineCycle(operation_mode_e operationMode)