Allow min and max duty cycles for closed loop idle and boost

This commit is contained in:
Josh Stewart 2017-02-20 17:57:46 +11:00
parent a881ddc405
commit 0d055dc7f1
4 changed files with 97 additions and 80 deletions

View File

@ -199,24 +199,27 @@ page = 2
dutyLim = scalar, U08, 40, "%", 1.0, 0.0, 0.0, 100.0, 0
flexFreqLow = scalar, U08, 41, "Hz", 1.0, 0.0, 0.0, 250.0, 0
flexFreqHigh = scalar, U08, 42, "Hz", 1.0, 0.0, 0.0, 250.0, 0
taeColdM = scalar, U08, 43, "%", 1.0, 0.0, 0.0, 250.0, 0
tpsMin = scalar, U08, 44, "ADC", 1.0, 0.0, 0.0, 255.0, 0
tpsMax = scalar, U08, 45, "ADC", 1.0, 0.0, 0.0, 255.0, 0
mapMin = scalar, U08, 46, "kpa", 1.0, 0.0, 0.0, 255.0, 0
mapMax = scalar, U16, 47, "kpa", 1.0, 0.0, 0.0, 25500, 0
fpPrime = scalar, U08, 49, "s", 1.0, 0.0, 0.0, 255.0, 0
stoich = scalar, U08, 50, ":1", 0.1, 0.0, 0.0, 25.5, 1
oddfire2 = scalar, U16, 51, "deg", 1.0, 0.0, 0.0, 720, 0 ; * ( 2 byte)
oddfire3 = scalar, U16, 53, "deg", 1.0, 0.0, 0.0, 720, 0 ; * ( 2 byte)
oddfire4 = scalar, U16, 55, "deg", 1.0, 0.0, 0.0, 720, 0 ; * ( 2 byte)
flexFuelLow = scalar, U08, 57, "%", 1.0, 0.0, 0.0, 250.0, 0
flexFuelHigh = scalar, U08, 58, "%", 1.0, 0.0, 0.0, 250.0, 0
flexAdvLow = scalar, U08, 59, "Deg", 1.0, 0.0, 0.0, 250.0, 0
flexAdvHigh = scalar, U08, 60, "Deg", 1.0, 0.0, 0.0, 250.0, 0
unused2-61 = scalar, U08, 61, "RPM", 100.0, 0.0, 100, 25500, 0
unused2-62 = scalar, U08, 62, "RPM", 100.0, 0.0, 100, 25500, 0
unused2-63 = scalar, U08, 63, "RPM", 100.0, 0.0, 100, 25500, 0
tpsMin = scalar, U08, 43, "ADC", 1.0, 0.0, 0.0, 255.0, 0
tpsMax = scalar, U08, 44, "ADC", 1.0, 0.0, 0.0, 255.0, 0
mapMin = scalar, U08, 45, "kpa", 1.0, 0.0, 0.0, 255.0, 0
mapMax = scalar, U16, 46, "kpa", 1.0, 0.0, 0.0, 25500, 0
fpPrime = scalar, U08, 48, "s", 1.0, 0.0, 0.0, 255.0, 0
stoich = scalar, U08, 49, ":1", 0.1, 0.0, 0.0, 25.5, 1
oddfire2 = scalar, U16, 50, "deg", 1.0, 0.0, 0.0, 720, 0 ; * ( 2 byte)
oddfire3 = scalar, U16, 52, "deg", 1.0, 0.0, 0.0, 720, 0 ; * ( 2 byte)
oddfire4 = scalar, U16, 54, "deg", 1.0, 0.0, 0.0, 720, 0 ; * ( 2 byte)
flexFuelLow = scalar, U08, 56, "%", 1.0, 0.0, 0.0, 250.0, 0
flexFuelHigh = scalar, U08, 57, "%", 1.0, 0.0, 0.0, 250.0, 0
flexAdvLow = scalar, U08, 58, "Deg", 1.0, 0.0, 0.0, 250.0, 0
flexAdvHigh = scalar, U08, 59, "Deg", 1.0, 0.0, 0.0, 250.0, 0
iacCLminDuty = scalar, U08, 60, "%", 1.0, 0.0, 0.0, 100.0, 0 ; Minimum and maximum duty cycles when using closed loop idle
iacCLmaxDuty = scalar, U08, 61, "%", 1.0, 0.0, 0.0, 100.0, 0
boostMinDuty = scalar, U08, 62, "%", 1.0, 0.0, 0.0, 100.0, 0 ; Minimum and maximum duty cycles for boost control
boostMaxDuty = scalar, U08, 63, "%", 1.0, 0.0, 0.0, 100.0, 0
;--------------------------------------------------
;Start Ignition table (Page 3)
@ -671,6 +674,10 @@ page = 10
requiresPowerCycle = oddfire2
requiresPowerCycle = oddfire3
requiresPowerCycle = oddfire4
requiresPowerCycle = iacCLminDuty
requiresPowerCycle = iacCLmaxDuty
requiresPowerCycle = boostMinDuty
requiresPowerCycle = boostMaxDuty
defaultValue = pinLayout, 1
defaultValue = TrigPattern, 0
@ -702,6 +709,10 @@ page = 10
defaultValue = flexAdvHigh, 13
defaultValue = fuelPumpPin, 0
defaultValue = fanPin, 0
defaultValue = iacCLminDuty, 0
defaultValue = iacCLmaxDuty, 100
defaultValue = boostMinDuty, 0
defaultValue = boostMaxDuty, 100
[Menu]
@ -847,14 +858,15 @@ menuDialog = main
iacStepTime = "Time between each stepper motor step.\nIncrease this if the motor appears to behave intermittently."
iacStepHome = "On startup the stepper motor moves this many steps to return to its home position. Set this value to a few more than the actual number to ensure the motor has returned to its full position."
iacStepHyster = "The minimum number of steps to move in any one go."
iacAlgorithm = "Selects method of idle control.\nNone = no idle control valve.\nOn/Off valve.\nPWM valve (2,3 wire).\nStepper Valve (4,6,8 wire)."
iacPWMdir = "Normal PWM valves increase RPM with higher duty. If RPM decreases with higher duty then select Reverse"
iacCLminDuty= "When using closed loop idle control, this is the minimum duty cycle that the PID loop will allow. Combined with the maximum value, this specifies the working range of your idle valve
iacCLmaxDuty= "When using closed loop idle control, this is the maximum duty cycle that the PID loop will allow. Combined with the minimum value, this specifies the working range of your idle valve
oddfire2 = "The ATDC angle of channel 2 for oddfire engines. This is relative to the TDC angle of channel 1"
oddfire3 = "The ATDC angle of channel 3 for oddfire engines. This is relative to the TDC angle of channel 1 (NOT channel 2)"
oddfire4 = "The ATDC angle of channel 4 for oddfire engines. This is relative to the TDC angle of channel 1 (NOT channel 3)"
iacAlgorithm = "Selects method of idle control.\nNone = no idle control valve.\nOn/Off valve.\nPWM valve (2,3 wire).\nStepper Valve (4,6,8 wire)."
iacPWMdir = "Normal PWM valves increase RPM with higher duty. If RPM decreases with higher duty then select Reverse"
dfcoRPM = "The RPM above which DFCO will be active. Typically set a few hundred RPM above maximum idle speed"
dfcoHyster = "Hysteresis for DFCO RPM. 200-300 RPM is typical for this, however a higher value may be needed if the RPM is fluctuating around the cutout speed"
dfcoTPSThresh= "The TPS value below which DFCO will be active. Typical value is 5%-10%, but higher may be needed if TPS signal is noisy"
@ -1071,6 +1083,8 @@ menuDialog = main
field = "P", idleKP, { iacAlgorithm == 3 }
field = "I", idleKI, { iacAlgorithm == 3 }
field = "D", idleKD, { iacAlgorithm == 3 }
field = "Minimum valve duty", iacCLminDuty, { iacAlgorithm == 3 }
field = "Maximum valve duty", iacCLmaxDuty, { iacAlgorithm == 3 }
dialog = idleSettings, "Idle Settings"
topicHelp = "http://speeduino.com/wiki/index.php/Idle"
@ -1215,6 +1229,8 @@ menuDialog = main
field = "P", boostKP, { boostEnabled }
field = "I", boostKI, { boostEnabled }
field = "D", boostKD, { boostEnabled }
field = "Valve minimum duty cycle", boostMinDuty, { boostEnabled }
field = "Valve maximum duty cycle", boostMaxDuty, { boostEnabled }
dialog = vvtSettings, "VVT Control"
field = "VVT Control Enabled", vvtEnabled

View File

@ -48,7 +48,7 @@ void initialiseAuxPWM()
//TIMSK1 |= (1 << OCIE1A); //Turn on the A compare unit (ie turn on the interrupt) //Shouldn't be needed with closed loop as its turned on below
TIMSK1 |= (1 << OCIE1B); //Turn on the B compare unit (ie turn on the interrupt)
boostPID.SetOutputLimits(0, boost_pwm_max_count);
boostPID.SetOutputLimits(percentage(configPage1.boostMinDuty, boost_pwm_max_count) , percentage(configPage1.boostMaxDuty, boost_pwm_max_count));
boostPID.SetTunings(configPage3.boostKP, configPage3.boostKI, configPage3.boostKD);
boostPID.SetMode(AUTOMATIC); //Turn PID on

View File

@ -279,7 +279,6 @@ struct config1 {
byte dutyLim;
byte flexFreqLow; //Lowest valid frequency reading from the flex sensor
byte flexFreqHigh; //Highest valid frequency reading from the flex sensor
byte taeColdM;
byte tpsMin;
byte tpsMax;
byte mapMin;
@ -293,9 +292,11 @@ struct config1 {
byte flexFuelHigh; //Fuel % to be used for the highest ethanol reading (Typically 163%)
byte flexAdvLow; //Additional advance (in degrees) at lowest ethanol reading (Typically 0)
byte flexAdvHigh; //Additional advance (in degrees) at highest ethanol reading (Varies, usually 10-20)
byte unused61;
byte unused62;
byte unused63;
byte iacCLminDuty;
byte iacCLmaxDuty;
byte boostMinDuty;
byte boostMaxDuty;
};

View File

@ -74,7 +74,7 @@ void initialiseIdle()
idle2_pin_port = portOutputRegister(digitalPinToPort(pinIdle2));
idle2_pin_mask = digitalPinToBitMask(pinIdle2);
idle_pwm_max_count = 1000000L / (16 * configPage3.idleFreq * 2); //Converts the frequency in Hz to the number of ticks (at 16uS) it takes to complete 1 cycle. Note that the frequency is divided by 2 coming from TS to allow for up to 512hz
idlePID.SetOutputLimits(0, idle_pwm_max_count);
idlePID.SetOutputLimits(percentage(configPage1.iacCLminDuty, idle_pwm_max_count), percentage(configPage1.iacCLmaxDuty, idle_pwm_max_count));
idlePID.SetTunings(configPage3.idleKP, configPage3.idleKI, configPage3.idleKD);
idlePID.SetMode(AUTOMATIC); //Turn PID on
break;