Forums

Tuning PID controllers

Started by Tim Wescott 6 years ago4 replieslatest reply 6 years ago220 views

Yet another video on tuning PID controllers has been tossed into the YouTube pool.

[ - ]
Reply by Joe_WestJuly 7, 2016

While I strongly agree with your "when it's good enough, STOP!" comment, my own preference for which order to adjust things in is different from yours. 

I'm curious as to why you start with derivative gain.

I like to start with proportional gain, taking it up to where there is substantial ringing in response to a step-change in target position, but not oscillation. Then increase the derivative gain until the ringing is acceptably small (perhaps along the way reducing proportional by a factor of 2, as you suggest), finally increasing integral gain. (Yes I like to make use "anti-windup" for the integrated error. But as you state, that's a topic for another day.)

I also completely agree with your comment about the differentiator being a "noise amplifier". At least for the simple ones encountered in text books. But I've had very good results from the Lyons differentiator algorithm (available on DSPrelated). Have you tried that one?

Finally, my own experience is that there is NOT a simple proportionality between derivative gain and proportional gain as you seem to suggest in the video. It all depends on the "plant" characteristics, including motor characteristics and inertial load. Can you explain why you think there is a simple "optimal" ratio between proportional and derivative gains for all systems?

Thanks,

Joe

[ - ]
Reply by Tim WescottJuly 7, 2016

"I like to start with proportional gain"

That can result in a seriously under-performing system in a lot of cases.  If you have a plant that acts like a double integrator, then proportional gain will just make it oscillate no matter what (see my "PID Without a PhD" blog here).  If the plant acts like an integrator followed by a single-order low-pass, or like a double-order low-pass, then proportional control alone will often make it oscillate at a much lower frequency than can be had with derivative tuned my way.        

"But I've had very good results from the Lyons differentiator algorithm..."

That differentiator will lose a lot of phase shift for the gain.  In a differentiator, leading phase is good, but excess gain is bad (which is why the band-limit differentiator).  Rick's differentiator gives a very clean gain vs. frequency characteristic, but if you plot the phase change vs. frequency I think you'll see that it's not nearly as good as a plain old first-order bandlimited differentiator.

Before steam starts blowing out of anyone's ears -- Rick's differentiator looks like a very good one for signal processing and data analysis where delay is not important.  But in a control loop, managing delay is critical to getting a good response, to the point where you can sacrifice a great deal of "pretty" from the amplitude response and still come out ahead.  So if I were doing something off-line or open-loop and needed a differentiator with a clean amplitude response, I hope that I remember Rick's.

"Finally, my own experience is that there is NOT a simple proportionality..."

If I left you with that impression it was a fault in the presentation.  I do mention starting with a proportional gain of 1% of the derivative gain -- but that's only to establish a starting point, to encourage those viewers who are the sort to stand at the edge of the pool for fear that the water is too cold or too hot rather than just jumping in and finding out.


[ - ]
Reply by MichaelRWJuly 7, 2016

Hello.  Could you provide background information on your balance arm system?

[ - ]
Reply by Tim WescottJuly 7, 2016

I'm not sure if this is what you want, but:

I built it, purely to provide an inexpensive, easy-to-manufacture control system trainer.  At one point I had ambitions to give control systems seminars, and to send a trainer home with each participant.  That ambition hasn't been realized -- but I still have the trainer.

It's basically a propeller on a stick (well, arm if you don't want to sound too down home), with a pivot and a counterweight.  There's a circuit board on the back that has a pot on it that measures the arm position, a processor that computes control values and drives PWM signals, and an H-bridge that drives the motor.  I measure the motor current (more on that in another video) to close a loop around the motor speed, and the whole shebang does what you see there.

I should do a video on the trainer itself, I think -- just a video tour.

I talk a bit about it in my "what is a PID" video -- start at about 20 seconds in: