# Harmonic Cancellation Algorithms Enable Precision Motion Control

*Stephen J. Ludwick, Ph.D.** Joseph A. Profeta, Ph.D.*

The *internal model principle* of control theory states that algorithms designed to perfectly reject input signals must contain a model of that input.

Feedback control that adheres to this internal model principle has led to the development of *harmonic cancellation algorithms* and even more complex *repetitive controllers*.

## How are they useful?

Periodic disturbances are commonplace in precision motion control applications; any oscillatory or rotational motion generates some periodic error in both the active and ancillary motion axes. Harmonic cancellation algorithms, when properly applied, give control system engineers an additional tool that is both effective and easily analyzed with common frequency domain techniques — to eliminate tracking errors in precision motion systems. They apply when either the servo command or disturbance is largely periodic — for example, in machine tools, data storage systems, and sensor testing.

Because controls that adhere to the internal model principle contain models of system input, harmonic cancellation algorithms contain periodic signal generators. When combined with a well-tuned conventional controller, these algorithms become useful tools for servo system designers.

## Internal model principle

The internal model principle of control theory is a deceptively simple yet powerful concept. First formalized in the mid-1970s, it requires that an algorithm contain a generator (or model) of any input signal that is to be tracked with identically zero steady-state error.

*Figure 1. The internal model principle requires that the controller contain a model of the input signals to generate the appropriate output in the absence of any steady-state forcing error.*

Fig. 1 illustrates the concept with a block diagram. For zero error between the commanded reference and measured signals, the control algorithm must be capable of self-generating this signal in the absence of any further input.

The most familiar application of the internal model principle is the use of an integrator *I* term in common PID controllers.

Consider the case of a linear-motor-driven positioning stage modeled as a free mass with a control force applied to it: Proportional and derivative control alone are sufficient to stabilize the system, but any constant disturbance force (due to the process, gravity, cables, and so on) requires some error between the reference and measured positions for the spring-like proportional control term to generate an output.

A constant disturbance is modeled as a step input with a Laplace transform of 1/s. Adding this term, an integrator, to the control algorithm allows output to grow to a constant value as required to cancel the disturbance and achieve zero steady-state error.Though the internal model principle is very general, specific expressions of it are frequently used in precision motion control applications. Any input (whether a command trajectory or a disturbance) that repeats with some known regularity can be addressed with a controller that contains a periodic signal generator. (We’ll discuss these repetitive controllers shortly.) If inputs are frequency-limited, they can be represented as a summation of sinusoids; then they are addressed with harmonic cancellation algorithms that apply the internal model principle with a series of oscillators in the control algorithm.

## Repetitive controllers

The presence of a periodic signal generator in the feedback control algorithm satisfies the internal model principle and allows for perfect tracking of periodic commands and perfect rejection of periodic disturbances. Called repetitive control, these algorithms were first defined in the early 1980s, and the internal model principle was the basis for this “controller for repetitive operation.”

*Figure 2. A delay element in the feedback loop of a continuous-time control algorithm satisfies the internal model principle for periodic input, but effectively contains a high (theoretically infinite) number of oscillators to replicate an arbitrary periodic input.*

Originally, developers used a controller with a delay element in the feedback loop to form a periodic signal generator. However, in the continuous-time domain, the time delay element corresponded to a controller with an infinite number of marginally stable poles. (See Fig. 2.)

A signal with arbitrarily sharp transitions in the time domain requires a high-bandwidth signal generator capable of creating this high-frequency content. Stabilizing these systems is challenging, because high-frequency controller poles tend to interact with unmodeled or variable dynamics in the servomechanism’s mechanical structure — causing instability.

A similar analysis for repetitive control algorithms in the discrete time domain exhibits the same problem.

Classic Fourier-series analyses clarify the relationship between the repeating sequence in the time domain and pole locations in the frequency domain. Any periodic signal can be equally well represented as a summation of simple oscillating functions — namely, sinusoids.

In short, repetitive controllers (when applied to linear systems) can be viewed as a series of single-frequency oscillators added to the control algorithm to cancel an input *that is itself a summation of single-frequency sinusoids*.

This interpretation is valuable, because it allows use of the familiar Bode diagram for determining stability margins and the steady-state response of these systems.

## Harmonic cancellation

Consider the special case of repetitive control applied to a limited number of discrete frequencies as harmonic cancellation. These cases are common in precision motion control applications and include:

- Force and torque ripple
- Unbalanced payloads on rotary axes
- Cyclic command profiles
- Screw lead and gear pitch
- Link-style cable carrier systems

