Update to Matt's MAF code for VE table tuning. (#1295)

* Update rusefi_lib

* Update fuel_math.cpp

Updated Matt's MAF code to include fuel table

* fixed missing include

* Replace get_specs_displacement

* ve2Map corrected

* ve2Map fix 2

* Fix for missing TS table

* Corrected standard air charge

* Math fix, PW now good

Still have minimal response from the VE table

* rusefi.input correction

* Added extra comment

* Ease of reading update
This commit is contained in:
OrchardPerformance 2020-04-14 06:21:48 +01:00 committed by GitHub
parent 2d663b844b
commit 5739032254
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 7 deletions

View File

@ -36,7 +36,7 @@ EXTERN_ENGINE;
fuel_Map3D_t fuelMap("fuel");
static fuel_Map3D_t fuelPhaseMap("fl ph");
extern fuel_Map3D_t ve2Map;
extern fuel_Map3D_t veMap;
extern afr_Map3D_t afrMap;
extern baroCorr_Map3D_t baroCorrMap;
@ -142,6 +142,7 @@ floatms_t getRunningFuel(floatms_t baseFuel DECLARE_ENGINE_PARAMETER_SUFFIX) {
/* DISPLAY_ENDIF */
/**
* Function block now works to create a standardised load from the cylinder filling as well as tune fuel via VE table.
* @return total duration of fuel injection per engine cycle, in milliseconds
*/
float getRealMafFuel(float airSpeed, int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
@ -155,7 +156,6 @@ float getRealMafFuel(float airSpeed, int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
// 1/min -> 1/s
float revsPerSecond = rpm / 60.0f;
float airPerRevolution = gramPerSecond / revsPerSecond;
// Now we have to divide among cylinders - on a 4 stroke, half of the cylinders happen every rev
@ -163,7 +163,15 @@ float getRealMafFuel(float airSpeed, int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
float halfCylCount = CONFIG(specs.cylindersCount) / 2.0f;
float cylinderAirmass = airPerRevolution / halfCylCount;
float fuelMassGram = cylinderAirmass / afrMap.getValue(rpm, airSpeed);
//Calculation of 100% VE air mass in g/rev - 1 cylinder filling at 1.2929g/L
float StandardAirCharge = CONFIG(specs.displacement) / CONFIG(specs.cylindersCount) * 1.2929;
//Create % load for fuel table using relative naturally aspiratedcylinder filling
float airChargeLoad = 100 * cylinderAirmass/StandardAirCharge;
//Correct air mass by VE table
float corrCylAirmass = cylinderAirmass * veMap.getValue(rpm, airChargeLoad) / 100;
float fuelMassGram = corrCylAirmass / afrMap.getValue(rpm, airSpeed);
float pulseWidthSeconds = fuelMassGram / cc_minute_to_gramm_second(engineConfiguration->injector.flow);
// Convert to ms

View File

@ -1208,14 +1208,14 @@ menuDialog = main
subMenu = std_separator
# Targets & closed loop
subMenu = afrTableTbl, "Target AFR", 0, {isInjectionEnabled == 1 && fuelAlgorithm == LM_SPEED_DENSITY}
subMenu = afrTableTbl, "Target AFR", 0, {isInjectionEnabled == 1 && (fuelAlgorithm == LM_SPEED_DENSITY || fuelAlgorithm == LM_REAL_MAF)}
subMenu = fuelClosedLoopDialog, "Closed loop correction", 0, {isInjectionEnabled == 1}
subMenu = coastingFuelCutControl, "Deceleration fuel cutoff (DFCO)", 0, {isInjectionEnabled == 1}
subMenu = std_separator
# Fuel table/VE
subMenu = fuelTableDialog, "Fuel table", 0, {isInjectionEnabled == 1 && fuelAlgorithm != LM_SPEED_DENSITY}
subMenu = veTableDialog, "VE", 0, {isInjectionEnabled == 1 && fuelAlgorithm == LM_SPEED_DENSITY}
subMenu = fuelTableDialog, "Fuel table", 0, {isInjectionEnabled == 1 && fuelAlgorithm != LM_SPEED_DENSITY && fuelAlgorithm != LM_REAL_MAF}
subMenu = veTableDialog, "VE", 0, {isInjectionEnabled == 1 && (fuelAlgorithm == LM_SPEED_DENSITY || fuelAlgorithm == LM_REAL_MAF)}
subMenu = injPhaseTableTbl, "Injection phase", 0, {isInjectionEnabled == 1}
subMenu = std_separator

@ -1 +1 @@
Subproject commit 37b2bec0612122614058137efb6fbe5b6b2502df
Subproject commit 08677673d2e6c05e8650555fd87ec30876acf831