Implement target AFR blend #7123

This commit is contained in:
kifir 2024-12-12 09:42:29 +02:00 committed by rusefillc
parent a84382e03b
commit 061e075874
5 changed files with 50 additions and 1 deletions

View File

@ -327,6 +327,10 @@ int16_t rpmAcceleration;dRPM;"RPM acceleration/Rate of Change/ROC",1, 0, 0, 5, 2
uint8_t[BOOST_BLEND_COUNT iterate] autoscale boostClosedLoopBlendBias;;"%", 0.5, 0, 0, 100, 1
int16_t[BOOST_BLEND_COUNT iterate] autoscale boostClosedLoopBlendOutput;;"%", 0.1, 0, -1000, 1000, 1
int16_t[TARGET_AFR_BLEND_COUNT iterate] autoscale targetAfrBlendParameter;;"", 0.1, 0, -1000, 1000, 1
uint8_t[TARGET_AFR_BLEND_COUNT iterate] autoscale targetAfrBlendBias;;"%", 0.5, 0, 0, 100, 1
int16_t[TARGET_AFR_BLEND_COUNT iterate] autoscale targetAfrBlendOutput;;"%", 0.1, 0, -1000, 1000, 1
bit coilState1
bit coilState2
bit coilState3

View File

@ -58,11 +58,24 @@ float FuelComputer::getStoichiometricRatio() const {
float FuelComputer::getTargetLambda(float rpm, float load) const {
return interpolate3d(
float target = interpolate3d(
config->lambdaTable,
config->lambdaLoadBins, load,
config->lambdaRpmBins, rpm
);
// Add any blends if configured
for (size_t i = 0; i < efi::size(config->targetAfrBlends); i++) {
auto result = calculateBlend(config->targetAfrBlends[i], rpm, load);
engine->outputChannels.targetAfrBlendParameter[i] = result.BlendParameter;
engine->outputChannels.targetAfrBlendBias[i] = result.Bias;
engine->outputChannels.targetAfrBlendOutput[i] = result.Value;
target += result.Value;
}
return target;
}
float FuelComputer::getTargetLambdaLoadAxis(float defaultLoad) const {

View File

@ -2157,6 +2157,8 @@ float[BOOST_CURVE_SIZE] iatBoostAdder;;"", 1, 0, 0, 5, 2
uint8_t[8] autoscale minimumOilPressureBins;;"RPM", 100, 0, 0, 25000, 0
uint8_t[8] autoscale minimumOilPressureValues;;"kPa", 10, 0, 0, 1000, 0
blend_table_s[TARGET_AFR_BLEND_COUNT iterate] targetAfrBlends
@@BOARD_CONFIG_FROM_FILE@@
end_struct

View File

@ -38,6 +38,7 @@
#define IGN_BLEND_COUNT 4
#define VE_BLEND_COUNT 4
#define BOOST_BLEND_COUNT 2
#define TARGET_AFR_BLEND_COUNT 1
#define LUA_GAUGE_COUNT 8

View File

@ -962,6 +962,12 @@ curve = rangeMatrix, "Range Switch Input Matrix"
yBins = minimumOilPressureValues
gauge = OilPressGauge
curve = targetAfrBlend1Bias, "Target AFR blend 1 bias"
columnLabel = "param", "bias"
xAxis = 0, 100, 11
yAxis = 0, 100, 5
xBins = targetAfrBlends1_blendBins, targetAfrBlendParameter1
yBins = targetAfrBlends1_blendValues
[TableEditor]
; table_id, map3d_id, "title", page
@ -1156,6 +1162,13 @@ curve = rangeMatrix, "Range Switch Input Matrix"
zBins = boostClosedLoopBlends2_table
gridOrient = 250, 0, 340
table = targetAfrBlend1Table, targetAfrBlend1Map, "Target AFR blend 1", 1
xyLabels = "RPM", "TPS"
xBins = targetAfrBlends1_rpmBins, RPMValue
yBins = targetAfrBlends1_loadBins, TPSValue
zBins = targetAfrBlends1_table
gridOrient = 250, 0, 340
table = ignitionIatCorrTableTbl, ignitionIatCorrTableMap, "Ignition Intake Air Temp correction", 1
xyLabels = "Air Temp", "Ignition Load"
xBins = ignitionIatCorrTempBins, intake
@ -1975,6 +1988,11 @@ menuDialog = main
#else
subMenu = afrTableTbl, "Target AFR", 0, {isInjectionEnabled == 1}
#endif
groupMenu = "Target AFR blend tables"
groupChildMenu = targetAfrBlend1Cfg, "Target AFR 1 bias"
groupChildMenu = targetAfrBlend1Table, "Target AFR 1 adder", { targetAfrBlends1_blendParameter != 0 }
subMenu = std_separator
subMenu = tChargeSettings, "Charge temperature estimation", 0, {isInjectionEnabled == 1}@@if_ts_show_charge_estimation
@ -2932,6 +2950,17 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
field = "Y axis override (set Zero for no override)", boostClosedLoopBlends2_yAxisOverride, {boostClosedLoopBlends2_blendParameter}
panel = boostClosedLoopBlend2Bias, {boostClosedLoopBlends2_blendParameter}
dialog = targetAfrBlend1Cfg, "Target AFR blend 1 config"
field = "#The bias table controls how much of the blend table"
field = "#is mixed in to the target AFR table. For example, a value of"
field = "#+10 in the table, with 50 as the current bias will result"
field = "#in +5.0 added to target AFR %."
field = "#The X axis of the bias table is controlled by the selected blend"
field = "#parameter below."
field = "Blend parameter", targetAfrBlends1_blendParameter
field = "Y axis override (set Zero for no override)", targetAfrBlends1_yAxisOverride, { targetAfrBlends1_blendParameter }
panel = targetAfrBlend1Bias, { targetAfrBlends1_blendParameter }
dialog = dwellSettings, "", yAxis
panel = dwellCorrection
panel = dwellVoltageCorrection