move a bunch of tables out of engine_configuration_s

This commit is contained in:
Matthew Kennedy 2024-03-17 15:06:14 -04:00 committed by rusefillc
parent 5b187f9f5e
commit b7b7c77ce0
12 changed files with 85 additions and 62 deletions

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

@ -124,7 +124,7 @@ void setDefaultBaseEngine() {
engineConfiguration->rpmSoftLimitTimingRetard = 4; engineConfiguration->rpmSoftLimitTimingRetard = 4;
// 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

@ -225,30 +225,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() {
@ -296,8 +296,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

@ -82,8 +82,8 @@ void setDefaultIgnition() {
// Dwell table - a bit conservative but reasonable // Dwell table - a bit conservative but reasonable
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

@ -362,11 +362,11 @@ static void setDefaultGppwmParameters() {
#if EFI_ENGINE_CONTROL #if EFI_ENGINE_CONTROL
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);
} }
#endif // EFI_ENGINE_CONTROL #endif // EFI_ENGINE_CONTROL

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

@ -119,8 +119,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

@ -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

@ -419,8 +419,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
! unused 2 bytes here ! unused 2 bytes here
@ -799,13 +797,10 @@ 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
custom imu_type_e 1 bits, U08, @OFFSET@, [0:4], "None", "VAG", "MM5.10", "type 3", "type 4" custom imu_type_e 1 bits, U08, @OFFSET@, [0:4], "None", "VAG", "MM5.10", "type 3", "type 4"
imu_type_e imuType imu_type_e imuType
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, i.e. coasting detection threshold.\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, i.e. coasting detection threshold.\nFor example, if target = 800, this param = 200, then anything below 1000 RPM is considered idle.;"RPM", 1, 0, 0, 500, 0
@ -987,8 +982,6 @@ bit verboseCan2,"Print all","Do not print";Print incoming and outgoing second bu
pin_output_mode_e drv8860_csPinMode; pin_output_mode_e drv8860_csPinMode;
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
float[CAM_INPUTS_COUNT iterate] vvtOffsets;Angle between cam sensor and VVT zero position\nset vvt_offset X;"value", 1, 0, -720, 1000, 1 float[CAM_INPUTS_COUNT iterate] vvtOffsets;Angle between cam sensor and VVT zero position\nset vvt_offset X;"value", 1, 0, -720, 1000, 1
@ -1383,9 +1376,6 @@ custom stepper_num_micro_steps_e 1 bits, U08, @OFFSET@, [0:3], @@stepper_num_mic
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;
@ -1475,8 +1465,6 @@ uint8_t[TRACTION_CONTROL_ETB_DROP_SIZE] tractionControlSpeedBins;;"RPM", 1, 0, 0
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
@ -1574,7 +1562,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
@ -1947,6 +1934,42 @@ uint8_t[INJ_STAGING_COUNT x INJ_STAGING_COUNT] injectorStagingTable;;"%", 1, 0,
uint16_t[INJ_STAGING_COUNT] injectorStagingLoadBins;;"", 1, 0, 0, 1000, 0 uint16_t[INJ_STAGING_COUNT] injectorStagingLoadBins;;"", 1, 0, 0, 1000, 0
uint16_t[INJ_STAGING_COUNT] injectorStagingRpmBins;;"RPM", 1, 0, 0, 18000, 0 uint16_t[INJ_STAGING_COUNT] 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
#define CMD_SET_SENSOR_MOCK "set_sensor_mock" #define CMD_SET_SENSOR_MOCK "set_sensor_mock"

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
@ -120,15 +120,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;
} }
} }
@ -182,20 +182,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;
@ -225,20 +225,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

@ -55,8 +55,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;