Initial commit of DFCO (Untested on a car, working on bench)
This commit is contained in:
parent
bb2fcaea11
commit
e00019bddc
|
@ -26,11 +26,10 @@ byte correctionsTotal()
|
|||
byte result; //temporary variable to store the result of each corrections function
|
||||
|
||||
//As the 'normal' case will be for each function to return 100, we only perform the division operation if the returned result is not equal to that
|
||||
//The function divs100 divides a signed int by 100 in a very fast way and is used instead of div() or /
|
||||
currentStatus.wueCorrection = correctionWUE();
|
||||
//if (currentStatus.wueCorrection != 100) { sumCorrections = div((sumCorrections * currentStatus.wueCorrection), 100).quot; }
|
||||
if (currentStatus.wueCorrection != 100) { sumCorrections = divs100(sumCorrections * currentStatus.wueCorrection); }
|
||||
result = correctionASE();
|
||||
//if (result != 100) { sumCorrections = div((sumCorrections * result), 100).quot; }
|
||||
if (result != 100) { sumCorrections = divs100(sumCorrections * result); }
|
||||
result = correctionCranking();
|
||||
if (result != 100) { sumCorrections = div((sumCorrections * result), 100).quot; }
|
||||
|
@ -39,16 +38,15 @@ byte correctionsTotal()
|
|||
result = correctionFloodClear();
|
||||
if (result != 100) { sumCorrections = div((sumCorrections * result), 100).quot; }
|
||||
currentStatus.egoCorrection = correctionsAFRClosedLoop();
|
||||
//if (currentStatus.egoCorrection != 100) { sumCorrections = div((sumCorrections * currentStatus.egoCorrection), 100).quot; }
|
||||
if (currentStatus.egoCorrection != 100) { sumCorrections = divs100(sumCorrections * currentStatus.egoCorrection); }
|
||||
currentStatus.batCorrection = correctionsBatVoltage();
|
||||
//if (currentStatus.batCorrection != 100) { sumCorrections = div((sumCorrections * currentStatus.batCorrection), 100).quot; }
|
||||
if (currentStatus.batCorrection != 100) { sumCorrections = divs100(sumCorrections * currentStatus.batCorrection); }
|
||||
currentStatus.iatCorrection = correctionsIATDensity();
|
||||
//if (currentStatus.iatCorrection != 100) { sumCorrections = div((sumCorrections * currentStatus.iatCorrection), 100).quot; }
|
||||
if (currentStatus.iatCorrection != 100) { sumCorrections = divs100(sumCorrections * currentStatus.iatCorrection); }
|
||||
currentStatus.launchCorrection = correctionsLaunch();
|
||||
if (currentStatus.launchCorrection != 100) { sumCorrections = div((sumCorrections * currentStatus.launchCorrection), 100).quot; }
|
||||
currentStatus.dfcoOn = correctionsDFCO();
|
||||
if ( currentStatus.dfcoOn ) { sumCorrections = 0; }
|
||||
|
||||
if(sumCorrections > 255) { sumCorrections = 255; } //This is the maximum allowable increase
|
||||
return (byte)sumCorrections;
|
||||
|
@ -186,6 +184,16 @@ byte correctionsLaunch()
|
|||
else { return 100; }
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if decelleration fuel cutoff should be on, false if its off
|
||||
*/
|
||||
bool correctionsDFCO()
|
||||
{
|
||||
if ( !configPage2.dfcoEnabled ) { return false; } //If the DFCO option isn't turned on, always return false (off)
|
||||
if (currentStatus.dfcoOn) { return ( currentStatus.RPM > configPage2.dfcoRPM ) && ( currentStatus.TPS < configPage2.dfcoTPSThresh ); }
|
||||
else { return ( currentStatus.RPM > (configPage2.dfcoRPM + configPage2.dfcoHyster) ) && ( currentStatus.TPS < configPage2.dfcoTPSThresh ); }
|
||||
}
|
||||
|
||||
/*
|
||||
Lookup the AFR target table and perform either a simple or PID adjustment based on this
|
||||
|
||||
|
|
20
globals.h
20
globals.h
|
@ -120,6 +120,7 @@ struct statuses {
|
|||
volatile byte squirt;
|
||||
volatile byte spark;
|
||||
byte engine;
|
||||
bool dfcoOn; //Decelleration fuel cutoff
|
||||
unsigned int PW; //In uS
|
||||
volatile byte runSecs; //Counter of seconds since cranking commenced (overflows at 255 obviously)
|
||||
volatile byte secl; //Continous
|
||||
|
@ -246,7 +247,8 @@ struct config2 {
|
|||
byte dwellCont : 1; //Fixed duty dwell control
|
||||
byte useDwellLim : 1; //Whether the dwell limiter is off or on
|
||||
byte sparkMode : 2; //Spark output mode (Eg Wasted spark, single channel or Wasted COP)
|
||||
byte dwellUnused : 4;
|
||||
byte dfcoEnabled : 1; //Whether or not DFCO is turned on
|
||||
byte dwellUnused : 3;
|
||||
|
||||
byte dwellCrank; //Dwell time whilst cranking
|
||||
byte dwellRun; //Dwell time whilst running
|
||||
|
@ -265,19 +267,9 @@ struct config2 {
|
|||
byte dwellCorrectionValues[6]; //Correction table for dwell vs battery voltage
|
||||
byte iatRetBins[6]; // Inlet Air Temp timing retard curve bins
|
||||
byte iatRetValues[6]; // Inlet Air Temp timing retard curve values
|
||||
byte unused50;
|
||||
byte unused51;
|
||||
byte unused52;
|
||||
byte unused53;
|
||||
byte unused54;
|
||||
byte unused55;
|
||||
byte unused56;
|
||||
byte unused57;
|
||||
byte unused58;
|
||||
byte unused59;
|
||||
byte unused60;
|
||||
byte unused61;
|
||||
byte unused62;
|
||||
byte dfcoRPM; //RPM at which DFCO turns off/on at
|
||||
byte dfcoHyster; //Hysteris RPM for DFCO
|
||||
byte dfcoTPSThresh; //TPS must be below this figure for DFCO to engage
|
||||
byte unused63;
|
||||
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ page = 2
|
|||
|
||||
reqFuel = scalar, U08, 24, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||
divider = scalar, U08, 25, "", 1.0, 0.0
|
||||
injTiming = bits, U08, 26, [0:1], "Simultaneous", "Semi-Sequential", "Sequential"
|
||||
;injTiming = bits, U08, 26, [0:1], "Simultaneous", "Semi-Sequential", "Sequential"
|
||||
alternate = bits, U08, 26, [2:2], "Simultaneous", "Semi-Sequential"
|
||||
injOpen = scalar, U08, 27, "ms", 0.1, 0.0, 0.1, 25.5, 1
|
||||
inj1Ang = scalar, U16, 28, "deg", 1.0, 0.0, 0.0, 360, 0
|
||||
|
@ -219,6 +219,7 @@ page = 4
|
|||
dwellcont = bits, U08, 12, [0:0], "INVALID", "Dwell control"
|
||||
useDwellLim= bits, U08, 12, [1:1], "Off", "On"
|
||||
sparkMode = bits, U08, 12, [2:3], "Wasted Spark", "Single Channel", "Wasted COP", "Sequential"
|
||||
dfcoEnabled= bits, U08, 12, [4:4], "Off", "On"
|
||||
dwellcrank = scalar, U08, 13, "ms", 0.1, 0, 0, 25, 1
|
||||
dwellrun = scalar, U08, 14, "ms", 0.1, 0, 0, 8, 1
|
||||
numteeth = scalar, U08, 15, "teeth", 1.0, 0.0, 0.0, 255, 0
|
||||
|
@ -248,9 +249,10 @@ page = 4
|
|||
iatRetBins = array, U08, 48, [ 6], "F", 1.0, 0.0, 0.00, 255.0, 0
|
||||
#endif
|
||||
iatRetRates = array, U08, 54, [ 6], "deg", 1.0, 0.0, 0.00, 255.0, 0
|
||||
unused4-60 = scalar, U08, 60, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused4-61 = scalar, U08, 61, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused4-62 = scalar, U08, 62, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
;Decelleration Fuel Cut Off (DFCO)
|
||||
dfcoRPM = scalar, U08, 60, "RPM", 10.0, 0.0, 100, 2550, 0
|
||||
dfcoHyster = scalar, U08, 61, "RPM", 1.0, 0.0, 100, 255.0, 0
|
||||
dfcoTPSThresh= scalar, U08, 62, "%", 1.0, 0.0, 100, 100.0, 0
|
||||
unused4-63 = scalar, U08, 63, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
|
||||
|
||||
|
@ -579,12 +581,18 @@ page = 8
|
|||
panel = engine_constants_south, South
|
||||
|
||||
|
||||
dialog = accelEnrichments_south, ""
|
||||
dialog = accelEnrichments_center, ""
|
||||
field = "TPSdot Threshold", tpsThresh
|
||||
field = "Accel Time", taeTime
|
||||
; field = "Cold Accel Enrichment", taeColdA
|
||||
; field = "Cold Accel Mult", taeColdM
|
||||
field = "Decel Fuel Amount", tdePct
|
||||
|
||||
dialog = accelEnrichments_south, "Decelleration Fuel Cutoff (DFCO)"
|
||||
field = "Enabled", dfcoEnabled
|
||||
field = "TPS Threshold", dfcoTPSThresh, { dfcoEnabled }
|
||||
field = "Cutoff RPM", dfcoRPM, { dfcoEnabled }
|
||||
field = "RPM Hysteresis", dfcoHyster, { dfcoEnabled }
|
||||
|
||||
dialog = accelEnrichments_north, "", xAxis
|
||||
panel = time_accel_tpsdot_curve
|
||||
|
@ -592,6 +600,7 @@ page = 8
|
|||
|
||||
dialog = accelEnrichments, "Acceleration Enrichment"
|
||||
panel = accelEnrichments_north, North
|
||||
panel = accelEnrichments_center, Center
|
||||
panel = accelEnrichments_south, South
|
||||
|
||||
dialog = injChars, "Injector Characteristics"
|
||||
|
|
Loading…
Reference in New Issue