Getting the most out of servocontrollers

Jan. 23, 2003
A few logical procedures during setup can tune motion controllers to perform at their best.

For many engineers, the process of tuning a servomotor is a mysterious black art. But the procedure needn't be painful. Just a modest amount of knowledge can bring familiarity with some of the standard techniques and add consistency to what can otherwise be a hit-or-miss process.

A typical motion system can be thought of as a motion controller, amplifier, and servomotor/encoder. Though there are a wide variety of servoloop implementations, the most common tend to be either a PID position loop or a cascaded position/velocity loop. In the former, the motion controller generates the P, I, and D terms which operate on the position error, i.e., the difference between the commanded and measured position. The resulting signal goes to the amplifier, which closes a velocity loop. In the case of a cascaded loop, the motion controller gets or synthesizes both position and velocity feedback, applies coefficients to each, and feeds the resulting signal to the servoamp.
It can be helpful to look at servo tuning by first examining the usual procedure for PID-type loops, then progressing to more advanced techniques such as feedforward. Fluency in the different types of servoloops helps lead to a common, reproducible method to tune servos.

The most common positioning servomotors in use today are dc brush motors and brushless dc motors, also called brushless PM (permanent-magnet) motors. They are driven by an amplifier which may also commutate the motor coils and, in turn, is driven by the motion controller.

Unlike stepmotors, which move in discrete steps determined by the motor construction itself, servomotors require a position-feedback device to sense where they are. The most common type of position-feedback device in use today is the optical-incremental encoder. Other types of encoders include resolvers, magnetic encoders, and sine/cosine encoders. Tachometers, found on some motors, are another common feedback device that sense velocity.

The servoloop, or compensator, is the portion of the motion controller that tries to match the desired position specified by the profile generation with the actual position provided by the motor-feedback device. There are a wide variety of servoloop implementations. But most tend to be one of two schemes, the PID position loop and the cascaded position/velocity loop.

The PID position loop uses a single feedback loop which combines P (proportional), I (integral), and D (derivative) terms along with position sensor feedback to generate a motor command. The cascaded position/velocity loop controls the motor using a more complicated scheme that has an inner velocity loop and an outer position loop.

Which scheme is better? For most systems there is no clear advantage to either. Most consider PID tuning to be simpler and it is certainly much better known. To tune a cascaded position/velocity loop you must adjust the inner velocity loop first, then the outer position loop. In theory this is easier than a PID, but for most engineers the less to adjust the better.

If you have purchased a velocity-mode amplifier, the only loop that makes sense is the PID loop because the amplifier already contains a velocity loop. The output of the PID will become the input to the velocity loop within the amplifier. Generally speaking, you must make sure the type of amplifier you use is compatible with the servoloop your controller provides.

Zone-based tuning starts by driving the motor with a velocity square wave, then setting both the integral and proportional gains to zero or small values. The value of the D term then gets gradually increased until the actual axis velocity overshoots the profile velocity. The next step is to change the velocity profile to that of the actual application and begin tuning the P and I terms.
Intuitive tuning starts by driving the system with a step-function position command. With D and I terms at zero, the P term gets increased until just before the motion axis oscillates, then backed off to half that value. The D term then gets increased until the resulting motion is critically damped. Then the I term is set to satisfy long-term motion needs.

Focus on PID
There are two widely used methods for tuning a PID loop. The first, which may be called zone-based tuning, adjusts the D terms first, then the P terms, and finally the I term. The second, which may be called tuning by intuition, adjusts P first, then D, then I.

Both of these tuning methods will work best with the servosystem operating under conditions that approximate those of the actual application. In other words, the motor should be exercised using inertias and load conditions similar to those used by the system in the field. If you have purchased an off-the-shelf motion chip, motion card, or a motion box, it will also probably include a PC-based diagnosis tool that can help exercise the motor and visualize the results.

The zone-based method starts by driving the motor using a velocity square wave. In other words, set the profile to move to a velocity using acceleration and deceleration values high enough to make the ramp-time nearly zero. Now set the integral gain and the proportional gain to zero. If the controller does not let you set the proportional gain to zero, set it to a relatively small value.

Gradually increase the value of the D term until the actual axis velocity overshoots the profile velocity. As you increase the value of the D term, you will notice that axis chatter increases, particularly if the encoder does not have a particularly high resolution. You may find that this places an effective limit on the value of D even before velocity overshoot occurs.

It is hard to specify hard and fast encoder resolutions that will limit values for D under specific circumstances. The reason is there are complicating factors that depend on the exact implementation of the PID loop, the presence of any filters in the loop, and even more subtle effects such as the spacing of the quadrature encoder counts.

Nevertheless, there are two main remedies when chatter problems prevent increasing the D term further. The first, and simplest, is to use an encoder with a higher resolution. But this tends to be costly. The second is to add a low pass filter typically at the output of the motion controller, before the input to the amplifier torque loop. A two-pole low pass with zeta in the range of 0.4 to 0.7 tends to work well.

This remedy may degrade overall loop stability. But usually it's possible to boost performance by balancing an increase in D with the deleterious effect of decreasing loop stability.

In any case, once you have the determined the value of the D term, the technique is to change the profile so it uses the "real" acceleration and deceleration values applied in the application. Then start increasing the P term until the actual axis velocity once again starts to overshoot the desired velocity. The final setting becomes this P value minus 10 %.

Feedforward refers to the addition of open-loop information that is available to the profile generator such as desired velocity and desired acceleration. These values get added to the PID filter with respective gain factors to help the servo anticipate changes being commanded.

Tuning the I (integral term) is a little more subjective. Often you can leave the I term at zero, or just use it to compensate for biases such as gravity if the system is vertical. Large values for I tend to destabilize the servoloop, so the smaller the better.