Notice that some disturbances can be periodic in time, while others are periodic on displacement — so the specific frequency can vary.

Let us assume that we have a system under constant speed operation with a known frequency.

*Figure 3. The harmonic cancellation algorithm C(s) is implemented in a plug-in architecture. This leaves the PID controller unchanged and allows ready enabling and disabling of the harmonic cancellation algorithms.*

Implementing harmonic cancellation algorithms in a “plug-in” style allows it to be easily enabled and disabled as required. (The representative block diagram in Fig. 3 includes the harmonic cancellation algorithm, standard PID controller, and the plant.) In keeping with the internal model principle, the harmonic cancellation algorithm contains parallel oscillators — one for each frequency contained within the disturbance signal.

Notice the harmonic cancellation algorithm’s effect in the frequency domain by looking at the case of a single-frequency disturbance. Each individual oscillator in the algorithm has a continuous-time Laplace transform representation:

*Figure 4. Bode plots show very high (infinite) magnitude at the oscillator frequency.*

Fig. 4 shows a frequency response plot of the harmonic cancellation algorithm as the gain term sweeps from zero (disabling the oscillator) to higher values. Note: *The magnitude is infinite at the oscillator frequency*.

Now, recall how the familiar integrator term provides zero steady-state error to constant disturbances. In short, we can simply interpret the harmonic cancellation block as an integrator at a non-zero frequency.

The tracking error due to disturbances is identically zero at the oscillator frequency. We can see this by referring back to the block diagram of Fig. 4, and calculating that the tracking error due to a disturbance becomes:

Evaluating this expression at the oscillator frequency:

At the frequency of interest, there is zero steady-state error to disturbances. When the goal is to track a periodic profile, a similar analysis shows unity response with zero phase shift between the commanded and actual position profiles.

In summary, an oscillator in the control algorithm acts as an “integrator” term to signals at the particular oscillator frequency. Applying multiple oscillators in parallel allows cancellation of more complex waveforms, and approaches the general case of full-scale repetitive controllers. These are implemented as “plug-in” controllers that leave standard PID control gains unchanged.

We use familiar frequency-domain tuning tools to determine stability margins (crossover frequency, phase margin, and gain margin) when applying harmonic cancellation algorithms.

Generally however, due to the very limited frequency range over which the harmonic cancellation algorithm is most active, these sysems are straightforward to tune as long as the correction frequency is well below the system crossover frequency.*Figure 5. Loop gain increases sharply at the cancellation frequencies of 10 and 20 Hz. Even so, they have minimal influence on the response near the 55 Hz crossover frequency.*

Fig. 5 shows an actual open-loop frequency response of a system with an active harmonic cancellation algorithm. Dominant peaks in the loop gain below the system crossover frequency are prominent; however, their effect is sufficiently localized — so that gain and phase at the crossover frequency are relatively unaffected.*Figure 6. Harmonic cancellation algorithms applied to a horizontally mounted rotary stage reduce the root mean square tracking error by approximately 12x at 60 rpm. The dominant errors in the case plotted here were the payload unbalance and torque variations at the motor pole period.*

## Application examples

Once understood, the overall concepts of the internal model principle, repetitive control, and harmonic cancellation are broadly applicable.

Example 1: Consider the control of a disk drive's read-write arm. These disks do not spin on a perfectly true axis, but repetitive control applied to the synchronous portion of the error motion improves the ability of the head to track the motion.

Example 2: Fast tool servomechanisms used in asymmetric turning operations benefit from repetitive control as well. When turning the surface of a toric shape (such as the mold for a contact lens that corrects for astigmatism), the cutting tool essentially returns to the same point with each revolution of the spindle. This periodic toolpath can be decomposed into its Fourier series coefficients with harmonic cancellation oscillators applied to each of these.

Example 3: One straightforward application is a system with a horizontally mounted rotary stage. From such a machine in one specific case, a designer needed improved velocity stability. One unbalance per revolution and nine motor pole pitches per revolution were dominant terms. (See Fig. 6, which shows position error measured while the stage rotates at 60 rpm.) Applying harmonic cancellation algorithms at these frequencies reduces the root mean square tracking error from 33 to 1.7 arc-sec — a 12× reduction.*Figure 7. Motion Simulator software imports and generates motion profiling, and allows I/O monitoring and control (above) – plus has a frequency-response mode (left) for detailed motion evaluation.*

« Back to White Papers