## PID and Servos

PID is an acronym that gets used more and more as factory automation requires ever better performance from processes, machines and motion control. There exists a great deal of misunderstanding about it. This article will talk about PID conceptually and practically so that a clearer understanding may prevail.

To begin with, PID means Proportional, Integral and Differential. It probably should have been called IPD rather than PID because the Integral term is most effective at low frequencies, the Proportional term at moderate frequencies, and the Differential term at higher frequencies. These frequencies are relative to the bandwidth of the servo or process.

PID has been much more common in process control where temperatures, pressures, etc. need to be optimally controlled. The primary benefit from the Integral term is the reduction of steady state error while the Differential term helps improve the responsiveness and stability. The theory is valid whether one is controlling temperature, pressure or position. A big difference between a typical process closed loop and a typical position closed loop is the dynamics or frequency response. It is not unusual for a positioning servo to have a bandwidth of 10 Hz or for a process loop to have a bandwidth of 0.1 Hz. Control of temperature, pressure, etc. is usually a "slower" process than positioning with motors.

In order to discuss the effects of PID, it is necessary to look at a basic closed loop servo and the equation for its closed loop response. This was discussed in detail on page 39 of the September/October 1990 issue of Motion Control. The block diagram and the response formula are repeated here for your convenience:

It is also important that one visualizes this equation by viewing the Bode diagram. Bode diagrams were discussed on page 45 of the January 1991 issue of Motion Control. A Bode diagram is simply a plot of the open loop (A) and closed loop A/(1 +A) responses of the servo in relation to frequency. A Bode diagram is shown below, again for your convenience.

Remember that A/(1 +A) is approximately equal to 1 when A is large and to A when A is small - as shown on the diagram above.

One can introduce another Integrator (the motor being the first one) at the error point which recognizes and acts upon the least significant increment of the error. As long as an error exists, it will integrate (continually sum) that error (within certain limits) until motion takes place. A second Integrator shows up on a Bode diagram with a plot of gain (A') that has twice the slope previously shown. In the Bode diagram previously shown which has a bandwidth of 10 rad/sec., the double slope would result, for instance, in a gain of 10,000 at 0.1 rad/sec. instead of the 100. This means that the low frequency dynamics are dramatically improved in addition to the error being greatly reduced.

As A' approaches 1 on the Bode diagram (at 10 rad/sec. in the example), the denominator becomes 1 + 1 -180° = 1-1 = 0 and F/C becomes infinite! This will result in severe oscillations. In order to maintain a stable system, the denominator must not be allowed to approach 0. When the term "phase margin" is used, it expresses how close the phase shift of A' is to -180° when A' = 1 in magnitude. A commonly accepted design goal is for A' to have -135° of phase shift or less (45° of phase margin). This will result in a 25 percent overshoot of the closed loop system in response to small step inputs in position as shown below.

As the phase margin gets larger, the amount and number of overshoots diminish. As the phase margin gets smaller, the overshoots get larger and will "ring" for longer periods until finally constant "ringing" or sustained oscillation will occur.

In order to remain stable and limit the overshoot response to a step input, the second Integrator must be removed in the vicinity of A' = 1 or in the vicinity of 10 rad/sec. This will allow the phase to approach the -90° associated with the single integration of the motor. Typically, the "break point" at which the Integrator would be removed would be about a factor of 10 from the bandwidth. In the example, the "break point" would be placed at 1 rad/sec. and for frequencies above that value, the compensation for the loop would revert from an Integrator to a Proportional or constant term. If this Proportional term equals 1, then the gain reverts back to A at frequencies above 1 rad/sec. with only the normal single integration caused by the motor.

The methods for making an Integrator and removing it above a specific frequency value are covered in texts on digital filtering or analog filters depending on whether the servo error (E) is digital or analog.

This is possible by introducing positive phase to improve the phase margin by means of a Differentiator. Earlier it was mentioned that an Integrator results in the output lagging the input by 90 degrees. Conversely, a Differentiator has an output that leads the input by 90°. An Integrator, with frequency, takes the form of with its gain decreasing with frequency and its output having a 90° phase lag. A Differentiator takes the form with its gain increasing with frequency, but its output having a 90° phase lead. By designing the Differentiator so that it is effective for frequencies of 10 rad/sec. and above in the example, the phase lead will benefit the phase margin near the bandwidth frequencies. There is an undesirable effect from this, however. Since the Differentiator causes the gain to increase with frequency, it also increases some of the machine resonances that will often be found in the 100 to 1,000 rad/sec. range. For this reason, the Differentiator is usually "disengaged" back to Proportional at some midpoint between the servo bandwidth and the frequency of the first resonance.

Combining this with the Bode diagram shown earlier for the "naked" loop illustrates that this PID compensation has resulted in a closed loop servo with a wider bandwidth and a greater gain (thus accuracy) within that bandwidth.

PID is a relatively sophisticated compensation technique to improve the performance of a servo. A servo with a good internal velocity loop will provide many of the benefits of PID. If no velocity (tachometer) loop exists, PID should be considered. It is always best to keep designs simple and introduce complexity only when necessary.

To begin with, PID means Proportional, Integral and Differential. It probably should have been called IPD rather than PID because the Integral term is most effective at low frequencies, the Proportional term at moderate frequencies, and the Differential term at higher frequencies. These frequencies are relative to the bandwidth of the servo or process.

PID has been much more common in process control where temperatures, pressures, etc. need to be optimally controlled. The primary benefit from the Integral term is the reduction of steady state error while the Differential term helps improve the responsiveness and stability. The theory is valid whether one is controlling temperature, pressure or position. A big difference between a typical process closed loop and a typical position closed loop is the dynamics or frequency response. It is not unusual for a positioning servo to have a bandwidth of 10 Hz or for a process loop to have a bandwidth of 0.1 Hz. Control of temperature, pressure, etc. is usually a "slower" process than positioning with motors.

In order to discuss the effects of PID, it is necessary to look at a basic closed loop servo and the equation for its closed loop response. This was discussed in detail on page 39 of the September/October 1990 issue of Motion Control. The block diagram and the response formula are repeated here for your convenience:

It is also important that one visualizes this equation by viewing the Bode diagram. Bode diagrams were discussed on page 45 of the January 1991 issue of Motion Control. A Bode diagram is simply a plot of the open loop (A) and closed loop A/(1 +A) responses of the servo in relation to frequency. A Bode diagram is shown below, again for your convenience.

Remember that A/(1 +A) is approximately equal to 1 when A is large and to A when A is small - as shown on the diagram above.

#### Integral Term

Let's discuss why one might want to introduce an Integral factor into the gain (A) of the control. The Bode diagram shows A approaching infinity as the frequency approaches zero. Theoretically, it does go to infinity at DC because if one put a small error into an open loop drive/motor combination to cause it to move, it would continue to move forever (the position would get larger and larger). This is why a motor is classified as an integrator itself - it integrates the small position error. If one closes the loop, this has the effect of driving the error to zero since any error will eventually cause motion in the proper direction to bring F into coincidence with C. The system will only come to rest when the error is precisely zero! The theory sounds great, but in actual practice the error does not go to zero. In order to cause the motor to move, the error is amplified and generates a torque in the motor. When friction is present, that torque must be large enough to overcome that friction. The motor stops acting as an integrator at the point where the error is just below the point required to induce sufficient torque to break friction. The system will sit there with that error and torque, but will not move.One can introduce another Integrator (the motor being the first one) at the error point which recognizes and acts upon the least significant increment of the error. As long as an error exists, it will integrate (continually sum) that error (within certain limits) until motion takes place. A second Integrator shows up on a Bode diagram with a plot of gain (A') that has twice the slope previously shown. In the Bode diagram previously shown which has a bandwidth of 10 rad/sec., the double slope would result, for instance, in a gain of 10,000 at 0.1 rad/sec. instead of the 100. This means that the low frequency dynamics are dramatically improved in addition to the error being greatly reduced.

