Add open loop boost option back in
This commit is contained in:
parent
40fb525882
commit
a694651caa
|
@ -55,6 +55,8 @@
|
|||
algorithmUnits = bits, U08, [0:2], "kPa", "% TPS", "%", "% TPS", "INVALID", "INVALID", "INVALID", "INVALID"
|
||||
algorithmLimits= array, U16, [8], "", 1.0, 0, 0, 511, 0, noMsqSave
|
||||
|
||||
boostTableLabels = bits, U08, [0:1], "Duty Cycle %", "kPa"
|
||||
|
||||
fuelLoadMax = scalar, U08, "", 1, 0, 0, 511, 0
|
||||
ignLoadMax = scalar, U08, "", 1, 0, 0, 511, 0
|
||||
|
||||
|
@ -305,7 +307,7 @@ page = 4
|
|||
; name = array, type, offset, shape, units, scale, translate, lo, hi, digits
|
||||
; name = scalar, type, offset, units, scale, translate, lo, hi, digits
|
||||
;Dwell control
|
||||
unused4-12a = bits, U08, 12, [0:0], "INVALID", "NOTHING"
|
||||
boostType = bits, U08, 12, [0:0], "Open Loop", "Closed Loop"
|
||||
useDwellLim = bits, U08, 12, [1:1], "Off", "On"
|
||||
sparkMode = bits, U08, 12, [2:4], "Wasted Spark", "Single Channel", "Wasted COP", "Sequential", "Rotary", "INVALID", "INVALID", "INVALID"
|
||||
TrigFilter = bits, U08, 12, [5:6], "Off", "Weak", "Medium", "Aggressive"
|
||||
|
@ -420,8 +422,8 @@ page = 6
|
|||
|
||||
; Launch Control
|
||||
launchPin = bits , U08, 48, [0:5], "Board Default", "INVALID", "INVALID", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
|
||||
launchEnable= bits, U08, 48, [6:6], "No", "Yes"
|
||||
launchHiLo = bits, U08, 48, [7:7], "LOW", "HIGH"
|
||||
launchEnable= bits, U08, 48, [6:6], "No", "Yes"
|
||||
launchHiLo = bits, U08, 48, [7:7], "LOW", "HIGH"
|
||||
|
||||
lnchSoftLim = scalar, U08, 49, "rpm", 100, 0.0, 100, 25500, 0
|
||||
lnchRetard = scalar, S08, 50, "deg", 1.0, 0.0, -30, 40, 0
|
||||
|
@ -503,7 +505,7 @@ page = 7
|
|||
; #if BOOSTPSI
|
||||
; boostTable = array, U08, 0,[8x8], "PSI", 0.29007547546041846, -50.6625, 0, 74, 0
|
||||
; #else
|
||||
boostTable = array, U08, 0,[8x8], "kPa", 2.0, 0.0, 0, 511, 0
|
||||
boostTable = array, U08, 0,[8x8], { bitStringValue( boostTableLabels, boostType ) }, 2.0, 0.0, 0, boostTableLimit, 0
|
||||
; #endif
|
||||
rpmBinsBoost = array, U08, 64,[ 8], "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
tpsBinsBoost = array, U08, 72,[ 8], "TPS", 1.0, 0.0, 0.0, 255.0, 0
|
||||
|
@ -932,7 +934,7 @@ menuDialog = main
|
|||
subMenu = fuelpump, "Fuel Pump"
|
||||
subMenu = std_separator
|
||||
subMenu = boostSettings, "Boost Control"
|
||||
subMenu = boostTbl, "Boost target", 8, { boostEnabled }
|
||||
subMenu = boostLoad, "Boost Targets/Load", 8, { boostEnabled }
|
||||
subMenu = std_separator
|
||||
subMenu = vvtSettings, "VVT Control"
|
||||
subMenu = vvtTbl, "VVT duty cycle", 8, { vvtEnabled }
|
||||
|
@ -1410,6 +1412,12 @@ menuDialog = main
|
|||
field = "Boost Cut", boostCutType
|
||||
field = "Boost Limit", boostLimit, { boostCutType }
|
||||
|
||||
dialog = boostLoad, ""
|
||||
field = "Mode", boostType
|
||||
field = "In open loop mode, the values in this table are duty cycle %"
|
||||
field = "In closed loop mode, the values are boost targets in kPa"
|
||||
panel = boostTbl
|
||||
|
||||
dialog = RevLimiterS, "Rev Limiter", 4
|
||||
topicHelp = "http://speeduino.com/wiki/index.php/Rev_Limits"
|
||||
field = "Rev Limiter"
|
||||
|
@ -2082,6 +2090,7 @@ cmdtestspk450dc = "E\x03\x0C"
|
|||
; constant, variable
|
||||
xBins = rpmBins, rpm
|
||||
yBins = fuelLoadBins, fuelLoad
|
||||
xyLabels = "RPM", "Fuel Load: "
|
||||
zBins = veTable
|
||||
|
||||
gridHeight = 2.0
|
||||
|
@ -2091,6 +2100,7 @@ cmdtestspk450dc = "E\x03\x0C"
|
|||
table = sparkTbl, sparkMap, "Ignition Advance Table", 3
|
||||
xBins = rpmBins2, rpm
|
||||
yBins = ignLoadBins, ignLoad
|
||||
xyLabels = "RPM", "Ignition Load: "
|
||||
zBins = advTable1
|
||||
gridHeight = 3.0
|
||||
upDownLabel = "ADVANCED", "RETARDED"
|
||||
|
@ -2108,11 +2118,12 @@ cmdtestspk450dc = "E\x03\x0C"
|
|||
upDownLabel = "RICHER", "LEANER"
|
||||
gridOrient = 250, 0, 340
|
||||
|
||||
#if BOOSTPSI
|
||||
table = boostTbl, boostMap, "Boost targets (PSI)", 8
|
||||
#else
|
||||
table = boostTbl, boostMap, "Boost targets (Absolute kPa)", 8
|
||||
#endif
|
||||
;#if BOOSTPSI
|
||||
;table = boostTbl, boostMap, "Boost targets (PSI)", 8
|
||||
;#else
|
||||
;table = boostTbl, boostMap, "Boost targets (Absolute kPa)", 8
|
||||
;#endif
|
||||
table = boostTbl, boostMap, "Boost Duty / Target", 8
|
||||
xBins = rpmBinsBoost, rpm
|
||||
yBins = tpsBinsBoost, throttle
|
||||
zBins = boostTable
|
||||
|
@ -2473,6 +2484,8 @@ cmdtestspk450dc = "E\x03\x0C"
|
|||
fuelLoadMax = { (algorithm == 0 || algorithm == 2) ? 511 : 100 }
|
||||
ignLoadMax = { (ignAlgorithm == 0 || ignAlgorithm == 2) ? 511 : 100 }
|
||||
|
||||
boostTableLimit = { boostType == 0 ? 100 : 511 } ;The maximum value allowed in the boost table. 100 is used for duty cycle, 511 for kpa
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
[Datalog]
|
||||
|
|
|
@ -90,53 +90,69 @@ void boostControl()
|
|||
{
|
||||
if( configPage6.boostEnabled==1 )
|
||||
{
|
||||
if( (boostCounter & 7) == 1) { currentStatus.boostTarget = get3DTableValue(&boostTable, currentStatus.TPS, currentStatus.RPM) * 2; } //Boost target table is in kpa and divided by 2
|
||||
if(currentStatus.MAP >= (currentStatus.boostTarget - BOOST_HYSTER) )
|
||||
if(configPage4.boostType == OPEN_LOOP_BOOST)
|
||||
{
|
||||
//If flex fuel is enabled, there can be an adder to the boost target based on ethanol content
|
||||
if( configPage2.flexEnabled == 1 )
|
||||
{
|
||||
currentStatus.boostTarget += table2D_getValue(&flexBoostTable, currentStatus.ethanolPct);;
|
||||
}
|
||||
//Open loop
|
||||
currentStatus.boostDuty = get3DTableValue(&boostTable, currentStatus.TPS, currentStatus.RPM) * 2 * 100;
|
||||
|
||||
if(currentStatus.boostDuty > 10000) { currentStatus.boostDuty = 10000; } //Safety check
|
||||
if(currentStatus.boostDuty == 0) { DISABLE_BOOST_TIMER(); BOOST_PIN_LOW(); } //If boost duty is 0, shut everything down
|
||||
else
|
||||
{
|
||||
currentStatus.flexBoostCorrection = 0;
|
||||
boost_pwm_target_value = ((unsigned long)(currentStatus.boostDuty) * boost_pwm_max_count) / 10000; //Convert boost duty (Which is a % multipled by 100) to a pwm count
|
||||
ENABLE_BOOST_TIMER(); //Turn on the compare unit (ie turn on the interrupt) if boost duty >0
|
||||
}
|
||||
|
||||
if(currentStatus.boostTarget > 0)
|
||||
}
|
||||
else if (configPage4.boostType == CLOSED_LOOP_BOOST)
|
||||
{
|
||||
if( (boostCounter & 7) == 1) { currentStatus.boostTarget = get3DTableValue(&boostTable, currentStatus.TPS, currentStatus.RPM) * 2; } //Boost target table is in kpa and divided by 2
|
||||
if(currentStatus.MAP >= (currentStatus.boostTarget - BOOST_HYSTER) )
|
||||
{
|
||||
//This only needs to be run very infrequently, once every 16 calls to boostControl(). This is approx. once per second
|
||||
if( (boostCounter & 15) == 1)
|
||||
//If flex fuel is enabled, there can be an adder to the boost target based on ethanol content
|
||||
if( configPage2.flexEnabled == 1 )
|
||||
{
|
||||
boostPID.SetOutputLimits(configPage2.boostMinDuty, configPage2.boostMaxDuty);
|
||||
|
||||
if(configPage6.boostMode == BOOST_MODE_SIMPLE) { boostPID.SetTunings(100, 100, 100); }
|
||||
else { boostPID.SetTunings(configPage6.boostKP, configPage6.boostKI, configPage6.boostKD); }
|
||||
currentStatus.boostTarget += table2D_getValue(&flexBoostTable, currentStatus.ethanolPct);;
|
||||
}
|
||||
|
||||
bool PIDcomputed = boostPID.Compute(); //Compute() returns false if the required interval has not yet passed.
|
||||
if(currentStatus.boostDuty == 0) { DISABLE_BOOST_TIMER(); BOOST_PIN_LOW(); } //If boost duty is 0, shut everything down
|
||||
else
|
||||
{
|
||||
if(PIDcomputed == true)
|
||||
{
|
||||
boost_pwm_target_value = ((unsigned long)(currentStatus.boostDuty) * boost_pwm_max_count) / 10000; //Convert boost duty (Which is a % multipled by 100) to a pwm count
|
||||
ENABLE_BOOST_TIMER(); //Turn on the compare unit (ie turn on the interrupt) if boost duty >0
|
||||
}
|
||||
currentStatus.flexBoostCorrection = 0;
|
||||
}
|
||||
|
||||
if(currentStatus.boostTarget > 0)
|
||||
{
|
||||
//This only needs to be run very infrequently, once every 16 calls to boostControl(). This is approx. once per second
|
||||
if( (boostCounter & 15) == 1)
|
||||
{
|
||||
boostPID.SetOutputLimits(configPage2.boostMinDuty, configPage2.boostMaxDuty);
|
||||
|
||||
if(configPage6.boostMode == BOOST_MODE_SIMPLE) { boostPID.SetTunings(100, 100, 100); }
|
||||
else { boostPID.SetTunings(configPage6.boostKP, configPage6.boostKI, configPage6.boostKD); }
|
||||
}
|
||||
|
||||
bool PIDcomputed = boostPID.Compute(); //Compute() returns false if the required interval has not yet passed.
|
||||
if(currentStatus.boostDuty == 0) { DISABLE_BOOST_TIMER(); BOOST_PIN_LOW(); } //If boost duty is 0, shut everything down
|
||||
else
|
||||
{
|
||||
if(PIDcomputed == true)
|
||||
{
|
||||
boost_pwm_target_value = ((unsigned long)(currentStatus.boostDuty) * boost_pwm_max_count) / 10000; //Convert boost duty (Which is a % multipled by 100) to a pwm count
|
||||
ENABLE_BOOST_TIMER(); //Turn on the compare unit (ie turn on the interrupt) if boost duty >0
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//If boost target is 0, turn everything off
|
||||
boostDisable();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//If boost target is 0, turn everything off
|
||||
//Boost control does nothing if kPa below the hyster point
|
||||
boostDisable();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Boost control does nothing if kPa below the hyster point
|
||||
boostDisable();
|
||||
}
|
||||
} //MAP above boost + hyster
|
||||
} //Open / Cloosed loop
|
||||
}
|
||||
else { // Disable timer channel and zero the flex boost correction status
|
||||
DISABLE_BOOST_TIMER();
|
||||
|
|
|
@ -153,23 +153,26 @@
|
|||
#define HARD_CUT_FULL 0
|
||||
#define HARD_CUT_ROLLING 1
|
||||
|
||||
#define SIZE_BYTE 8
|
||||
#define SIZE_INT 16
|
||||
#define SIZE_BYTE 8
|
||||
#define SIZE_INT 16
|
||||
|
||||
#define EVEN_FIRE 0
|
||||
#define ODD_FIRE 1
|
||||
#define EVEN_FIRE 0
|
||||
#define ODD_FIRE 1
|
||||
|
||||
#define EGO_ALGORITHM_SIMPLE 0
|
||||
#define EGO_ALGORITHM_PID 2
|
||||
|
||||
#define STAGING_MODE_TABLE 0
|
||||
#define STAGING_MODE_AUTO 1
|
||||
#define STAGING_MODE_AUTO 1
|
||||
|
||||
#define RESET_CONTROL_DISABLED 0
|
||||
#define RESET_CONTROL_PREVENT_WHEN_RUNNING 1
|
||||
#define RESET_CONTROL_PREVENT_ALWAYS 2
|
||||
#define RESET_CONTROL_SERIAL_COMMAND 3
|
||||
|
||||
#define OPEN_LOOP_BOOST 0
|
||||
#define CLOSED_LOOP_BOOST 1
|
||||
|
||||
#define MAX_RPM 18000 //This is the maximum rpm that the ECU will attempt to run at. It is NOT related to the rev limiter, but is instead dictates how fast certain operations will be allowed to run. Lower number gives better performance
|
||||
#define engineSquirtsPerCycle 2 //Would be 1 for a 2 stroke
|
||||
|
||||
|
@ -512,7 +515,7 @@ struct config4 {
|
|||
|
||||
byte StgCycles; //The number of initial cycles before the ignition should fire when first cranking
|
||||
|
||||
byte dwellCont : 1; //Fixed duty dwell control
|
||||
byte boostType : 1; //Open or closed loop boost control
|
||||
byte useDwellLim : 1; //Whether the dwell limiter is off or on
|
||||
byte sparkMode : 3; //Spark output mode (Eg Wasted spark, single channel or Wasted COP)
|
||||
byte triggerFilter : 2; //The mode of trigger filter being used (0=Off, 1=Light (Not currently used), 2=Normal, 3=Aggressive)
|
||||
|
|
|
@ -1897,12 +1897,17 @@ static inline byte getAdvance()
|
|||
//Speed Density
|
||||
currentStatus.ignLoad = currentStatus.MAP;
|
||||
}
|
||||
else
|
||||
else if(configPage2.ignAlgorithm == LOAD_SOURCE_TPS)
|
||||
{
|
||||
//Alpha-N
|
||||
currentStatus.ignLoad = currentStatus.TPS;
|
||||
|
||||
}
|
||||
else if (configPage2.fuelAlgorithm == LOAD_SOURCE_IMAPEMAP)
|
||||
{
|
||||
//IMAP / EMAP
|
||||
currentStatus.ignLoad = (currentStatus.MAP * 100) / currentStatus.EMAP;
|
||||
}
|
||||
tempAdvance = get3DTableValue(&ignitionTable, currentStatus.ignLoad, currentStatus.RPM) - OFFSET_IGNITION; //As above, but for ignition advance
|
||||
tempAdvance = correctionsIgn(tempAdvance);
|
||||
|
||||
|
|
|
@ -125,14 +125,17 @@ void doUpdates()
|
|||
EEPROM.write(EEPROM_DATA_VERSION, 8);
|
||||
}
|
||||
|
||||
if (EEPROM.read(EEPROM_DATA_VERSION) == 8)
|
||||
if (EEPROM.read(EEPROM_DATA_VERSION) == 8)
|
||||
{
|
||||
//May 2018 adds separate load sources for fuel and ignition. Copy the existing load alogirthm into Both
|
||||
configPage2.fuelAlgorithm = configPage2.unused2_38c;
|
||||
configPage2.ignAlgorithm = configPage2.unused2_38c;
|
||||
|
||||
//Add option back in for open or closed loop boost. For all current configs to use closed
|
||||
configPage4.boostType = 1;
|
||||
|
||||
writeAllConfig();
|
||||
EEPROM.write(EEPROM_DATA_VERSION, 8);
|
||||
EEPROM.write(EEPROM_DATA_VERSION, 9);
|
||||
}
|
||||
|
||||
//Final check is always for 255 and 0 (Brand new arduino)
|
||||
|
|
|
@ -51,6 +51,7 @@ byte pinTranslate(byte rawPin)
|
|||
return outputPin;
|
||||
}
|
||||
|
||||
|
||||
void setResetControlPinState()
|
||||
{
|
||||
BIT_CLEAR(currentStatus.status3, BIT_STATUS3_RESET_PREVENT);
|
||||
|
|
Loading…
Reference in New Issue