Servomotor Tuning

Properly tuning a motor has been considered a form of black magic by those who haven't had many opportunities to perform the operation—and a painfully learned technique by those who have.

Although there are many good tuning methods and self-tuning algorithms available, most are keyed to specific brands of motion controllers or to specific types of operations.

When tuning a system, many different though suitable values can be entered into a given gain algorithm, but only one will work over the broadest possible range of load and motion variations. By achieving optimum gain values, other types of gain modifiers (e.g., notch filters, adaptive tuning, and feed forward) may not even be necessary.

PID

The most popular style of gain algorithm in use today is the proportional-integral-derivative (PID). PID effectively compensates for continuous, long-term, and instantaneous motion situations for a very broad range of applications. Motors can't react in zero time. They're meant to operate smoothly and continuously. Imparting a discontinuous force changes the motor's velocity based on overall system time constants (elec and mech), and this happens in a continuous, smooth fashion.

Is it possible to accelerate the reaction to a disturbance to maintain a more stable velocity profile? Yes, it is. How can we ensure canceling a disturbing force doesn't impart an undesirable jerk on the machine or load? By properly selecting the motor, amplifier, feedback, motion controller, and gain tuning values, all of which must be coordinated into the big system picture.

We must define a method for tuning any PID gain algorithm in order to yield the optimum response to any system design. Regardless of the algorithm in use, the tuning direction is the same for its proportional, long-term, and instantaneous reaction terms.

PID Elements

The classic PID structure consists of four independent elements that produce the control signal applied to the motor amplifier.

DAC Value = Set Point + Proportional + Integral + Derivative

The DAC output value is the result actually applied to the motor control amplifier, and its components are defined in Table 1.

Tuning the PID

A gain algorithm's purpose is producing smooth, stable motion. As systems become more responsive, a more defined procedure for tuning the gain loop is required. It's necessary to use well-established tuning procedures instead of widely diverse methods or guessing.

The following PID tuning procedure has been used extensively on both process and motion control systems. The key is to completely understand the gain algorithm and tuning methods that make the tuning intuitive. This means understanding not only what the gain elements do but also the order in which to adjust them and at what point on the trajectory profile to test them for proper adjustment. It's extremely important to learn how to "read" what the motion is "telling" you.

The Tuning Procedure

To expedite the process, have a pencil and paper ready to record the results of each step.

1. Slowly rotate the motor to determine its resolution per revolution. This is essential for knowing the correct amount of following error each gain term will be required to handle.
2. Determine the system's maximum velocity, rpmmax, sys. This should never exceed 90% of the motor's top rpm (rpmmotor, sys). If the system must reach rpmmotor, sys, then buy a motor with a higher rpm.
3. Determine the system's overall time constant, sys. Divide the best system acceleration time from zero to rpmmax, sys by 5. We must bump the motor under load and measure the time required to achieve rpmmax, sys. sys takes into account the electronics, the mechanics, and the available power of the motor/amplifier package.
4. Determine the system's acceleration time, accelbest, sys. This value is either 2.5sys or a slower rate (longer time) based on the system/load-handling requirement defined in the operating specification. If this value isn't fast enough, purchase a motor/amplifier with more power, bandwidth, or response capability.
5. Determine the mode of motor operation. There are two basic modes: current and voltage (other terms in use are torque, speed, and velocity). Knowing the mode lets us properly set the gain values (Kp, Ki, and Kd).

Voltage mode lets the motor draw the current it requires to maintain velocity stability without intervention by the motion controller and requires the controller bandwidth to be set lower than the motor amplifier's bandwidth. However, in current mode, the controller directly controls the motor current. Thus, its bandwidth in this mode can be much higher than would be possible with voltage-mode operation.

1. Determine the following error requirement for tuning the proportional PID term(s).
Current mode = 3°/360° x counts/rev
Voltage mode = 90°/360° x counts/rev

Given a motor resolution of 2,000 counts/rev, the actual current-mode motor tracking would be 3/360 x 2,000 = 17 counts behind the generated trajectory (the desired position). If, however, the motor were operating in voltage mode, the actual motor position would be tracking 90/360 x 2,000 = 500 counts behind the generated trajectory.

Once these terms are established, set the long-term PID controls (Ki): For current-mode operation, following error is zero, and for voltage mode, it's 80° (445 counts).

1. Tune Kp. Set the motion controller acceleration to accelbest, sys and the speed to rpmmax, sys. Set the move profile for a trapezoidal (flat-topped) move. Perform the profile move and adjust Kp until the required (Kp) following error is achieved (step 6) during the flat-top section of the motion profile. If the motor begins to oscillate prior to achieving this condition, increase Kd to stabilize, or eliminate, this condition.
2. Tune Ki and integral limit (IL). Set Ki equal to Kp and IL—a value limiting Ki's growth—equal to four times Kp (step 7). Set the motion controller acceleration, speed, and move profile as in step 7. Perform the profile move, and adjust IL until the required Ki following error is achieved (step 7) during the flat-top section of the move. If the motor begins to oscillate prior to achieving this condition, increase Kd to stabilize or eliminate this condition.

The integral term's objective is to have the system track the desired profile as closely as possible. Theoretically, the integral portion of the DAC output voltage should build during the profile's acceleration slope and should be at the proper value once the flat-line portion—the stop—has been achieved.

Ki's value determines the response of the integral portion of control; optimize it to ensure that it's stable upon achieving stable run operation, with no excessive ringing at the knee of the accel/run or decel/stop positions. The position to determine its stability will be at the knee plus sys. The position to determine if IL is set properly is at the point of generated trajectory complete, plus sys. If the actual stopping position is short of the desired position, increase IL; if it's beyond the desired stopping point, reduce IL.

1. Tune the derivative gain term, Kd. Kd maintains velocity stability by noting changes in the following error over time, then trying to stabilize further velocity excursions. It can be considered a form of acceleration feed-forward gain control. Adjusted properly, it helps maintain motion stability relative to the commanded velocity within a relatively small percentage of deviation.

Again, set conditions to accelbest, sys, rpmmax, sys, and use a trapezoidal move profile. Check the derivative term for proper operation by noting the following error halfway up the profile's acceleration slope. It's at this point that the system position should have completely recovered from any starting delay caused by sys.

Obviously, tuning itself isn't the problem. Understanding the algorithm, the interaction of the elements, their tuning order, and where in the trajectory profile to test each of them for velocity stability are just as important as the tuning procedure.

Once an element has been tuned, leave it alone. By readjusting it, you offset the other elements' dynamic responses, causing them to overreact in order to compensate for one another's improper settings. The result is a possible increase in stability for the set of existing conditions and a less optimal tune for a wider dynamic range of inertial loading capability!

The return of science to tuning is at hand. MC

 This article was condensed from "The Science of Tuning Servomotors," Motion Control, September/October 1997.

Figures and Graphics

Author Information
In his more than two decades in motion control, Chuck Raskin, P.E., CMCS, has contributed to many industry publications. He also published the fifth edition of the Design with Motion Handbook in March 1997. Chuck is a member of both the American Institute of Motion Engineers and the Society of Manufacturing Engineers. He can be reached at 10701 Terrace Road, Blaine, MN 55434; tel: (763) 502-0200, ext 127; fax: (763) 502-0300.