#### Proportional Term

There is a big problem with A' having two integrators, however. As discussed in the January column, an integrator results in its output being 90° phase lagged from its input. By putting two integrators in series, a 180° phase lag results (expressed as A'-180°). Under this condition, the closed loop gain becomes:As A' approaches 1 on the Bode diagram (at 10 rad/sec. in the example), the denominator becomes 1 + 1 -180° = 1-1 = 0 and F/C becomes infinite! This will result in severe oscillations. In order to maintain a stable system, the denominator must not be allowed to approach 0. When the term "phase margin" is used, it expresses how close the phase shift of A' is to -180° when A' = 1 in magnitude. A commonly accepted design goal is for A' to have -135° of phase shift or less (45° of phase margin). This will result in a 25 percent overshoot of the closed loop system in response to small step inputs in position as shown below.

As the phase margin gets larger, the amount and number of overshoots diminish. As the phase margin gets smaller, the overshoots get larger and will "ring" for longer periods until finally constant "ringing" or sustained oscillation will occur.

In order to remain stable and limit the overshoot response to a step input, the second Integrator must be removed in the vicinity of A' = 1 or in the vicinity of 10 rad/sec. This will allow the phase to approach the -90° associated with the single integration of the motor. Typically, the "break point" at which the Integrator would be removed would be about a factor of 10 from the bandwidth. In the example, the "break point" would be placed at 1 rad/sec. and for frequencies above that value, the compensation for the loop would revert from an Integrator to a Proportional or constant term. If this Proportional term equals 1, then the gain reverts back to A at frequencies above 1 rad/sec. with only the normal single integration caused by the motor.

The methods for making an Integrator and removing it above a specific frequency value are covered in texts on digital filtering or analog filters depending on whether the servo error (E) is digital or analog.

#### Differential Term

The Integral and Proportional terms have provided a system which is considerably more accurate and responsive at lower frequencies, yet stable based on the phase margin criterion near servo bandwidth frequencies. It may also be desirable to further improve the phase margin so that the bandwidth can be extended or the overshoot of the step response minimized.This is possible by introducing positive phase to improve the phase margin by means of a Differentiator. Earlier it was mentioned that an Integrator results in the output lagging the input by 90 degrees. Conversely, a Differentiator has an output that leads the input by 90°. An Integrator, with frequency, takes the form of with its gain decreasing with frequency and its output having a 90° phase lag. A Differentiator takes the form with its gain increasing with frequency, but its output having a 90° phase lead. By designing the Differentiator so that it is effective for frequencies of 10 rad/sec. and above in the example, the phase lead will benefit the phase margin near the bandwidth frequencies. There is an undesirable effect from this, however. Since the Differentiator causes the gain to increase with frequency, it also increases some of the machine resonances that will often be found in the 100 to 1,000 rad/sec. range. For this reason, the Differentiator is usually "disengaged" back to Proportional at some midpoint between the servo bandwidth and the frequency of the first resonance.

#### PID

A Bode diagram of the whole PID compensation network would be:Combining this with the Bode diagram shown earlier for the "naked" loop illustrates that this PID compensation has resulted in a closed loop servo with a wider bandwidth and a greater gain (thus accuracy) within that bandwidth.

PID is a relatively sophisticated compensation technique to improve the performance of a servo. A servo with a good internal velocity loop will provide many of the benefits of PID. If no velocity (tachometer) loop exists, PID should be considered. It is always best to keep designs simple and introduce complexity only when necessary.

*This article originally appeared in Motion Control Magazine, March 1991.*