Feedforward Compensation Simulator Back
Control Engineering Simulator

Feedforward Compensation Simulator — Disturbance Rejection

Visualize the step-disturbance response of PI-only and PI plus feedforward control. Change the process gain, disturbance-path gain and PI gain to learn how anticipatory compensation reduces the peak deviation.

Parameters
Process gain K_p
Disturbance-path gain K_d
PI proportional gain K_c
Disturbance step size d_step

Fixed: T_p = T_d = 5 s, T_i = 5 s, dt = 0.05 s, T_sim = 30 s. Disturbance step at t = 5 s. FF is the gain-only form G_ff = -K_d / K_p.

Results
FB-only peak deviation |y_max|
FF+FB peak deviation |y_max|
Reduction ratio
FF+FB settling time t_s
Step Disturbance Response y(t) and Control Input u(t)

Top: output y(t) (red = FB only, blue = FF+FB, grey dashed = setpoint r=0) / bottom: control input u(t) (orange = u_fb, purple = u_ff, green = total) / vertical line: disturbance at t=5 s

Theory & Key Formulas

For a step disturbance entering a first-order process through a disturbance path, this tool compares the step response under feedback alone and under feedback combined with feedforward compensation.

Process transfer function (control path) and disturbance-path transfer function:

$$G_p(s) = \frac{K_p}{T_p s + 1},\qquad G_d(s) = \frac{K_d}{T_d s + 1}$$

The output is the superposition of the two paths:

$$y(s) = G_p(s)\,u(s) + G_d(s)\,d(s)$$

PI feedback law (error e = r - y):

$$u_{fb}(t) = K_c\,e(t) + \frac{K_c}{T_i}\int_0^t e(\tau)\,d\tau$$

Ideal feedforward compensator and the gain-only simplification used in this tool:

$$G_{ff}(s) = -\frac{G_d(s)}{G_p(s)},\qquad G_{ff} \approx -\frac{K_d}{K_p}$$

The total control input is u = u_fb + u_ff. When T_p = T_d the gain-only form gives perfect cancellation, slashing the peak deviation.

What is the Feedforward Compensation Simulator

🙋
I get feedback control, but what is feedforward and how is it different?
🎓
Roughly speaking, feedback "acts after seeing the result", while feedforward "acts the instant the cause is detected". Think about room temperature. You open a window and cold air flows in — that is the disturbance. With feedback alone, the heater is only turned up after the room actually gets colder. But with a window sensor, you can turn the heater up the moment the window opens. That is feedforward.
🙋
In the simulator the red and blue curves are very different. With the defaults blue is almost flat, while red swings hard.
🎓
Exactly, and that is the decisive effect. When the disturbance hits at t=5 s, red (FB only) first overshoots and then PI drags it back. Blue (FF+FB) knows the disturbance-path gain K_d as a model, so the moment the disturbance arrives it adds -K_d/K_p to the manipulated variable, cancelling it in advance. Look at the bottom plot — the purple u_ff makes a step at exactly the same time as the disturbance. The reduction-ratio card quantifies the cut in peak deviation.
🙋
So feedforward kills it completely? Then do we even need feedback?
🎓
That is the catch in the real world. The cancellation is perfect only when the model is exact and special conditions like T_p = T_d hold. In practice you do not know K_d or the time constants perfectly. Try shifting the K_d slider by ±50 % from the true value — the blue deviation grows again. Feedback is what mops up the residual. "FF gives a coarse anticipation, FB refines it" is the basic philosophy of two-degree-of-freedom control.
🙋
Could I not just crank up K_c on the feedback loop and catch up that way?
🎓
Sure, raising K_c improves red. Try sliding K_c up to 3 or 4. The peak does drop, but the response becomes oscillatory and the settling time can grow. On a real plant, high gain also amplifies noise into the actuator and risks instability. Feedforward lets you get the same peak reduction while keeping the loop gain safely low. Knowing both options — forcing it with feedback, or leveraging model knowledge through feedforward — is the hallmark of good control design.

