# Feed forwards augment PID control

Feed forward augmentation is a prediction technique that estimates the output from a proportional-integral-derivative (PID) control algorithm without waiting for the PID algorithm to respond. If the feed forward prediction can estimate the control output closely, the PID algorithm, whose job it is to minimize the error between the current state of the system and the desired state, will need to do less to correct the error. This reduces the error faster or keeps the error smaller than relying on the PID algorithm alone. Feed forward control outputs usually are calculated using the setpoint value and its derivatives (based on target velocity and acceleration values) and multiplying each one by a gain. In closed loop motion control applications it is common to multiply the target speed and target acceleration by the velocity and acceleration feed forwards to generate the feed forward’s contribution to the control output. (Figure 1 contains a typical control loop diagram with feed forward terms added to the conventional P, I, and D terms.)

**Motor PID example **

As a simple example, consider a motor that will move 1 in. per second if 1 V is applied, 2 in. per second when 2 V are applied and so on, such that applying 10 V will result in a speed of 10 in. per second. In this case the feed forward value would be proportional to the velocity: the velocity feed forward value is 1 volt per inch per second. This means that if the setpoint (that is, the target velocity of the system) is 8 in. per second, the output from the velocity feed forward term would be 8 V.

In a motion control application the velocity setpoint is ramped up to the final setpoint smoothly so the feed forward term ramps up smoothly to avoid sudden changes in the control output that would shock the system.

Also, a motion control application usually has an acceleration feed forward that is multiplied by the rate of change in the velocity setpoint to give the motor an extra boost when accelerating to the final position and a little braking while decelerating as the final position is reached.

Temperature control applications generally perform well without using feed forwards because the process is relatively slow and the integrator gain term has time to do most of the work. However, there are cases where the load changes rapidly.

**Feed forward story problem **

For example, consider a baking application where material being heated moves through the oven on a conveyor. Assume that the time the material must be in the oven is constant, but the oven temperature can be varied, and the difference in the rate of baking can only be due to the density of the material being heated. As the material leaves the oven, it removes heat; material leaving the oven at a higher rate will make for a greater heat loss. To compensate for these factors, some mechanism would be required to estimate the density of the material going through the oven, which could be used to calculate the required variations in oven temperature.

Typically, the greater the volume or number of items going through the oven, the higher the oven temperature should be. If the oven is long and has many zones, then a queue needs to be implemented so each zone can respond to different amounts of material in it. There may even need to be a "look ahead" feature in the queue to account for dead time between items being baked.

In theory, feed forwards should be able to predict the correct control output so there would be no error, making the use of a PID control algorithm unnecessary. In reality, the feed forward gains will not be perfect due to the real-world reactions of the plant being nonlinear, changing loads, or time constants relating to the process that aren’t really constant. So a PID is still required to correct the error. However, if the feed forwards can estimate the control output within 10% of the actual control value required, then the PID only needs to do the last 10% of the work. This will result in a faster response and less error over time, and presumably lower costs and higher productivity for the manufacturing process.

**Calculating feed forward gains**

Feed forward gains are actually the inverse of the plant model (a mathematical model of the operation or process being controlled). If the plant model was some function Gp(s), the feed forwards would be FF(s) = 1/Gp(s). This fact is useful because when controlling a system, the process variable [PV(s), the measured state of the process] should be equal to the setpoint SP(s). In math terms, feed forward control is:

SP(s)*FF(s)*Gp(s)=PV(s)

Since the feed forwards are the inverse of the plant, Gp(s)*FF(s) = 1, so the equation above simplifies to

SP(s)=PV(s)

The process variable is the same as the setpoint, so there is no error. This is the desired goal. As mentioned above, the only problem is that typically the plant designers neglect to provide a plant model, so the feed forward gains must be tuned manually. This isn’t as hard as it seems if the person doing the tuning has access to the integrator’s gain contribution to the control output.

It is best if the integrator’s gain contribution can be plotted on a trend or captured in a plot. The reason for this is that if there is an error in the feed forward gains, the integrator gain will try to compensate for the error (see Figure 2a).

