move a bunch of tables out of engine_configuration_s #371

This commit is contained in:
Matthew Kennedy 2024-03-17 12:06:14 -07:00
parent 85a031c20d
commit 8680b22816
16 changed files with 116 additions and 119 deletions

View File

@ -679,16 +679,16 @@ static const float hardCodedHpfpLobeProfileAngle[16] = {0.0, 7.5, 16.5, 24.0,
}; };
void setBoschHDEV_5_injectors() { void setBoschHDEV_5_injectors() {
copyArray(engineConfiguration->hpfpLobeProfileQuantityBins, hardCodedHpfpLobeProfileQuantityBins); copyArray(config->hpfpLobeProfileQuantityBins, hardCodedHpfpLobeProfileQuantityBins);
copyArray(engineConfiguration->hpfpLobeProfileAngle, hardCodedHpfpLobeProfileAngle); copyArray(config->hpfpLobeProfileAngle, hardCodedHpfpLobeProfileAngle);
setLinearCurve(engineConfiguration->hpfpDeadtimeVoltsBins, 8, 16, 0.5); setLinearCurve(config->hpfpDeadtimeVoltsBins, 8, 16, 0.5);
setLinearCurve(engineConfiguration->hpfpTargetRpmBins, 0, 8000, 1); setLinearCurve(config->hpfpTargetRpmBins, 0, 8000, 1);
setLinearCurve(engineConfiguration->hpfpTargetLoadBins, 0, 180, 1); setLinearCurve(config->hpfpTargetLoadBins, 0, 180, 1);
setTable(engineConfiguration->hpfpTarget, 5000); setTable(config->hpfpTarget, 5000);
setLinearCurve(engineConfiguration->hpfpCompensationRpmBins, 0, 8000, 1); setLinearCurve(config->hpfpCompensationRpmBins, 0, 8000, 1);
setLinearCurve(engineConfiguration->hpfpCompensationLoadBins, 0.005, 0.120, 0.001); setLinearCurve(config->hpfpCompensationLoadBins, 0.005, 0.120, 0.001);
// This is the configuration for bosch HDEV 5 injectors // This is the configuration for bosch HDEV 5 injectors
// all times in microseconds/us // all times in microseconds/us

View File

@ -83,8 +83,8 @@ floatms_t TpsAccelEnrichment::getTpsEnrichment() {
} }
#endif /* EFI_TUNER_STUDIO */ #endif /* EFI_TUNER_STUDIO */
float mult = interpolate2d(rpm, engineConfiguration->tpsTspCorrValuesBins, float mult = interpolate2d(rpm, config->tpsTspCorrValuesBins,
engineConfiguration->tpsTspCorrValues); config->tpsTspCorrValues);
if (mult != 0 && (mult < 0.01 || mult > 100)) { if (mult != 0 && (mult < 0.01 || mult > 100)) {
mult = 1; mult = 1;
} }

View File

@ -43,7 +43,7 @@ void setDefaultBaseEngine() {
engineConfiguration->etbRevLimitRange = 250; engineConfiguration->etbRevLimitRange = 250;
// CLT RPM limit table - just the X axis // CLT RPM limit table - just the X axis
copyArray(engineConfiguration->cltRevLimitRpmBins, { -20, 0, 40, 80 }); copyArray(config->cltRevLimitRpmBins, { -20, 0, 40, 80 });
engineConfiguration->ALSMinRPM = 400; engineConfiguration->ALSMinRPM = 400;
engineConfiguration->ALSMaxRPM = 3200; engineConfiguration->ALSMaxRPM = 3200;

View File

@ -197,30 +197,30 @@ void setDefaultWallWetting() {
#endif // EFI_UNIT_TEST #endif // EFI_UNIT_TEST
// linear reasonable bins // linear reasonable bins
setLinearCurve(engineConfiguration->wwCltBins, -40, 100, 1); setLinearCurve(config->wwCltBins, -40, 100, 1);
setLinearCurve(engineConfiguration->wwMapBins, 10, 80, 1); setLinearCurve(config->wwMapBins, 10, 80, 1);
// These values are derived from the GM factory tune for a gen3 LS engine // These values are derived from the GM factory tune for a gen3 LS engine
// Who knows if they're good for anything else, but at least they look nice? // Who knows if they're good for anything else, but at least they look nice?
static constexpr float tauClt[] = { static constexpr float tauClt[] = {
1.45, 1.30, 1.17, 1.05, 0.90, 0.82, 0.75, 0.70 1.45, 1.30, 1.17, 1.05, 0.90, 0.82, 0.75, 0.70
}; };
copyArray(engineConfiguration->wwTauCltValues, tauClt); copyArray(config->wwTauCltValues, tauClt);
static constexpr float tauMap[] = { static constexpr float tauMap[] = {
0.38, 0.55, 0.69, 0.86, 0.90, 0.95, 0.97, 1.00 0.38, 0.55, 0.69, 0.86, 0.90, 0.95, 0.97, 1.00
}; };
copyArray(engineConfiguration->wwTauMapValues, tauMap); copyArray(config->wwTauMapValues, tauMap);
static constexpr float betaClt[] = { static constexpr float betaClt[] = {
0.73, 0.66, 0.57, 0.46, 0.38, 0.31, 0.24, 0.19 0.73, 0.66, 0.57, 0.46, 0.38, 0.31, 0.24, 0.19
}; };
copyArray(engineConfiguration->wwBetaCltValues, betaClt); copyArray(config->wwBetaCltValues, betaClt);
static constexpr float betaMap[] = { static constexpr float betaMap[] = {
0.21, 0.40, 0.60, 0.79, 0.85, 0.90, 0.95, 1.00 0.21, 0.40, 0.60, 0.79, 0.85, 0.90, 0.95, 1.00
}; };
copyArray(engineConfiguration->wwBetaMapValues, betaMap); copyArray(config->wwBetaMapValues, betaMap);
} }
static void setDefaultLambdaProtection() { static void setDefaultLambdaProtection() {
@ -268,8 +268,8 @@ void setDefaultFuel() {
setFuelTablesLoadBin(10, 160); setFuelTablesLoadBin(10, 160);
setRpmTableBin(config->injPhaseRpmBins); setRpmTableBin(config->injPhaseRpmBins);
setRpmTableBin(engineConfiguration->tpsTspCorrValuesBins); setRpmTableBin(config->tpsTspCorrValuesBins);
setLinearCurve(engineConfiguration->tpsTspCorrValues, 1, 1); setLinearCurve(config->tpsTspCorrValues, 1, 1);
setDefaultVETable(); setDefaultVETable();
setDefaultLambdaTable(); setDefaultLambdaTable();

View File

@ -81,8 +81,8 @@ void setDefaultIgnition() {
// Dwell table // Dwell table
setConstantDwell(4); setConstantDwell(4);
setLinearCurve(engineConfiguration->dwellVoltageCorrVoltBins, 8, 15, 0.1); setLinearCurve(config->dwellVoltageCorrVoltBins, 8, 15, 0.1);
setLinearCurve(engineConfiguration->dwellVoltageCorrValues, 1, 1, 1); setLinearCurve(config->dwellVoltageCorrValues, 1, 1, 1);
// Multispark // Multispark
setDefaultMultisparkParameters(); setDefaultMultisparkParameters();

View File

@ -332,11 +332,11 @@ void setDefaultGppwmParameters() {
} }
static void setDefaultEngineNoiseTable() { static void setDefaultEngineNoiseTable() {
setRpmTableBin(engineConfiguration->knockNoiseRpmBins); setRpmTableBin(config->knockNoiseRpmBins);
engineConfiguration->knockSamplingDuration = 45; engineConfiguration->knockSamplingDuration = 45;
setArrayValues(engineConfiguration->knockBaseNoise, -20); setArrayValues(config->knockBaseNoise, -20);
} }
/** /**

View File

@ -84,8 +84,8 @@ float WallFuelController::computeTau() const {
float tau = interpolate2d( float tau = interpolate2d(
clt, clt,
engineConfiguration->wwCltBins, config->wwCltBins,
engineConfiguration->wwTauCltValues config->wwTauCltValues
); );
// If you have a MAP sensor, apply MAP correction // If you have a MAP sensor, apply MAP correction
@ -94,8 +94,8 @@ float WallFuelController::computeTau() const {
tau *= interpolate2d( tau *= interpolate2d(
map, map,
engineConfiguration->wwMapBins, config->wwMapBins,
engineConfiguration->wwTauMapValues config->wwTauMapValues
); );
} }
@ -113,8 +113,8 @@ float WallFuelController::computeBeta() const {
float beta = interpolate2d( float beta = interpolate2d(
clt, clt,
engineConfiguration->wwCltBins, config->wwCltBins,
engineConfiguration->wwBetaCltValues config->wwBetaCltValues
); );
// If you have a MAP sensor, apply MAP correction // If you have a MAP sensor, apply MAP correction
@ -123,8 +123,8 @@ float WallFuelController::computeBeta() const {
beta *= interpolate2d( beta *= interpolate2d(
map, map,
engineConfiguration->wwMapBins, config->wwMapBins,
engineConfiguration->wwBetaMapValues config->wwBetaMapValues
); );
} }

View File

@ -518,7 +518,7 @@ bool validateConfig() {
ensureArrayIsAscending("TPS/TPS AE from", config->tpsTpsAccelFromRpmBins); ensureArrayIsAscending("TPS/TPS AE from", config->tpsTpsAccelFromRpmBins);
ensureArrayIsAscending("TPS/TPS AE to", config->tpsTpsAccelToRpmBins); ensureArrayIsAscending("TPS/TPS AE to", config->tpsTpsAccelToRpmBins);
ensureArrayIsAscendingOrDefault("TPS TPS RPM correction", engineConfiguration->tpsTspCorrValuesBins); ensureArrayIsAscendingOrDefault("TPS TPS RPM correction", config->tpsTspCorrValuesBins);
ensureArrayIsAscendingOrDefault("Staging Load", config->injectorStagingLoadBins); ensureArrayIsAscendingOrDefault("Staging Load", config->injectorStagingLoadBins);
ensureArrayIsAscendingOrDefault("Staging RPM", config->injectorStagingRpmBins); ensureArrayIsAscendingOrDefault("Staging RPM", config->injectorStagingRpmBins);
@ -592,11 +592,11 @@ bool validateConfig() {
ensureArrayIsAscending("Pedal map RPM", config->pedalToTpsRpmBins); ensureArrayIsAscending("Pedal map RPM", config->pedalToTpsRpmBins);
if (engineConfiguration->hpfpCamLobes > 0) { if (engineConfiguration->hpfpCamLobes > 0) {
ensureArrayIsAscending("HPFP compensation", engineConfiguration->hpfpCompensationRpmBins); ensureArrayIsAscending("HPFP compensation", config->hpfpCompensationRpmBins);
ensureArrayIsAscending("HPFP deadtime", engineConfiguration->hpfpDeadtimeVoltsBins); ensureArrayIsAscending("HPFP deadtime", config->hpfpDeadtimeVoltsBins);
ensureArrayIsAscending("HPFP lobe profile", engineConfiguration->hpfpLobeProfileQuantityBins); ensureArrayIsAscending("HPFP lobe profile", config->hpfpLobeProfileQuantityBins);
ensureArrayIsAscending("HPFP target rpm", engineConfiguration->hpfpTargetRpmBins); ensureArrayIsAscending("HPFP target rpm", config->hpfpTargetRpmBins);
ensureArrayIsAscending("HPFP target load", engineConfiguration->hpfpTargetLoadBins); ensureArrayIsAscending("HPFP target load", config->hpfpTargetLoadBins);
} }
// VVT // VVT

View File

@ -74,18 +74,18 @@ float HpfpQuantity::calcFuelPercent(int rpm) {
float fuel_requested_cc_per_lobe = fuel_requested_cc_per_cycle / engineConfiguration->hpfpCamLobes; float fuel_requested_cc_per_lobe = fuel_requested_cc_per_cycle / engineConfiguration->hpfpCamLobes;
return 100.f * return 100.f *
fuel_requested_cc_per_lobe / engineConfiguration->hpfpPumpVolume + fuel_requested_cc_per_lobe / engineConfiguration->hpfpPumpVolume +
interpolate3d(engineConfiguration->hpfpCompensation, interpolate3d(config->hpfpCompensation,
engineConfiguration->hpfpCompensationLoadBins, fuel_requested_cc_per_lobe, config->hpfpCompensationLoadBins, fuel_requested_cc_per_lobe,
engineConfiguration->hpfpCompensationRpmBins, rpm); config->hpfpCompensationRpmBins, rpm);
} }
float HpfpQuantity::calcPI(int rpm, float calc_fuel_percent) { float HpfpQuantity::calcPI(int rpm, float calc_fuel_percent) {
m_pressureTarget_kPa = std::max<float>( m_pressureTarget_kPa = std::max<float>(
m_pressureTarget_kPa - (engineConfiguration->hpfpTargetDecay * m_pressureTarget_kPa - (engineConfiguration->hpfpTargetDecay *
(FAST_CALLBACK_PERIOD_MS / 1000.)), (FAST_CALLBACK_PERIOD_MS / 1000.)),
interpolate3d(engineConfiguration->hpfpTarget, interpolate3d(config->hpfpTarget,
engineConfiguration->hpfpTargetLoadBins, Sensor::getOrZero(SensorType::Map), // TODO: allow other load axis, like we claim to config->hpfpTargetLoadBins, Sensor::getOrZero(SensorType::Map), // TODO: allow other load axis, like we claim to
engineConfiguration->hpfpTargetRpmBins, rpm)); config->hpfpTargetRpmBins, rpm));
auto fuelPressure = Sensor::get(SensorType::FuelPressureHigh); auto fuelPressure = Sensor::get(SensorType::FuelPressureHigh);
if (!fuelPressure) { if (!fuelPressure) {
@ -125,11 +125,10 @@ angle_t HpfpQuantity::pumpAngleFuel(int rpm, HpfpController *model) {
// Apply PI control // Apply PI control
float fuel_requested_percentTotal = model->fuel_requested_percent + model->fuel_requested_percent_pi; float fuel_requested_percentTotal = model->fuel_requested_percent + model->fuel_requested_percent_pi;
// Convert to degrees // Convert to degrees
return interpolate2d(fuel_requested_percentTotal, return interpolate2d(fuel_requested_percentTotal,
engineConfiguration->hpfpLobeProfileQuantityBins, config->hpfpLobeProfileQuantityBins,
engineConfiguration->hpfpLobeProfileAngle); config->hpfpLobeProfileAngle);
} }
void HpfpController::onFastCallback() { void HpfpController::onFastCallback() {
@ -152,8 +151,8 @@ void HpfpController::onFastCallback() {
// Convert deadtime from ms to degrees based on current RPM // Convert deadtime from ms to degrees based on current RPM
float deadtime_ms = interpolate2d( float deadtime_ms = interpolate2d(
Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE), Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE),
engineConfiguration->hpfpDeadtimeVoltsBins, config->hpfpDeadtimeVoltsBins,
engineConfiguration->hpfpDeadtimeMS); config->hpfpDeadtimeMS);
m_deadtime = deadtime_ms * rpm * (360.f / 60.f / 1000.f); m_deadtime = deadtime_ms * rpm * (360.f / 60.f / 1000.f);
// We set deadtime first, then pump, in case pump used to be 0. Pump is what // We set deadtime first, then pump, in case pump used to be 0. Pump is what

View File

@ -116,8 +116,8 @@ void KnockControllerBase::onFastCallback() {
float KnockController::getKnockThreshold() const { float KnockController::getKnockThreshold() const {
return interpolate2d( return interpolate2d(
Sensor::getOrZero(SensorType::Rpm), Sensor::getOrZero(SensorType::Rpm),
engineConfiguration->knockNoiseRpmBins, config->knockNoiseRpmBins,
engineConfiguration->knockBaseNoise config->knockBaseNoise
); );
} }

View File

@ -64,7 +64,7 @@ void LimpManager::updateState(int rpm, efitick_t nowNt) {
// User-configured hard RPM limit, either constant or CLT-lookup // User-configured hard RPM limit, either constant or CLT-lookup
// todo: migrate to engineState->desiredRpmLimit to get this variable logged // todo: migrate to engineState->desiredRpmLimit to get this variable logged
float revLimit = engineConfiguration->useCltBasedRpmLimit float revLimit = engineConfiguration->useCltBasedRpmLimit
? interpolate2d(Sensor::getOrZero(SensorType::Clt), engineConfiguration->cltRevLimitRpmBins, engineConfiguration->cltRevLimitRpm) ? interpolate2d(Sensor::getOrZero(SensorType::Clt), config->cltRevLimitRpmBins, config->cltRevLimitRpm)
: (float)engineConfiguration->rpmHardLimit; : (float)engineConfiguration->rpmHardLimit;
// Configurable hysteresis for how far to drop before resuming // Configurable hysteresis for how far to drop before resuming

View File

@ -85,8 +85,8 @@ floatms_t IgnitionState::getSparkDwell(int rpm) {
baseDwell = interpolate2d(rpm, config->sparkDwellRpmBins, config->sparkDwellValues); baseDwell = interpolate2d(rpm, config->sparkDwellRpmBins, config->sparkDwellValues);
dwellVoltageCorrection = interpolate2d( dwellVoltageCorrection = interpolate2d(
Sensor::getOrZero(SensorType::BatteryVoltage), Sensor::getOrZero(SensorType::BatteryVoltage),
engineConfiguration->dwellVoltageCorrVoltBins, config->dwellVoltageCorrVoltBins,
engineConfiguration->dwellVoltageCorrValues config->dwellVoltageCorrValues
); );
// for compat (table full of zeroes) // for compat (table full of zeroes)

View File

@ -9,14 +9,14 @@ static FunctionalSensor fuelSensor(SensorType::FuelLevel, /* timeout = */ MS2NT(
#if !EFI_UNIT_TEST #if !EFI_UNIT_TEST
// extract the type of the elements in the bin/value arrays // extract the type of the elements in the bin/value arrays
using BinType = std::remove_extent_t<decltype(engineConfiguration->fuelLevelBins)>; using BinType = std::remove_extent_t<decltype(config->fuelLevelBins)>;
using ValueType = std::remove_extent_t<decltype(engineConfiguration->fuelLevelValues)>; using ValueType = std::remove_extent_t<decltype(config->fuelLevelValues)>;
static TableFunc static TableFunc
<BinType, ValueType, FUEL_LEVEL_TABLE_COUNT, <BinType, ValueType, FUEL_LEVEL_TABLE_COUNT,
// Values are stored in percent // Values are stored in percent
efi::ratio<1>> efi::ratio<1>>
fuelCurve(engineConfiguration->fuelLevelBins, engineConfiguration->fuelLevelValues); fuelCurve(config->fuelLevelBins, config->fuelLevelValues);
void initFuelLevel() { void initFuelLevel() {
adc_channel_e channel = engineConfiguration->fuelLevelSensor; adc_channel_e channel = engineConfiguration->fuelLevelSensor;

View File

@ -385,8 +385,6 @@ uint16_t engineSnifferRpmThreshold;Engine sniffer would be disabled above this r
uint8_t maxAcTps;Above this TPS, disable AC. Set to 0 to disable check.;"%", 1, 0, 0, 100, 0 uint8_t maxAcTps;Above this TPS, disable AC. Set to 0 to disable check.;"%", 1, 0, 0, 100, 0
uint8_t maxAcClt;Above this CLT, disable AC to prevent overheating the engine. Set to 0 to disable check.;"deg C", 1, 0, 0, 150, 0 uint8_t maxAcClt;Above this CLT, disable AC to prevent overheating the engine. Set to 0 to disable check.;"deg C", 1, 0, 0, 150, 0
uint16_t[ENGINE_NOISE_CURVE_SIZE] knockNoiseRpmBins;;"RPM", 1, 0, 0, 30000, 0
uint8_t multisparkMaxSparkingAngle;This parameter sets the latest that the last multispark can occur after the main ignition event. For example, if the ignition timing is 30 degrees BTDC, and this parameter is set to 45, no multispark will ever be fired after 15 degrees ATDC.;"deg", 1, 0, 0, 60, 0 uint8_t multisparkMaxSparkingAngle;This parameter sets the latest that the last multispark can occur after the main ignition event. For example, if the ignition timing is 30 degrees BTDC, and this parameter is set to 45, no multispark will ever be fired after 15 degrees ATDC.;"deg", 1, 0, 0, 60, 0
uint8_t multisparkMaxExtraSparkCount;Configures the maximum number of extra sparks to fire (does not include main spark);"count", 1, 0, 1, 5, 0 uint8_t multisparkMaxExtraSparkCount;Configures the maximum number of extra sparks to fire (does not include main spark);"count", 1, 0, 1, 5, 0
@ -654,8 +652,6 @@ switch_input_pin_e clutchDownPin;Some cars have a switch to indicate that clutch
adc_channel_e tps1_2AdcChannel;First throttle body, second sensor. adc_channel_e tps1_2AdcChannel;First throttle body, second sensor.
adc_channel_e tps2_2AdcChannel;Second throttle body, second sensor. adc_channel_e tps2_2AdcChannel;Second throttle body, second sensor.
uint8_t[FUEL_LEVEL_TABLE_COUNT] fuelLevelValues;;"%", 1, 0, 0, 100, 0
float idle_antiwindupFreq;0.1 is a good default value;"x", 1, 0, -1000000, 1000000, 4 float idle_antiwindupFreq;0.1 is a good default value;"x", 1, 0, -1000000, 1000000, 4
brain_input_pin_e[TRIGGER_INPUT_PIN_COUNT iterate] triggerInputPins; brain_input_pin_e[TRIGGER_INPUT_PIN_COUNT iterate] triggerInputPins;
@ -735,10 +731,6 @@ output_pin_e acFanPin;Optional Radiator Fan used with A/C
spi_device_e l9779spiDevice; spi_device_e l9779spiDevice;
uint8_t[DWELL_CURVE_SIZE] autoscale dwellVoltageCorrVoltBins;;"volts", 0.1, 0, 0, 20, 1
uint8_t[DWELL_CURVE_SIZE] autoscale dwellVoltageCorrValues;;"multiplier", 0.02, 0, 0, 5, 2
uint16_t vehicleWeight;;"kg", 1, 0, 0, 10000, 0 uint16_t vehicleWeight;;"kg", 1, 0, 0, 10000, 0
int16_t idlePidRpmUpperLimit;How far above idle speed do we consider idling?\nFor example, if target = 800, this param = 200, then anything below 1000 RPM is considered idle.;"RPM", 1, 0, 0, 500, 0 int16_t idlePidRpmUpperLimit;How far above idle speed do we consider idling?\nFor example, if target = 800, this param = 200, then anything below 1000 RPM is considered idle.;"RPM", 1, 0, 0, 500, 0
@ -918,8 +910,6 @@ custom idle_mode_e 1 bits, U08, @OFFSET@, [0:0], "Open Loop + Closed Loop", "Ope
Gpio drv8860_miso; Gpio drv8860_miso;
uint16_t[FUEL_LEVEL_TABLE_COUNT] autoscale fuelLevelBins;;"volt", {1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
output_pin_e[LUA_PWM_COUNT iterate] luaOutputPins output_pin_e[LUA_PWM_COUNT iterate] luaOutputPins
int16_t[CAM_INPUTS_COUNT iterate] autoscale vvtOffsets;Angle between cam sensor and VVT zero position;"value", 0.1, 0, -720, 1000, 1 int16_t[CAM_INPUTS_COUNT iterate] autoscale vvtOffsets;Angle between cam sensor and VVT zero position;"value", 0.1, 0, -720, 1000, 1
@ -1272,9 +1262,6 @@ tChargeMode_e tChargeMode;
linear_sensor_s highPressureFuel; linear_sensor_s highPressureFuel;
linear_sensor_s lowPressureFuel; linear_sensor_s lowPressureFuel;
int8_t[CLT_LIMITER_CURVE_SIZE] cltRevLimitRpmBins;;"C", 1, 0, -40, 120, 0
uint16_t[CLT_LIMITER_CURVE_SIZE] cltRevLimitRpm;;"RPM", 1, 0, 0, 20000, 0
gppwm_note_t[SCRIPT_CURVE_COUNT iterate] scriptCurveName; gppwm_note_t[SCRIPT_CURVE_COUNT iterate] scriptCurveName;
gppwm_note_t[SCRIPT_TABLE_COUNT iterate] scriptTableName; gppwm_note_t[SCRIPT_TABLE_COUNT iterate] scriptTableName;
@ -1331,8 +1318,6 @@ float tChargeAirDecrLimit;Maximum allowed rate of decrease allowed for the estim
pin_output_mode_e[TCU_SOLENOID_COUNT iterate] tcu_solenoid_mode; pin_output_mode_e[TCU_SOLENOID_COUNT iterate] tcu_solenoid_mode;
int8_t[ENGINE_NOISE_CURVE_SIZE] autoscale knockBaseNoise;Knock sensor output knock detection threshold depending on current RPM.;"dB", 0.5, 0, -50, 10, 1
uint16_t[GAP_TRACKING_LENGTH iterate] autoscale triggerGapOverrideFrom;;"ratio", 0.001, 0, 0, 20, 3 uint16_t[GAP_TRACKING_LENGTH iterate] autoscale triggerGapOverrideFrom;;"ratio", 0.001, 0, 0, 20, 3
uint16_t[GAP_TRACKING_LENGTH iterate] autoscale triggerGapOverrideTo;;"ratio", 0.001, 0, 0, 20, 3 uint16_t[GAP_TRACKING_LENGTH iterate] autoscale triggerGapOverrideTo;;"ratio", 0.001, 0, 0, 20, 3
@ -1345,8 +1330,6 @@ float tChargeAirDecrLimit;Maximum allowed rate of decrease allowed for the estim
uint16_t autoscale fordInjectorSmallPulseBreakPoint;;"mg", 0.001, 0, 0, 65, 3 uint16_t autoscale fordInjectorSmallPulseBreakPoint;;"mg", 0.001, 0, 0, 65, 3
uint8_t[TPS_TPS_ACCEL_CLT_CORR_TABLE] autoscale tpsTspCorrValues;;"multiplier", 0.02, 0, 0, 5, 2
uint8_t etbJamIntegratorLimit;;"%", 1, 0, 0, 50, 0 uint8_t etbJamIntegratorLimit;;"%", 1, 0, 0, 50, 0
! Someday there will be a 6th option for BMW S55 that uses a separate shaft just for HPFP ! Someday there will be a 6th option for BMW S55 that uses a separate shaft just for HPFP
@ -1372,16 +1355,6 @@ float tChargeAirDecrLimit;Maximum allowed rate of decrease allowed for the estim
uint16_t autoscale hpfpPidP;;"%/kPa", 0.001, 0, 0, 65, 3 uint16_t autoscale hpfpPidP;;"%/kPa", 0.001, 0, 0, 65, 3
uint16_t autoscale hpfpPidI;;"%/kPa/lobe", 0.00001, 0, 0, 0.65, 5 uint16_t autoscale hpfpPidI;;"%/kPa/lobe", 0.00001, 0, 0, 0.65, 5
uint16_t hpfpTargetDecay;The fastest rate the target pressure can be reduced by. This is because HPFP have no way to bleed off pressure other than injecting fuel.;"kPa/s", 1, 0, 0, 65000, 0 uint16_t hpfpTargetDecay;The fastest rate the target pressure can be reduced by. This is because HPFP have no way to bleed off pressure other than injecting fuel.;"kPa/s", 1, 0, 0, 65000, 0
uint8_t[HPFP_LOBE_PROFILE_SIZE] autoscale hpfpLobeProfileQuantityBins;;"%", 0.5, 0, 0, 100, 1
uint8_t[HPFP_LOBE_PROFILE_SIZE] autoscale hpfpLobeProfileAngle;;"deg", 0.5, 0, 0, 125, 1
uint8_t[HPFP_DEADTIME_SIZE] hpfpDeadtimeVoltsBins;;"volts", 1, 0, 0, 255, 0
uint16_t[HPFP_DEADTIME_SIZE] autoscale hpfpDeadtimeMS;;"ms", 0.001, 0, 0, 65, 3
uint16_t[HPFP_TARGET_SIZE x HPFP_TARGET_SIZE] hpfpTarget;;"kPa", 1, 0, 0, 65000, 0
uint16_t[HPFP_TARGET_SIZE] autoscale hpfpTargetLoadBins;;"load", 0.1, 0, 0, 6500, 1
uint8_t[HPFP_TARGET_SIZE] autoscale hpfpTargetRpmBins;;"RPM", 50, 0, 0, 12500, 0
int8_t[HPFP_COMPENSATION_SIZE x HPFP_COMPENSATION_SIZE] hpfpCompensation;;"%", 1, 0, -100, 100, 0
uint16_t[HPFP_COMPENSATION_SIZE] autoscale hpfpCompensationLoadBins;;"cc/lobe", 0.001, 0, 0, 65, 3
uint8_t[HPFP_COMPENSATION_SIZE] autoscale hpfpCompensationRpmBins;;"RPM", 50, 0, 0, 12500, 0
output_pin_e[4 iterate] stepper_raw_output; output_pin_e[4 iterate] stepper_raw_output;
@ -1390,16 +1363,6 @@ float tChargeAirDecrLimit;Maximum allowed rate of decrease allowed for the estim
uint16_t vvtActivationDelayMs;We need to give engine time to build oil pressure without diverting it to VVT;"ms", 1, 0, 0, 65000, 0 uint16_t vvtActivationDelayMs;We need to give engine time to build oil pressure without diverting it to VVT;"ms", 1, 0, 0, 65000, 0
#define WWAE_TABLE_SIZE 8
int8_t[WWAE_TABLE_SIZE] wwCltBins;;"deg C", 1, 0, -40, 120, 0
uint8_t[WWAE_TABLE_SIZE] autoscale wwTauCltValues;;"", 0.01, 0, 0, 2.5, 2
uint8_t[WWAE_TABLE_SIZE] autoscale wwBetaCltValues;;"", 0.01, 0, 0, 1, 2
int8_t[WWAE_TABLE_SIZE] wwMapBins;;"kPa", 1, 0, 0, 250, 0
uint8_t[WWAE_TABLE_SIZE] autoscale wwTauMapValues;;"", 0.01, 0, 0, 2.5, 2
uint8_t[WWAE_TABLE_SIZE] autoscale wwBetaMapValues;;"", 0.01, 0, 0, 2.5, 2
#define gear_controller_e_enum "None", "Button Shift" #define gear_controller_e_enum "None", "Button Shift"
custom GearControllerMode 1 bits, U08, @OFFSET@, [0:1], @@gear_controller_e_enum@@ custom GearControllerMode 1 bits, U08, @OFFSET@, [0:1], @@gear_controller_e_enum@@
GearControllerMode gearControllerMode GearControllerMode gearControllerMode
@ -1438,7 +1401,6 @@ custom fuel_pressure_sensor_mode_e 1 bits, U08, @OFFSET@, [0:1], @@fuel_pressure
fuel_pressure_sensor_mode_e fuelPressureSensorMode fuel_pressure_sensor_mode_e fuelPressureSensorMode
switch_input_pin_e[LUA_DIGITAL_INPUT_COUNT iterate] luaDigitalInputPins; switch_input_pin_e[LUA_DIGITAL_INPUT_COUNT iterate] luaDigitalInputPins;
uint8_t[TPS_TPS_ACCEL_CLT_CORR_TABLE] autoscale tpsTspCorrValuesBins;;"RPM", 50, 0, 0, 17500, 0
int16_t ALSMinRPM;;"rpm", 1, 0, 0, 20000, 0 int16_t ALSMinRPM;;"rpm", 1, 0, 0, 20000, 0
int16_t ALSMaxRPM;;"rpm", 1, 0, 0, 20000, 0 int16_t ALSMaxRPM;;"rpm", 1, 0, 0, 20000, 0
int16_t ALSMaxDuration;;"sec", 1, 0, 0, 10, 0 int16_t ALSMaxDuration;;"sec", 1, 0, 0, 10, 0
@ -1741,6 +1703,42 @@ uint8_t[6 x 6] injectorStagingTable;;"%", 1, 0, 0, 90, 0
uint16_t[6] injectorStagingLoadBins;;"", 1, 0, 0, 1000, 0 uint16_t[6] injectorStagingLoadBins;;"", 1, 0, 0, 1000, 0
uint16_t[6] injectorStagingRpmBins;;"RPM", 1, 0, 0, 18000, 0 uint16_t[6] injectorStagingRpmBins;;"RPM", 1, 0, 0, 18000, 0
#define WWAE_TABLE_SIZE 8
int8_t[WWAE_TABLE_SIZE] wwCltBins;;"deg C", 1, 0, -40, 120, 0
uint8_t[WWAE_TABLE_SIZE] autoscale wwTauCltValues;;"", 0.01, 0, 0, 2.5, 2
uint8_t[WWAE_TABLE_SIZE] autoscale wwBetaCltValues;;"", 0.01, 0, 0, 1, 2
int8_t[WWAE_TABLE_SIZE] wwMapBins;;"kPa", 1, 0, 0, 250, 0
uint8_t[WWAE_TABLE_SIZE] autoscale wwTauMapValues;;"", 0.01, 0, 0, 2.5, 2
uint8_t[WWAE_TABLE_SIZE] autoscale wwBetaMapValues;;"", 0.01, 0, 0, 2.5, 2
uint8_t[HPFP_LOBE_PROFILE_SIZE] autoscale hpfpLobeProfileQuantityBins;;"%", 0.5, 0, 0, 100, 1
uint8_t[HPFP_LOBE_PROFILE_SIZE] autoscale hpfpLobeProfileAngle;;"deg", 0.5, 0, 0, 125, 1
uint8_t[HPFP_DEADTIME_SIZE] hpfpDeadtimeVoltsBins;;"volts", 1, 0, 0, 255, 0
uint16_t[HPFP_DEADTIME_SIZE] autoscale hpfpDeadtimeMS;;"ms", 0.001, 0, 0, 65, 3
uint16_t[HPFP_TARGET_SIZE x HPFP_TARGET_SIZE] hpfpTarget;;"kPa", 1, 0, 0, 65000, 0
uint16_t[HPFP_TARGET_SIZE] autoscale hpfpTargetLoadBins;;"load", 0.1, 0, 0, 6500, 1
uint8_t[HPFP_TARGET_SIZE] autoscale hpfpTargetRpmBins;;"RPM", 50, 0, 0, 12500, 0
int8_t[HPFP_COMPENSATION_SIZE x HPFP_COMPENSATION_SIZE] hpfpCompensation;;"%", 1, 0, -100, 100, 0
uint16_t[HPFP_COMPENSATION_SIZE] autoscale hpfpCompensationLoadBins;;"cc/lobe", 0.001, 0, 0, 65, 3
uint8_t[HPFP_COMPENSATION_SIZE] autoscale hpfpCompensationRpmBins;;"RPM", 50, 0, 0, 12500, 0
uint16_t[ENGINE_NOISE_CURVE_SIZE] knockNoiseRpmBins;;"RPM", 1, 0, 0, 30000, 0
int8_t[ENGINE_NOISE_CURVE_SIZE] autoscale knockBaseNoise;Knock sensor output knock detection threshold depending on current RPM.;"dB", 0.5, 0, -50, 10, 1
uint8_t[TPS_TPS_ACCEL_CLT_CORR_TABLE] autoscale tpsTspCorrValuesBins;;"RPM", 50, 0, 0, 17500, 0
uint8_t[TPS_TPS_ACCEL_CLT_CORR_TABLE] autoscale tpsTspCorrValues;;"multiplier", 0.02, 0, 0, 5, 2
int8_t[CLT_LIMITER_CURVE_SIZE] cltRevLimitRpmBins;;"C", 1, 0, -40, 120, 0
uint16_t[CLT_LIMITER_CURVE_SIZE] cltRevLimitRpm;;"RPM", 1, 0, 0, 20000, 0
uint16_t[FUEL_LEVEL_TABLE_COUNT] autoscale fuelLevelBins;;"volt", {1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
uint8_t[FUEL_LEVEL_TABLE_COUNT] fuelLevelValues;;"%", 1, 0, 0, 100, 0
uint8_t[DWELL_CURVE_SIZE] autoscale dwellVoltageCorrVoltBins;;"volts", 0.1, 0, 0, 20, 1
uint8_t[DWELL_CURVE_SIZE] autoscale dwellVoltageCorrValues;;"multiplier", 0.02, 0, 0, 5, 2
end_struct end_struct
! Pedal Position Sensor ! Pedal Position Sensor

View File

@ -79,19 +79,19 @@ TEST(HPFP, InjectionReplacementFuel) {
engineConfiguration->hpfpCamLobes; // Make math easier engineConfiguration->hpfpCamLobes; // Make math easier
for (int i = 0; i < HPFP_COMPENSATION_SIZE; i++) { for (int i = 0; i < HPFP_COMPENSATION_SIZE; i++) {
// one bin every 1000 RPM // one bin every 1000 RPM
engineConfiguration->hpfpCompensationRpmBins[i] = std::min(i * 1000, 8000); config->hpfpCompensationRpmBins[i] = std::min(i * 1000, 8000);
} }
for (int i = 0; i < HPFP_COMPENSATION_SIZE; i++) { for (int i = 0; i < HPFP_COMPENSATION_SIZE; i++) {
// one bin every 0.05 cc/lobe // one bin every 0.05 cc/lobe
engineConfiguration->hpfpCompensationLoadBins[i] = std::min(i * 0.05, 60.); config->hpfpCompensationLoadBins[i] = std::min(i * 0.05, 60.);
} }
engineConfiguration->hpfpCompensation[2][1] = -10; config->hpfpCompensation[2][1] = -10;
EXPECT_FLOAT_EQ(math.calcFuelPercent(1000), 40); // -10, in cell EXPECT_FLOAT_EQ(math.calcFuelPercent(1000), 40); // -10, in cell
EXPECT_FLOAT_EQ(math.calcFuelPercent(1500), 45); // -5, half way EXPECT_FLOAT_EQ(math.calcFuelPercent(1500), 45); // -5, half way
EXPECT_FLOAT_EQ(math.calcFuelPercent(2000), 50); // -0, in next cell EXPECT_FLOAT_EQ(math.calcFuelPercent(2000), 50); // -0, in next cell
engineConfiguration->hpfpCompensation[2][1] = 20; config->hpfpCompensation[2][1] = 20;
EXPECT_FLOAT_EQ(math.calcFuelPercent(1000), 70); // +20, in cell EXPECT_FLOAT_EQ(math.calcFuelPercent(1000), 70); // +20, in cell
EXPECT_FLOAT_EQ(math.calcFuelPercent(1500), 60); // +10, half way EXPECT_FLOAT_EQ(math.calcFuelPercent(1500), 60); // +10, half way
EXPECT_FLOAT_EQ(math.calcFuelPercent(2000), 50); // +0, in next cell EXPECT_FLOAT_EQ(math.calcFuelPercent(2000), 50); // +0, in next cell
@ -115,15 +115,15 @@ TEST(HPFP, PI) {
for (int i = 0; i < HPFP_TARGET_SIZE; i++) { for (int i = 0; i < HPFP_TARGET_SIZE; i++) {
// one bin every 1000 RPM // one bin every 1000 RPM
engineConfiguration->hpfpTargetRpmBins[i] = std::min(i * 1000, 8000); config->hpfpTargetRpmBins[i] = std::min(i * 1000, 8000);
} }
for (int i = 0; i < HPFP_TARGET_SIZE; i++) { for (int i = 0; i < HPFP_TARGET_SIZE; i++) {
// one bin every 20kPa // one bin every 20kPa
engineConfiguration->hpfpTargetLoadBins[i] = std::min(i * 20, 200); config->hpfpTargetLoadBins[i] = std::min(i * 20, 200);
} }
for (int r = 0; r < HPFP_TARGET_SIZE; r++) { for (int r = 0; r < HPFP_TARGET_SIZE; r++) {
for (int c = 0; c < HPFP_TARGET_SIZE; c++) { for (int c = 0; c < HPFP_TARGET_SIZE; c++) {
engineConfiguration->hpfpTarget[r][c] = 1000 * r + 10 * c; config->hpfpTarget[r][c] = 1000 * r + 10 * c;
} }
} }
@ -172,20 +172,20 @@ TEST(HPFP, Angle) {
for (int i = 0; i < HPFP_TARGET_SIZE; i++) { for (int i = 0; i < HPFP_TARGET_SIZE; i++) {
// one bin every 1000 RPM // one bin every 1000 RPM
engineConfiguration->hpfpTargetRpmBins[i] = std::min(i * 1000, 8000); config->hpfpTargetRpmBins[i] = std::min(i * 1000, 8000);
} }
for (int i = 0; i < HPFP_TARGET_SIZE; i++) { for (int i = 0; i < HPFP_TARGET_SIZE; i++) {
// one bin every 20kPa // one bin every 20kPa
engineConfiguration->hpfpTargetLoadBins[i] = std::min(i * 20, 200); config->hpfpTargetLoadBins[i] = std::min(i * 20, 200);
} }
for (int r = 0; r < HPFP_TARGET_SIZE; r++) { for (int r = 0; r < HPFP_TARGET_SIZE; r++) {
for (int c = 0; c < HPFP_TARGET_SIZE; c++) { for (int c = 0; c < HPFP_TARGET_SIZE; c++) {
engineConfiguration->hpfpTarget[r][c] = 1000 * r + 10 * c; config->hpfpTarget[r][c] = 1000 * r + 10 * c;
} }
} }
for (int i = 0; i < HPFP_LOBE_PROFILE_SIZE; i++) { for (int i = 0; i < HPFP_LOBE_PROFILE_SIZE; i++) {
engineConfiguration->hpfpLobeProfileQuantityBins[i] = 100. * i / (HPFP_LOBE_PROFILE_SIZE - 1); config->hpfpLobeProfileQuantityBins[i] = 100. * i / (HPFP_LOBE_PROFILE_SIZE - 1);
engineConfiguration->hpfpLobeProfileAngle[i] = 150. * i / (HPFP_LOBE_PROFILE_SIZE - 1); config->hpfpLobeProfileAngle[i] = 150. * i / (HPFP_LOBE_PROFILE_SIZE - 1);
} }
HpfpController model; HpfpController model;
@ -217,20 +217,20 @@ TEST(HPFP, Schedule) {
for (int i = 0; i < HPFP_TARGET_SIZE; i++) { for (int i = 0; i < HPFP_TARGET_SIZE; i++) {
// one bin every 1000 RPM // one bin every 1000 RPM
engineConfiguration->hpfpTargetRpmBins[i] = std::min(i * 1000, 8000); config->hpfpTargetRpmBins[i] = std::min(i * 1000, 8000);
} }
for (int i = 0; i < HPFP_TARGET_SIZE; i++) { for (int i = 0; i < HPFP_TARGET_SIZE; i++) {
// one bin every 20kPa // one bin every 20kPa
engineConfiguration->hpfpTargetLoadBins[i] = std::min(i * 20, 200); config->hpfpTargetLoadBins[i] = std::min(i * 20, 200);
} }
for (int r = 0; r < HPFP_TARGET_SIZE; r++) { for (int r = 0; r < HPFP_TARGET_SIZE; r++) {
for (int c = 0; c < HPFP_TARGET_SIZE; c++) { for (int c = 0; c < HPFP_TARGET_SIZE; c++) {
engineConfiguration->hpfpTarget[r][c] = 1000 * r + 10 * c; config->hpfpTarget[r][c] = 1000 * r + 10 * c;
} }
} }
for (int i = 0; i < HPFP_LOBE_PROFILE_SIZE; i++) { for (int i = 0; i < HPFP_LOBE_PROFILE_SIZE; i++) {
engineConfiguration->hpfpLobeProfileQuantityBins[i] = 100. * i / (HPFP_LOBE_PROFILE_SIZE - 1); config->hpfpLobeProfileQuantityBins[i] = 100. * i / (HPFP_LOBE_PROFILE_SIZE - 1);
engineConfiguration->hpfpLobeProfileAngle[i] = 150. * i / (HPFP_LOBE_PROFILE_SIZE - 1); config->hpfpLobeProfileAngle[i] = 150. * i / (HPFP_LOBE_PROFILE_SIZE - 1);
} }
auto & hpfp = *engine->module<HpfpController>(); auto & hpfp = *engine->module<HpfpController>();

View File

@ -54,8 +54,8 @@ TEST(limp, revLimitCltBased) {
// Configure CLT-based rev limit curve // Configure CLT-based rev limit curve
engineConfiguration->useCltBasedRpmLimit = true; engineConfiguration->useCltBasedRpmLimit = true;
copyArray(engineConfiguration->cltRevLimitRpmBins, { 10, 20, 30, 40 }); copyArray(config->cltRevLimitRpmBins, { 10, 20, 30, 40 });
copyArray(engineConfiguration->cltRevLimitRpm, { 1000, 2000, 3000, 4000 }); copyArray(config->cltRevLimitRpm, { 1000, 2000, 3000, 4000 });
LimpManager dut; LimpManager dut;