Frequently Asked Questions

With gain errors of about ±20 % the peak deviation is still typically reduced by more than 50 %, so practical performance is preserved. Mismatched time constants (T_p ≠ T_d) affect settling time more than peak magnitude. The residual is picked up by feedback, so model errors rarely make feedforward worth disabling. The one thing you must check is the sign of the compensator — an inverted sign amplifies the disturbance instead of cancelling it.
This tool deals with disturbance feedforward, which injects a counteracting term derived from the measured disturbance into the manipulated variable. Setpoint feedforward, by contrast, computes the steady-state control needed for a given setpoint r(t) and adds it directly, bypassing the slow PID response to achieve fast tracking. Combining the two yields two-degree-of-freedom control, where tracking and rejection performance are designed independently.
This method assumes the disturbance is measurable, or at least predictable. Unmeasurable disturbances must be left to feedback. An alternative is the disturbance observer (DOB), which estimates the disturbance from the difference between actual and model output and cancels the estimate. Internally a DOB constructs a feedforward compensator from the inverse plant model.
Two-degree-of-freedom control is a framework that optimizes setpoint tracking and disturbance rejection independently. Pure feedback design always faces a trade-off between the two (faster response means more overshoot, for example). By adding feedforward (setpoint and/or disturbance), feedback can focus on rejection and stabilization while feedforward handles tracking. It is the de facto standard in modern process control, servo control, and automotive cruise control.

Real-World Applications

Process control (chemical plants): In distillation columns and reactors, changes in feed flow rate or feed temperature are major disturbances. Because both can be measured, adding disturbance feedforward reduces temperature swings far below what PID feedback alone can achieve. For processes with large dead-times, the presence or absence of feedforward can swing product yield meaningfully.

Servo control (machine tools and robots): Position servos use setpoint feedforward as a matter of course, computing the required torque from the desired acceleration and velocity of the trajectory and commanding it. This dramatically cuts tracking error, freeing the PID feedback to focus on suppressing vibration and load variation. It underpins high-precision cutting and high-speed robot trajectory following.

Power grids and automobiles: In load-frequency control of generators, forecast load is used as a disturbance feedforward signal to limit frequency excursions. In automotive cruise control, a road-gradient sensor that anticipates a hill and adjusts drive torque is exactly a disturbance feedforward. Accelerating when the hill comes into view is smoother and more efficient than reacting to the resulting speed loss.

HVAC (building climate control): Outdoor temperature and solar radiation can be used as feedforward signals to react to changes faster than room-temperature feedback alone. It is a key technique in commercial buildings and in factories and data centres that need tight temperature control while also saving energy.

Common Misconceptions and Cautions

The most common misconception is to think that "if I add feedforward, I no longer need feedback". Feedforward can only cancel disturbances that match the model: it cannot deal with model error, unknown disturbances, sensor noise, or initial offsets. All of these are present in real plants, so feedback is required to guarantee stability and ultimately zero steady-state error. Try moving the K_d slider away from the true value in the simulator — the blue response develops a residual error, which is what the feedback (the PI integral term) is mopping up.

The next most common error is to get the sign of the feedforward term wrong, making things worse instead of better. The minus sign in the ideal form G_ff = -G_d/G_p is what "cancels" the disturbance. If an implementation flips the sign, the disturbance is amplified and the response is far worse than without feedforward at all. The first debug check is to swing the d_step slider both positive and negative: if the blue response stays small in both directions you are fine; if it blows up on one side, you have a sign bug.

Finally, beware of assuming that the ideal form G_ff = -G_d/G_p is always physically realizable. If the disturbance path is slower than the process path (G_d has slower poles than G_p), the ideal compensator becomes improper and demands derivative action, which amplifies noise. If G_p has right-half-plane zeros (non-minimum phase), their inverse turns into unstable poles inside the compensator. The widespread use of a gain-only simplification is a pragmatic answer to these implementation constraints.