**3 tuning plot figures**

Figures 2a, 2b, and 2c show three tuning plots. The yellow plot line in each represents the integrator term. Red and light blue are actual and target position. Blue and magenta are actual velocity and target velocity, and green is the control output to the valve. The goal is for the actual and target axis positions to precisely overlap at every point in time (horizontal axis).

By looking at the plot or trend, the cause of the error can be determined. Then, to reduce the error, a feed forward gain can be calculated as a function of whatever caused the error. For instance, if the motor discussed earlier is told to move at 10 in. per second, the motor’s actual speed will lag behind the target speed until the value of the PID’s integrator component winds up enough to increase the control output to 10 in. per second.

Changing the target velocity caused the error, so the first step is to calculate a feed forward term as a function of velocity. Using the numbers from the example above the integrator value would need to increase enough to contribute 10 V to the control output, causing the system to go 10 in. per second. Now the person tuning the system can divide the speed by the control output to easily arrive at a velocity feed forward term.

**Acceleration, deceleration**

Assuming the velocity feed forward is now correct, there should be very little, if any, error while the system is traveling at constant velocity (see Figure 2b). However, there will most likely be some error during acceleration and deceleration. During acceleration the integrator output will tend to increase a bit to keep the actual velocity from lagging the target velocity. Since the target acceleration also can be plotted, the amount of integrator wind-up during acceleration can be divided by the peak acceleration to get a good estimate of the acceleration feed forward gain. This should reduce the following error during the acceleration phase and when deceleration goes to zero. Figure 2c shows a perfectly tuned system with the feed forwards doing all the work.

**Linear motor model **

Finally, as stated above, the feed forward gains provide the coefficients for the plant model because the feed forward terms are the inverse of the linear plant model. A simple linear motor model may be:

So the feed forward gains are:

…where:

K is the gain of the motor with load

τ is the time constant of the motor with load

s is the Laplace operator

1/K is the velocity feed forward term

τs/K is the acceleration feed forward term

[*Reminder: Laplace transform is a mathematical device used to make a round trip from the time to the frequency-dependent complex variable(s) domain and back. A Laplace operator is a differential operator given by a function’s gradient.*]

**Hydraulic cylinder model **

A linearized model for a hydraulic cylinder and load is more complicated. The cylinder and load can be modeled as a mass between two springs, so it is an underdamped two-pole system. A linear model is:

Invert to find the feed forward gains:

…where the additional term ζ is the damping factor and ω is the natural frequency

1/K is the velocity feed forward term

(2_{*}ζ_{*}s)/(K_{*}ω) is the acceleration feed forward term

and

1/(Kω^{2} ) is the jerk feed forward term

Notice that there is an extra power of (s) and a corresponding feed forward term. This is the jerk feed forward gain that is multiplied by the current target jerk generated by the target generator. Refer to Figure 1 to see how all the terms combine in the control loop structure.

Feed forwards are relatively easy to tune or determine empirically and can reduce errors and improve response times significantly. Feed forwards always should be considered when setpoints or load change, yet the error must be minimized.

– Peter Nachtwey is president of Delta Computer Systems Inc.; edited by Mark T. Hoske, content manager, CFE Media, *Control Engineering*, mhoske@cfemedia.com.

**Key concepts **

- Feed forward estimates proportional-integral-derivative (PID) control algorithm output without waiting for the PID algorithm to respond.
- Feed forward can reduce the error faster or keep the error smaller than relying only on the PID algorithm.
- When setpoints or load change and error must be minimized, feed forwards always should be considered.

**Consider this **

Do you have open loops that could benefit from feed-forward predictions applied to PID motion control?

**ONLINE extra **

Below, see the *Control Engineering* tutorial, Back to Basics: Relearning terms, concepts for process control, and the related article, Using PID for motion control, robotics.

Also, see another Delta Computer Systems article: Inside machines: Motion control moves bacon faster