Tuning by intuition
In trying to get a feel for a motion system, many engineers view the P in a PID loop as a stiffness term, D as a resistance term, and I as a windup term. As such, the most intuitive approach is to adjust the P term first, then control stability by increasing D and finally adjusting any longer term errors with I.

To use this method, set up an oscilloscope to plot actual axis and desired position, (note that by comparison, the previous zone-based method plotted actual and desired velocity) and drive the system with a step-function position waveform in other words, a profile that has high acceleration and deceleration, as well as a high velocity. The total distance to move should be relatively short though. Make sure that it is small enough so the controller does not saturate the signal to the amplifier during the move.

Start by setting D and I to zero and increase the P term until the motion axis oscillates or to a value just below oscillation. Now using half that value for P, increase the D term until the resulting motion is critically damped. While there in fact is a mathematical definition of this term, for our purpose critically damped should mean "not too fast" and "not too slow" and thus is somewhat subjective. As before, once P and D are tuned, increase the I term to satisfy any remaining longer-term motion considerations.

The problem with this method is that the value of the D term substantially affects the optimal value of the P term, but much less so vice versa. The zone-based method resolved this by tuning D first. If you tune the P terms first, plan on going through a few iterations of P and D until you have a combination that you are happy with.

The tuning of feedforward systems starts with the velocity feedforward term, adjusting it to make servo lag as small as possible, and focuses on a portion of the profile where the velocity is flat. Next to be adjusted is the acceleration feedforward value, set to minimize the servo lag during periods of profile acceleration and deceleration.

When in doubt, back off! Aggressive gain values may look good on the test bench, but don't forget they must work in the field day in and day out. For most applications oscillation and instability are much more serious problems than missing the target by a few encoder counts. It's best to explore different PID values on a variety of hardware if possible, including worn and used mechanisms. And of course, whenever exercising a system with new servo values, make sure you and your equipment will both be safe should the motor enter oscillation or undergo uncontrolled motion.

Feedforward refers to the addition of open-loop information that is available to the profile generator. Typical feedforward terms are desired velocity and desired acceleration. By adding these values to the PID filter with a gain factor, it is possible to further improve the performance of the servosystem. Basically the additional terms let the servo better anticipate changes that are being commanded. Understanding when and how to use feedforward terms will maximize the performance of your system.

Feedforward will help when there are elements in your motion system that add a lag proportional to the feedforward term. For example, use velocity feedforward if there are velocity-proportional lags in the system. These most often come from use of voltage or velocity-mode amplifiers, and from frictional elements. The most common source of acceleration-proportional servo lag (or overshoot) is inertia of the motor system.

Start tuning velocity feedforward and focus on a portion of your profile where the velocity is flat, so acceleration effects do not come in to play. Adjust the velocity feedforward so that the servo lag is zero or small.

Leaving this value for velocity feedforward in place, adjust the acceleration feedforward value, and try to minimize the servo lag during periods of profile acceleration and deceleration.

There is one important thing to be aware of: Feedforward terms are by definition open-loop contributions to the final motor command. Thus if the conditions that caused the proportional lag change, such as a change in oil viscosity or increase in inertial load, then the optimum gain values will change as well. Because many of these factors cannot be controlled, you should select conservative average values for feedforward terms over the operating range and loads your system will encounter.

No tuning procedure can fully guarantee that a system will operate as desired under all conditions. However, as you gain experience in servo tuning you will develop an intuitive feel for the contribution of each of the PID terms. And using feedforward terms, you should be able to maximize system performance throughout the entire motion profile, during the acceleration, coast and deceleration phase.

Advanced servo features come to motion chips

Off-the-shelf motion chips, also called motion processors, have always had an advantage of size and power consumption over their board or module-based cousins. But many people perceive motion chips as lower in performance. Recent developments go a long way toward dispelling that idea.

An example is the MC2140 motion processor from Performance Motion Devices. This off-the-shelf motion processor includes a standard PID servoloop but adds velocity and acceleration feedforward, integral windup limitation, motor bias offset, output scaling, and a programmable derivative time base. This product demonstrates that servocontrol features previously reserved for board-level systems have made their way into the world of motion chips.


Motion oscilloscopes light the way

Whether dubbed motion oscilloscopes, motion-capture systems, or servotuning systems, PC-based software packages that let designers examine the performance of their motion system have become indispensable for many motion design projects.

One such product is ProMotion, a motion exerciser and tuning package offered by Performance Motion Devices that offers features typical for these packages. The centerpiece of this program is a motion oscilloscope function, which allows one or more variables to be captured in real time and plotted on the screen or saved to a file.

Most capture systems offer millisecond, if not microsecond accuracy in their data capture using dedicated hardware for precise synchronization. For example, ProMotion works in conjunction with Navigator motion processors, which store various real-time motion parameters such as encoder position, servo lag, desired position along with many others directly onto a hardware memory buffer on the motion card.

Sponsored Recommendations

NEW Low Profile, Ultra Compact Power Supplies

March 13, 2024
Learn more HERE about Altech's Power supplies!

Altech's Liquid Tight Strain Relifs Catalog

March 13, 2024
With experienced Product Engineers and Customer Service personnel, Altech provides solutions to your most pressing application challenges. All with one thought in mind - to ensure...

Industrial Straight-Through Cable Gland

March 13, 2024
Learn more about Altech's cable glands and all they have to offer for your needs!

All-In-One DC-UPS Power Solutions

March 13, 2024
Introducing the All-In-One DC-UPS, a versatile solution combining multiple functionalities in a single device. Serving as a power supply, battery charger, battery care module,...

Voice your opinion!

To join the conversation, and become an exclusive member of Machine Design, create an account today!