Last month in *Tune Up* we learned about cascaded position-velocity loops, and we developed a simple procedure for tuning them. This month we analyze another common positioning method, proportional-integral- differential, or PID, control.

A position controller works by comparing position commands to position feedback signals, and then calculating the position error, PE. In a PID loop, this signal is then used to generate the current command based on three gains – PE is scaled by the proportional gain *K _{PP}*, the integral of PE is scaled by the integral gain

*K*, and the derivative of PE is scaled by the derivative gain

_{PI}*K*.

_{PD}Tuning a PID position loop can be challenging because there are three servo gains and each plays a different role. Once you understand those roles, however, you can tune the gains independently, saving time, ensuring consistency, and maintaining stability with improvements in command response.

As with cascaded position-velocity control, each of the PID position controller gains operates in one of three frequency “zones.” Think of the position command as being composed of many frequency components. The derivative gain *K _{PDP}* responds to the highest zone, frequency components between about 30 and 100 Hz. The proportional gain

*K*addresses commands from 10 to 30 Hz, while the position-loop gain covers all frequencies below that.

_{PP}The best place to start the tuning process is the highest frequency zone. First eliminate the lower zones by zeroing *K _{PI}* and, if possible,

*K*. Many PID controllers do not allow

_{PP}*K*to be zeroed. If that’s the case, fix

_{PP}*K*at a fairly low value while tuning

_{PP}*K*.

_{PD}Next, prepare a trapezoidal point-to-point velocity profile. These commands have three segments: acceleration, cruise, and deceleration. When tuning Zone 1, you should set the acceleration and deceleration rates to their maximum controller values. In fact, a square velocity command (unlimited acceleration) is ideal.

If not enough power is available to produce the command response, the controller may saturate, requiring you to lower peak velocity. Usually a top speed of 0 to 250 rpm works well.

The next step is to raise the derivative gain to the highest possible value before overshoot appears in the velocity response. Note that if you cannot zero the proportional gain *K _{PP}*, expect some overshoot for a square wave. Overshoot from

*K*occurs on a much shorter time scale and is easy to distinguish from overshoot caused by

_{PD}*K*. When you have a response with minimal overshoot, your differential gain is tuned.

_{PP}Zone 1 is the hardest zone to tune mainly because *K _{PD}* tends to excite resonance (October, 1999) and audible noise (July, 1999). Low-pass filters can offset these effects, but they also cause instability and force servo gains lower.

To tune the proportional gain, first modify the position command. Lower the acceleration and deceleration rates to within the highest values that the controller will employ during normal operation. Raise the integral gain until a slight amount of overshoot is visible, and then decrease *K _{PP}* to eliminate overshoot. When you reach this point,

*K*and

_{PD}*K*are tuned.

_{PP}The final zone to tune involves the position- loop integral gain. Tuning this gain is difficult because of its high sensitivity to overshooting. Fortunately, several methods have been developed to deal with this shortcoming.

First, many controllers let you clamp the maximum current commanded by the integral term. The primary reason to use integral gain is to overcome frictional loads, thus there is no need for the current generated by *K _{PI}* to exceed the maximum load capacity.

Another way of dealing with overshoot is to force the integral term to zero anytime the motor is commanded to move. When motion stops, the integral term is reinstated to cover the low-frequency zone. Like the clamping method, this allows higher peak values of integral gain than normally possible.

### Tuning with PID

Want to tune a PID position loop yourself? Then log onto www.motionsystemdesign.com and download this month’s ModelQ simulation program. Launch the program, select August’s model, and click “Run.” You should be looking at the response with just the derivative gain (*K _{PD}*). The value is set a little low (0.6), so raise it until the response signal just overshoots, and then reduce the gain to eliminate the small amount of overshoot (

*K*= 1.1).

_{PD}Next, select a trapezoidal velocity command by choosing “Trapezoid” in the waveform generator at bottom left. Raise KPP to the highest value that does not cause overshoot (*K _{PP}* = 10), and then raise

*K*to 5 to get a complete set of PID tuning gains.

_{PI}*George Ellis is a Senior Scientist at Kollmorgen. His book, “Control System Design Guide,” 2 ^{nd} edition, was published in May, 2000 by Academic Press. He can be reached at [email protected].*