GenBoard uses PID control for various solanoids (IAC, Boost Control, etc...) this page describes some strategies for tuning pid controllers as well as link to pages that provide some more insight about the subject
First, we test the solenoid and engine's reaction (for the given setup and config) by forcing certain IAC duty. This happens with the mdi.. command (memorize as menu debug iac .. where .. is the 2 digit hexa number from 01 to FF. 00 is special, it enabled automatic control).
Using this cuts down to IAC tuning to about 1/10th.
This can happen from directly attached keyboard, serial TerminalProgram or MegaTune embedded terminal. Remember to issue Man to enter manual text-command mode, and bye to leave back to MegaTune mode so MegaTune can communicate. See GenBoard/MenuSystem. Maybe MegaTune is now capable to issue such commands from a simple (even non-hexadecimal) user-input into a field ?
The idea is to find out the
- necessary duty to maintain target RPM (at given temp: remember this is temp dependent, there are 10 bins). These are called the reference positions. The algorithm will be allowed to deviate from the reference position with a certain amount, max deviation is (can be) different in the + and - direction, and is determined by
- the PID integral (I) term, and (effects both direction)
- iac integral decrease limit only effects - direction. Very handy! See below
- iac integral increase limit only effects + direction. Usually close to 0. The iac should only need to go above the reference position when AC compressor is ON, and the big fan at max RPM
- slope of the duty vs RPM
Force IAC duty that maintains 200..400 RPM higher than your target. Set the reference position to this. The PID integral will operate in the negative region. That's why iac integral decrease limit is important to prevent stalling. iac integral increase limit can be (and sometimes need to be, to prevent oscillation) close to zero: the iac should only need to go above the reference position when AC compressor is ON, and the big fan at max RPM.
If the engine RPM does not consistently and monotonously (higher forced duty => higher RPM) react to forced IAD duty, you'll NOT be able to tune the PID so don't waste your time with it: go back check the wiring, config and IAC and anything related.
Also, if there is too much air leaking into the engine at mdi01 (minimal forced duty), resulting in higher than target RPM, the air-based IAC control is obviously not capable to reach the target (regulating power with ignadv or event skipping is still possible, but configuring those is NOT covered here).
Initially use PID I=0 and D=0 so only the P term of the PID has effect.
slope of the duty vs RPM => PID P term
- mdi7E maintains RPM=1200
- mdi60 maintains RPM=800
This means the slope is 30 steps (0x7E - 0x60 = 0x1E = 30; remember the mdi.. is in hexadecimal) for 400 RPM (1200-800).
For a higher valve, or smaller engine, this value is lower (less steps needed for same RPM change).
iac_kp (PID kp term) will be set proportional to this (TODO: calculate constant multiplier - assigned to Lezsak Gergely ;-).
In effect, with an error (error = current_RPM - target_RPM) '''of 400 RPM, the PID P term will command 15 steps. The PID I term will be responsible for the other 15 steps (30 required in the example).
PID I and D terms
Now, with the P term adjusted scientifically, you'll likely tune the I and D term with experimenting. This takes 1/10 of the time than with an unknown P value. If the RPM starts oscillating, some of the PID parameters is too high (often the D).
The iac integral decrease limit and iac integral increase limit must be higher than 0 to allow the PID I term to react. Since these terms will be finetuned after the I term, initially use guesstimate values such as 32 and 50 respectively.
iac integral decrease limit
If this is too low (such as 0), your engine will not be able to reach the target RPM (remember we set reference position to 200..400 RPM higher than target: it will not go much below that).
- Start from 0 and raise it until the controller can reach target RPM.
- If you set iac integral decrease limit too high, (especially if the PID D-term is also not tuned perfectly), the engine RPM will fall too low and this is disturbing: or might not recover at all (and stall).
Unfortunately the iac integral decrease limit user-input is currently NOT expressed in RPM or IAC duty. MegaTune could do the conversion
- for userinput in IAC-duty, it would be simple: iac_integral_limit_dec = const * iac_ilimit_dec_expressed_in_duty / iac_ki
- for userinput in RPM, the user would also have to enter the slope of the duty vs RPM, which is useful anyway, since from that, MegaTune could also calculate iac_kp (multiply with constant).
Ignition advance based idle control
Initially disable this. At the very end, this can be used to smooth out a bit. We've seen racecars that maintained quite good idle with ignition advance based idle control (event skipping is also implemented now for much higher power-reduction capability, mostly useful for launch and ALS) but remember this is not as efficient as air-based, so apply proper airvalve for daily driven cars.
More info about pid controllers in general
Found this page today that has a great simulator program for MS Excel <its too bad they want $45 USD for it> http://www.learncontrol.com/simulation/
I found this picture was a great aid to understanding the principle behind Proportional (Gain)
The more you increase the gain the greater the scale of the reaction will be.
Some tuning strategies are shown here: http://www.learncontrol.com/tutorial/pid6.html
PID control of a home brewing plant with some nice general PID tuning and algorithm info: http://home.hccnet.nl/e.vd.logt/htm/regelen_pid_uk.htm
See Also: PidController - a related and otherwise orphaned page.