Page 11 of 11

Re: PID control discussion

Posted: Mon Nov 03, 2008 12:41 am
by gearhead
The one thing to consider is what Ken said. He calls it setting DC directly. What it needs to do is know the max and min output values and start its loop with these values. If there is a bias curve or if a known good value is used as a starting point is not really that important.

A portable PID loop could be written like this, IMO. Basically pass a SV, PV and the appropriate constants (Kp, Ki, Kd) and let it respond with a 'percentage' as ken calls it or a proportionality that is resolved back up in the main code to generate an output value that makes sense for the reason the loop is called.

One thing I learned from reading the Saab Trionic tuning guide and from some personal experimentation is that the Kp, Ki, Kd may not be 'constants'. Due to whatever else is going on, these may vary according to a separate variable (MAT or CLT for example). If these values are passed to a subroutine, this complication can also be accommodated if necessary.

Gearhead

Re: PID control discussion

Posted: Fri Oct 28, 2011 6:44 pm
by Jean-Louis
Hey,
I think :oops: that there is some problems whith the implementation :
1) long constants should be long (L)...
2) it's better to do a center point derivative approximation to minimize the high frequency noise (ztrans_idle_error_array[0] - ztrans_idle_error_array[2] )
3) its not a good idea to have PID_SCALE_FACTOR = 125. 128 is better because the compiler optimize the divide whith shifts
4) it's better to apply the PID_SCALE_FACTOR after the final add, and if its possible, with a correct rounding...
5) i think that if tmp1 is a 16bit integer, there is no need to disable the interrupts

Re: PID control discussion

Posted: Fri Nov 04, 2011 10:57 am
by Fred
Jean-Louis, sorry for the delay in approving your post! And, thanks for your feedback! :-)

Re: PID control discussion

Posted: Thu Dec 22, 2011 7:42 pm
by Faststang
AbeFM wrote:The two places they use it, which are reasonable places if not great, are boost solenoid control and idle control.
All late model (1999+?) returnless fuel systems use PID control for the fuel pump.

Re: PID control discussion

Posted: Thu Dec 22, 2011 8:05 pm
by Faststang
Fred wrote: "dashpot" whatever the fuck that is
I believe the term was taken from an old mechanical device commonly called dashpot.
http://en.wikipedia.org/wiki/Dashpot

Based on my tuning experience dashpot delays IAC movement and causes the rpm to slowly settle in to it's idle setpoint when decelerating. Increasing dashpot also seems to increase the time required for rpm to initially start dropping to setpoint. I also notice, on Fords, it hovers about 500rpm higher then idle setpoint for a longer period of time before ultimately dropping to idle rpm setpoint. Frankly, IMHO, it sucks and works poorly, at least on the Ford engines I have played with. PID, without overshoot, would probably be a better solution as dashpot doesn't seem to work well or make any discernable difference except for adding time delay before settling into idle. Only problem is that you need to be an engineer to tune a PID properly. It isn't easy, those that can't tune it, just don't know, but it does work. I needed to enlist the help of an engineer at WeaponX, to help with PID for my aftermarket 255lph fuel pump after watching the wild fuel pressure swings after installing a Fuel Rail Pressure sensor, nightmare! His comment was, every loop will tune differently depending on the losses "feedforward tables" in the system. So some typical methods won't work 110% every time unless those feedforward loops are good and are set in stone.

Re: PID control discussion

Posted: Tue Dec 27, 2011 5:26 am
by gearhead
Faststang wrote:
AbeFM wrote:The two places they use it, which are reasonable places if not great, are boost solenoid control and idle control.
All late model (1999+?) returnless fuel systems use PID control for the fuel pump.
Don't forget clo2 as well. Only when you use a wide band sensor, though.

Basically any control loop with a target can use pid. Sometimes all that is needed is pi. Sometimes pid is required.

Gearhead