Merge pull request #1626 from mck1117/ign-load
Use ignition load for ignition
This commit is contained in:
commit
fdd63812bc
|
@ -297,7 +297,7 @@ static void showFuelInfo2(float rpm, float engineLoad) {
|
|||
scheduleMsg(&logger2, "algo=%s/pump=%s", getEngine_load_mode_e(engineConfiguration->fuelAlgorithm),
|
||||
boolToString(enginePins.fuelPumpRelay.getLogicValue()));
|
||||
|
||||
scheduleMsg(&logger2, "injection phase=%.2f/global fuel correction=%.2f", getInjectionOffset(rpm), engineConfiguration->globalFuelCorrection);
|
||||
scheduleMsg(&logger2, "injection phase=%.2f/global fuel correction=%.2f", getInjectionOffset(rpm, getFuelingLoad()), engineConfiguration->globalFuelCorrection);
|
||||
|
||||
scheduleMsg(&logger2, "baro correction=%.2f", engine->engineState.baroCorrection);
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ EXTERN_ENGINE;
|
|||
|
||||
static ign_Map3D_t advanceMap("advance");
|
||||
// This coeff in ctor parameter is sufficient for int16<->float conversion!
|
||||
static ign_tps_Map3D_t advanceTpsMap("advanceTps", 1.0 / ADVANCE_TPS_STORAGE_MULT);
|
||||
static ign_Map3D_t iatAdvanceCorrectionMap("iat corr");
|
||||
|
||||
// Init PID later (make it compatible with unit-tests)
|
||||
|
@ -84,14 +83,7 @@ static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAME
|
|||
|
||||
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(engineLoad), "invalid el", NAN);
|
||||
|
||||
float advanceAngle;
|
||||
if (CONFIG(useTPSAdvanceTable)) {
|
||||
// TODO: what do we do about multi-TPS?
|
||||
float tps = Sensor::get(SensorType::Tps1).value_or(0);
|
||||
advanceAngle = advanceTpsMap.getValue(rpm, tps);
|
||||
} else {
|
||||
advanceAngle = advanceMap.getValue((float) rpm, engineLoad);
|
||||
}
|
||||
float advanceAngle = advanceMap.getValue((float) rpm, engineLoad);
|
||||
|
||||
// get advance from the separate table for Idle
|
||||
if (CONFIG(useSeparateAdvanceForIdle)) {
|
||||
|
@ -297,8 +289,6 @@ void initTimingMap(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
// We init both tables in RAM because here we're at a very early stage, with no config settings loaded.
|
||||
advanceMap.init(config->ignitionTable, config->ignitionLoadBins,
|
||||
config->ignitionRpmBins);
|
||||
advanceTpsMap.init(CONFIG(ignitionTpsTable), CONFIG(ignitionTpsBins),
|
||||
config->ignitionRpmBins);
|
||||
iatAdvanceCorrectionMap.init(config->ignitionIatCorrTable, config->ignitionIatCorrLoadBins,
|
||||
config->ignitionIatCorrRpmBins);
|
||||
// init timing PID
|
||||
|
|
|
@ -174,10 +174,6 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
|
||||
baroCorrection = getBaroCorrection(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
injectionOffset = getInjectionOffset(rpm PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
timingAdvance = getAdvance(rpm, engineLoad PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
multispark.count = getMultiSparkCount(rpm PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
if (engineConfiguration->fuelAlgorithm == LM_SPEED_DENSITY) {
|
||||
|
@ -202,11 +198,15 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
currentRawVE = interpolateClamped(0.0f, idleVe, CONFIG(idlePidDeactivationTpsThreshold), currentRawVE, tps.Value);
|
||||
}
|
||||
currentBaroCorrectedVE = baroCorrection * currentRawVE * PERCENT_DIV;
|
||||
} else {
|
||||
baseTableFuel = getBaseTableFuel(rpm, engineLoad);
|
||||
}
|
||||
|
||||
ENGINE(injectionDuration) = getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
float fuelLoad = getFuelingLoad(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
injectionOffset = getInjectionOffset(rpm, fuelLoad PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
float ignitionLoad = getIgnitionLoad(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
timingAdvance = getAdvance(rpm, ignitionLoad PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
#endif // EFI_ENGINE_CONTROL
|
||||
}
|
||||
|
||||
|
|
|
@ -66,10 +66,6 @@ public:
|
|||
float fuelingLoad = 0;
|
||||
float ignitionLoad = 0;
|
||||
|
||||
/**
|
||||
* pre-calculated value from simple fuel lookup
|
||||
*/
|
||||
floatms_t baseTableFuel = 0;
|
||||
/**
|
||||
* Raw fuel injection duration produced by current fuel algorithm, without any correction
|
||||
*/
|
||||
|
|
|
@ -251,7 +251,7 @@ floatms_t getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
// TODO: independently selectable ignition load mode
|
||||
ENGINE(engineState.ignitionLoad) = tps;
|
||||
|
||||
baseFuel = engine->engineState.baseTableFuel;
|
||||
baseFuel = getBaseTableFuel(rpm, getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(baseFuel), "NaN bt baseFuel", 0);
|
||||
}
|
||||
|
||||
|
@ -260,18 +260,16 @@ floatms_t getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
return tpsAccelEnrich + baseFuel;
|
||||
}
|
||||
|
||||
angle_t getInjectionOffset(float rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
angle_t getInjectionOffset(float rpm, float load DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
if (cisnan(rpm)) {
|
||||
return 0; // error already reported
|
||||
}
|
||||
|
||||
float engineLoad = getFuelingLoad(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
if (cisnan(engineLoad)) {
|
||||
if (cisnan(load)) {
|
||||
return 0; // error already reported
|
||||
}
|
||||
|
||||
angle_t value = fuelPhaseMap.getValue(rpm, engineLoad);
|
||||
angle_t value = fuelPhaseMap.getValue(rpm, load);
|
||||
|
||||
if (cisnan(value)) {
|
||||
// we could be here while resetting configuration for example
|
||||
|
|
|
@ -27,7 +27,7 @@ AirmassResult getRealMafAirmass(float airMass, int rpm DECLARE_ENGINE_PARAMETER_
|
|||
floatms_t getBaseTableFuel(int rpm, float engineLoad);
|
||||
float getBaroCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
int getNumberOfInjections(injection_mode_e mode DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
angle_t getInjectionOffset(float rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
angle_t getInjectionOffset(float rpm, float load DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
float getIatFuelCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
floatms_t getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
float getCltFuelCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
|
|
@ -188,7 +188,6 @@ custom baro_corr_table_t 4*@@BARO_CORR_SIZE@@x@@BARO_CORR_SIZE@@ array, F32,
|
|||
|
||||
|
||||
custom ignition_table_t 4*@@IGN_RPM_COUNT@@x@@IGN_LOAD_COUNT@@ array, F32, @OFFSET@, [@@IGN_RPM_COUNT@@x@@IGN_LOAD_COUNT@@],"deg", 1, 0, -20, 90, 2
|
||||
custom ignition_tps_table_t 2*@@IGN_RPM_COUNT@@x@@IGN_TPS_COUNT@@ array, S16, @OFFSET@, [@@IGN_RPM_COUNT@@x@@IGN_TPS_COUNT@@],"deg", 0.01, 0, -20, 90, 2
|
||||
|
||||
custom angle_table_t 4*@@IGN_RPM_COUNT@@x@@IGN_LOAD_COUNT@@ array, F32, @OFFSET@, [@@IGN_RPM_COUNT@@x@@IGN_LOAD_COUNT@@],"deg", 1, 0, -720, 720, 2
|
||||
custom pedal_to_tps_t @@PEDAL_TO_TPS_SIZE@@x@@PEDAL_TO_TPS_SIZE@@ array, U08, @OFFSET@, [@@PEDAL_TO_TPS_SIZE@@x@@PEDAL_TO_TPS_SIZE@@],"%", 1, 0, 0, 100, 0
|
||||
|
@ -1226,7 +1225,7 @@ float[CRANKING_ADVANCE_CURVE_SIZE] crankingAdvance ;+Optional timing advance
|
|||
float[CLT_CURVE_SIZE] iacCoastingBins;CLT-based idle position for coasting (used in Auto-PID Idle mode);"C", 1, 0, -100.0, 250.0, 2
|
||||
float[CLT_CURVE_SIZE] iacCoasting; CLT-based idle position for coasting (used in Auto-PID Idle mode);"%", 1, 0, 0.0, 100.0, 2
|
||||
|
||||
ignition_tps_table_t ignitionTpsTable;
|
||||
uint8_t[512] unused3288;;"units", 1, 0, -20, 100, 0
|
||||
float[IGN_TPS_COUNT] ignitionTpsBins;;"TPS", 1, 0.0, 0, 100.0, 2
|
||||
|
||||
float tChargeAirCoefMin;;"Min tCharge Coeff.", 1, 0, 0.0, 1.0, 4
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
; this should stop TS from looking for the CAN ID in the 2nd byte location and allow the page reads to work correctly.
|
||||
enable2ndByteCanID = false
|
||||
|
||||
;#unset tuneByMAF
|
||||
|
||||
[SettingGroups]
|
||||
; the referenceName will over-ride previous, so if you are creating a
|
||||
; settingGroup with a reference name of lambdaSensor, it will replace the
|
||||
|
@ -33,16 +31,6 @@ enable2ndByteCanID = false
|
|||
; folder. If is is an undefined referenceName, it will be added.
|
||||
; keyword = referenceName, DisplayName
|
||||
|
||||
settingGroup = tuneVeMode, "VE Autotune Mode"
|
||||
settingOption = tuneByTPS, "TPS-Based (See Injection -> Inj.Settings)"
|
||||
settingOption = tuneByMAF, "MAF-Based"
|
||||
settingOption = tuneByLoad, "Load-Based (Default)"
|
||||
|
||||
; settingGroup = fAlgorithmSetting, "Fuel Logic / Tables"
|
||||
; settingOption = FA_PLAIN_MAF, "Plain MAF"
|
||||
; settingOption = FA_TPS, "AlphaN/TPS"
|
||||
; settingOption = DEFAULT, "Speed Density" ; DEFAULT will be over looked and this will fall into the #else block of the statement.
|
||||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = @@TS_SIGNATURE@@
|
||||
|
@ -146,11 +134,7 @@ enable2ndByteCanID = false
|
|||
[VeAnalyze]
|
||||
|
||||
; tableName, lambdaTargetTableName, lambdaChannel, egoCorrectionChannel, activeCondition
|
||||
#if tuneByMAF
|
||||
veAnalyzeMap = fuelTableMAFTbl, afrTableTbl, AFRValue, egoCorrection, { 1 }
|
||||
#else
|
||||
veAnalyzeMap = veTableTbl, afrTableTbl, AFRValue, egoCorrection, { 1 }
|
||||
#endif
|
||||
lambdaTargetTables = afrTableTbl, afrTSCustom
|
||||
|
||||
; filter = Name, "DisplayName", outputChannel, operator, defaultVal, userAdjustable
|
||||
|
@ -803,29 +787,12 @@ enable2ndByteCanID = false
|
|||
table = ignitionTableTbl, ignitionTableMap, "Ignition Table", 1
|
||||
; constant, variable
|
||||
xBins = ignitionRpmBins, RPMValue
|
||||
#if FA_PLAIN_MAF
|
||||
yBins = ignitionLoadBins, MAFValue
|
||||
#elif FA_TPS
|
||||
yBins = ignitionLoadBins, TPSValue
|
||||
#else
|
||||
yBins = ignitionLoadBins, engineLoad
|
||||
#endif
|
||||
|
||||
yBins = ignitionLoadBins, ignitionLoad
|
||||
zBins = ignitionTable
|
||||
; gridHeight = 2.0
|
||||
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
|
||||
upDownLabel = "(RICHER)", "(LEANER)"
|
||||
|
||||
table = ignitionTpsTableTbl, ignitionTableMap, "Ignition TPS Table", 1
|
||||
; constant, variable
|
||||
; Currently we share ignitionRpmBins between two advance tables... Is it ok?
|
||||
xBins = ignitionRpmBins, RPMValue
|
||||
yBins = ignitionTpsBins, TPSValue
|
||||
|
||||
zBins = ignitionTpsTable
|
||||
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
|
||||
upDownLabel = "(RICHER)", "(LEANER)"
|
||||
|
||||
table = ignitionIatCorrTableTbl, ignitionIatCorrTableMap, "Ignition Intake Air Temp correction", 1
|
||||
; constant, variable
|
||||
xBins = ignitionIatCorrRpmBins, RPMValue
|
||||
|
@ -838,11 +805,7 @@ enable2ndByteCanID = false
|
|||
table = veTableTbl, veTableMap, "VE Table", 1
|
||||
; constant, variable
|
||||
xBins = veRpmBins, RPMValue
|
||||
#if tuneByTPS
|
||||
yBins = ignitionTpsBins, TPSValue
|
||||
#else
|
||||
yBins = veLoadBins, fuelingLoad
|
||||
#endif
|
||||
zBins = veTable
|
||||
; gridHeight = 2.0
|
||||
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
|
||||
|
@ -1296,7 +1259,6 @@ menuDialog = main
|
|||
subMenu = std_separator
|
||||
|
||||
subMenu = ignitionTableTbl, "Ignition advance", 0, {isIgnitionEnabled == 1 && useTPSAdvanceTable == 0}
|
||||
subMenu = ignitionTpsTableTbl, "Ignition advance (TPS)", 0, {isIgnitionEnabled == 1 && useTPSAdvanceTable == 1}
|
||||
subMenu = std_separator
|
||||
|
||||
# corrections
|
||||
|
@ -1603,12 +1565,9 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
|
|||
field = "Mode", injectionMode, {isInjectionEnabled == 1}
|
||||
field = "#Batch injection with individual wiring"
|
||||
field = "Two wire batch emulation", twoWireBatchInjection, {isInjectionEnabled == 1 && injectionMode == 2}
|
||||
#if tuneByTPS
|
||||
field = "Use TPS instead of Load for VE table", useTPSBasedVeTable, {isInjectionEnabled == 1 && fuelAlgorithm == LM_SPEED_DENSITY}
|
||||
#else
|
||||
field = "#Enabled for TPS-Based 'VE Autotune Mode' in Project Settings"
|
||||
field = "Use TPS instead of Load for VE table", useTPSBasedVeTable, {0}
|
||||
#endif
|
||||
|
||||
dialog = ignitionOutputs, "Ignition Outputs"
|
||||
field = "Ignition Pin Mode", ignitionPinMode, {isIgnitionEnabled == 1}
|
||||
|
@ -1627,7 +1586,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
|
|||
field = "#Wasted spark with individual coils"
|
||||
field = "Two wire wasted", twoWireBatchIgnition, {isIgnitionEnabled == 1 && ignitionMode == 2}
|
||||
field = "Timing Mode", timingMode, {isIgnitionEnabled == 1}
|
||||
field = "Use TPS-based Advance Table", useTPSAdvanceTable, {isIgnitionEnabled == 1 && fuelAlgorithm == LM_SPEED_DENSITY}
|
||||
field = "Use TPS-based Advance Table", useTPSAdvanceTable, {isIgnitionEnabled == 1}
|
||||
field = "#Use fixed timing while validating with a timing gun"
|
||||
field = "Fixed Timinig", fixedTiming, {isIgnitionEnabled == 1 && timingMode == 1}
|
||||
|
||||
|
|
|
@ -147,14 +147,9 @@ void copy2DTable(const vType source[LOAD_BIN_SIZE][RPM_BIN_SIZE], vType destinat
|
|||
* AFR value is packed into uint8_t with a multiplier of 10
|
||||
*/
|
||||
#define AFR_STORAGE_MULT 10
|
||||
/**
|
||||
* TPS-based Advance value is packed into int16_t with a multiplier of 100
|
||||
*/
|
||||
#define ADVANCE_TPS_STORAGE_MULT 100
|
||||
|
||||
typedef Map3D<FUEL_RPM_COUNT, FUEL_LOAD_COUNT, uint8_t, float> afr_Map3D_t;
|
||||
typedef Map3D<IGN_RPM_COUNT, IGN_LOAD_COUNT, float, float> ign_Map3D_t;
|
||||
typedef Map3D<IGN_RPM_COUNT, IGN_TPS_COUNT, int16_t, float> ign_tps_Map3D_t;
|
||||
typedef Map3D<FUEL_RPM_COUNT, FUEL_LOAD_COUNT, float, float> fuel_Map3D_t;
|
||||
typedef Map3D<BARO_CORR_SIZE, BARO_CORR_SIZE, float, float> baroCorr_Map3D_t;
|
||||
typedef Map3D<PEDAL_TO_TPS_SIZE, PEDAL_TO_TPS_SIZE, uint8_t, uint8_t> pedal2tps_t;
|
||||
|
|
Loading…
Reference in New Issue