Learning how to tune a PID loop is a lot easier than you might think. Here's a self-guided course, complete with helpful examples and a free teaching aid.
Closed-loop motion controllers are top performers. They are used in virtually every industry segment when applications demand the highest precision or speed. That performance comes at a cost, however.
Closed-loop controllers must be tuned, a process in which several "gains" are adjusted to achieve optimal dynamic performance. If you're relatively new to motion control, or haven't done it in a while, the concept of tuning may seem somewhat mysterious, even intimidating. But don't fret.
In about 20 minutes, this article will provide you with a good review of PID control, including a practical tuning procedure. If you're the hands-on sort, you can download a simulated PID controller from the Internet and observe the effect of tuning firsthand. When you're done, you might not be an expert, but you will be much clearer on one of the most misunderstood areas of motion control.
Around the loop
Every closed-loop system consists of three components: a controller, a "plant," and a feedback device. The plant is the mechanism being controlled. It might be a temperature bath, a pressure chamber or, as in this case, a motor and load.
The controller's job is fairly simple. It compares the command and feedback (sensor) signals and, after some processing, sends a control signal to the plant. The processing can take many forms, the most common form being a "PID loop." PID controllers are so named because they combine proportional (P), integral (I), and derivative (D) signals.
Like most controllers, a PID loop works off an error signal. In a velocity control system, the "error" would be the difference between commanded and measured velocity.
In the forward path, the error signal is integrated and scaled by the gain KI. The result is summed with the original error signal and scaled by the proportional gain KP to produce the current command. This signal proceeds to the "plant," which incorporates the current controller and motor as well as the feedback device, in this case, a tachometer.
A differentiator in the feedback path, along with a gain function, KD, generates the derivative term. Note that the differential gain appears only in the feedback path. Such topology is common in velocity controllers because it limits overshoot; in the forward path, a derivative term would likely produce a lot of overshoot in response to step (square wave) commands.
Each gain in a PID loop has a different function. The proportional gain, KP, in correct measure, provides stability as well as "growing room" for the other gains. If it gets too large, however, cover your ears because your machine is going to make a lot of noise. If it gets larger still, head for cover because the system will become unstable.
The effect of the integral term is to make the system stiff. In other words, a large KI makes it difficult for torque disturbances to move the shaft. Be careful, though, because the gain can become too large, generating a lot of overshoot.
This is where the differential term comes in. By damping the system, the gain KD can eliminate much of the overshoot caused by KI. But too much KD can cause high-frequency oscillations.
Getting in tune
Finding the optimum gain settings can be a tedious process because each variable influences the effect of the other two. And if you don't have a plan when you start fiddling with things, you can quickly get into trouble.
The key to adjusting gains efficiently is to use a process that decouples, as much as possible, the effects of one gain term from another. Here's a process that's easy to implement and works well in most cases:
•Set all gains to zero.
•Apply a square-wave command.
•Raise KP until the system begins to overshoot.
•Raise KI until overshoot is approximately 15%.
•Raise KD to remove some of the overshoot.
Continue to next page
If you apply this process to the simulated system, you should end up with the following gains: KP = 1.3, KI = 100, and KD = 0.0005.
As you experiment with the simulator, you'll notice that the integral gain produces overshoot that cannot be completely removed. However, most velocity controllers don't need to respond to square-wave commands as used in the simulation. Typically, the commands are from a position controller that generates signals which are much gentler than a square wave. In other words, all overshoot does not need to be removed.
Also worth noting is that if you don't need integral gain, don't use it. Integral gain removes long-term error, but if that's not important for the application, don't expose the system needlessly to the problems related to KI, chiefly overshoot.
When tuning a PID loop, you also need to be aware of noise and resonance. Motion controllers produce and are susceptible to noise. Resonance, a common occurrence when a motor and load connect by a compliant shaft or belt system, often leads to oscillation, which can spell disaster in many applications. Backing off on KP and KD can mitigate noise and resonance problems; KI doesn't have much of an effect.
Practice, practice, practice
The best way to learn, of course, is by doing. If you want to learn more about loop tuning, you can download the simulator used in the previous examples. The package, called ModelQ, was designed to help teach the principles of control. It runs on Windows 95, Windows 98, and Windows NT, and is available at no charge on www.ptdesign.com.
After installation, click on "Run" and select the "Constants" tab, and you can start adjusting loop gains immediately. If you have questions, refer to the integrated help manual.
In case you're wondering how useful it is to learn on a simulation tool, you should know that ModelQ has been compared to a real motor system and the results have been proven in field equipment.
George Ellis is a Senior Scientist at Kollmorgen Inc., Radford, Va. He also teaches motion control, including a one-day seminar, "How to Improve Servo Systems." For dates and locations, see PT Planner.
Sealing cellophane in food packaging
Suppose you had to select and tune a PID controller for a sealing station on a food packaging machine. Where would you start? The best place is the application.
Here, baked goods travel on a conveyor and are wrapped in a continuous roll of cellophane. The cellophane is joined across the top of the baked good and then sealed by two heated wheels. When the cellophane reaches the wheels, it is drawn between them and the heat fuses the two sides together.
Keeping the wheels in synch with the belt requires a controller with minimal long-term error – that is, one with an integral gain. Furthermore, because the wheels run at constant speed, the velocity command hardly changes, so there's no need for a derivative term. In other words, it's okay to overshoot a square wave because the system is not likely to see any.
To properly set the gains requires some knowledge about the machine itself. It turns out that when the cellophane is drawn into the wheels, it frequentlykinks, increasing the load on the motors. To keep the wheels at constant speed, the tuning parameters KP and KI should be set as high as possible.