Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 37

Pre-Compensator Design for Steady-State Tracking in State Feedback Systems

Recommended resources

Hello! Welcome to the first lesson in our new module on reference tracking and disturbance rejection.

In all our previous lessons, we focused on designing regulators using methods like pole placement and LQR. The primary goal of a regulator is to stabilize a system and drive its states to zero from any initial condition. However, in practice, we usually want our systems to follow a command, not just sit at zero. For your rotary inverted pendulum, you don't just want it to stay balanced; you want to command the cart to move to a specific position and hold it there.

This lesson tackles the first and most fundamental step in achieving this: reference tracking. We'll discover why the controllers we've designed so far () will fail to track a non-zero reference accurately, and we'll design a pre-compensator gain to fix this problem.

By the end of this lesson, you will be able to design a pre-compensator gain to ensure your state-feedback controlled system achieves zero steady-state error for a step reference input.

1. The Problem: Steady-State Error in Regulation

Let's start by seeing what happens when we give a reference command to the state feedback systems we've already designed. The structure we've used so far is a regulator, where the control input is . A simple way to introduce a reference, , might be to set the control law to .

Let's see why this intuitive approach is flawed.

What is Pole Placement (Full State Feedback) | State Space, Part 2

The following clip from a MATLAB Tech Talk provides an excellent visual demonstration of the steady-state error problem that arises when using a standard state feedback controller for reference tracking.

Please watch from 6:47 to 10:45. The video first shows the design of a stabilizing gain matrix K. Then, it demonstrates that when a step input is applied, the system becomes stable but the output settles at 0.5, not the desired reference of 1. This is the core problem we need to solve.

As the video clearly shows, even though the closed-loop system is stable, its output does not match the reference command. The system reaches a steady state, but it's the wrong one.

Why does this happen? Let's look at the math for a stable closed-loop system at steady state ().

Our system equations are:

  1. (assuming for simplicity)
  2. (our simple tracking attempt)

At steady state, , so the state equation becomes:

Solving for the steady-state vector :

The steady-state output is then:

The term is the DC gain of the closed-loop system. It's the ratio of the output to the input when all dynamics have settled. Unless this complex term happens to be exactly 1, the steady-state output will not equal the reference .


2. The Solution: The Pre-compensator Gain,

As the MATLAB video hinted, if the output is half of what you expect, the simplest solution is to double the input. We can formalize this idea by introducing a pre-compensator gain, often denoted as or (N-bar), which scales the reference signal before it enters the system.

Our new control law becomes:

The goal is to choose a value of that precisely counteracts the system's inherent DC gain, forcing the total gain from to to be exactly 1.

The block diagram below shows where this pre-compensator fits into the control structure.

State-Space Control System with Precompensation and Integral Action
This diagram shows a complete state-space control loop. The pre-compensator, labeled 'Nbar', scales the reference 'r' before it is compared with the state feedback term 'Kx' to form the control input 'u'.

3. Calculating the Pre-compensator Gain

So, how do we find the correct value for ? We need to calculate the DC gain of our closed-loop system (from the reference input to the output) and then set to be its inverse.

The closed-loop system with the new control law is:

The transfer function from the reference to the output is:

The DC gain is this transfer function evaluated at :

We want this DC gain to be 1, so that .

Therefore, the pre-compensator gain is:

This is simply the inverse of the DC gain of the closed-loop system when . In MATLAB, this is very easy to calculate.

Let's see how this is done in practice, both in the general case and for your specific inverted pendulum project.

Inverted Pendulum: Adding precompensation

This page from the University of Michigan's Control Tutorials for MATLAB (CTMS) applies this exact technique to an inverted pendulum system. It introduces a function called rscale that automates the calculation of the pre-compensator.

Read the short section titled 'Adding precompensation'. Notice how they identify the steady-state error problem and introduce the gain 'Nbar' to solve it. Observe the MATLAB code used and the resulting step response, which now correctly settles at the desired value.

As you saw in the CTMS example, the process is straightforward:

  1. Design your state feedback gain matrix using pole placement or LQR.
  2. Define the closed-loop system object in software (e.g., MATLAB's ss object).
  3. Calculate the DC gain of this system from input to output.
  4. The pre-compensator is the inverse of this DC gain.
Test your understanding!

You have designed a state feedback controller for a DC motor position control system. Your state-space model is:

Using pole placement, you've placed the closed-loop poles at and , which resulted in the feedback gain .

Calculate the pre-compensator gain required for zero steady-state error to a step command in position.

Show answer

First, we need to find the closed-loop matrix :

Note: The eigenvalues of are indeed -3 and -4, confirming our K is correct.

Now, we calculate the DC gain of the closed-loop system, which is .
First, find the inverse of :

Now, compute the full expression for the DC gain:

The pre-compensator is the inverse of the DC gain.

So, the final control law should be .


4. Extension to MIMO Systems

This concept extends directly to the multivariable (MIMO) systems you are interested in. In a MIMO system, the reference is a vector (e.g., ), and the pre-compensator becomes a matrix.

The principle remains identical: we want the DC gain matrix from the reference vector to the output vector to be the identity matrix, ensuring that tracks , tracks , and so on.

The formula for the pre-compensator matrix is the matrix inverse of the DC gain matrix:

(Note: we include D here for completeness, as it can be non-zero in MIMO systems). This calculation ensures that for a constant reference , the steady-state output will equal .

The following resource shows the calculation of this pre-compensator matrix (called ) for a 2-input, 2-output system.

control of a MIMO system in discrete time

This document provides a worked example of designing a state feedback controller for a discrete-time MIMO system. The final step of the design is calculating the matrix Ks to ensure correct steady-state tracking.

Scan through the section 'STATE FEEDBACK CONTROL' (pages 3-5). You don't need to follow every detail of the pole placement calculation. Focus on the final part of the section, starting with 'Finally, we are going to set the Steady State through the matrix Ks'. Look at the final formula for Ks and recognize it as the matrix-inverse of the system's DC gain.


Conclusion

In this lesson, we made the critical transition from designing regulators to designing controllers capable of reference tracking.

Key Takeaways:

  • A standard state feedback controller () is a regulator and will exhibit steady-state error when commanded to follow a non-zero reference.
  • We can eliminate this error for step inputs by introducing a pre-compensator gain , modifying the control law to .
  • The gain is calculated as the inverse of the DC gain of the closed-loop system.
  • This principle applies to both single-output (SISO) systems, where is a scalar, and multi-output (MIMO) systems, where is a matrix.

A Note on Robustness:
As the CTMS article briefly mentioned, this pre-compensator is calculated based on our system model (). If the real-world system differs from the model, or if there are external disturbances (like friction or wind), this open-loop correction will not be perfect, and some steady-state error may reappear.

Preview of the Next Lesson:
To create a controller that is robust to model uncertainty and can actively reject constant disturbances, we need to add feedback for the error itself. In our next lesson, we will explore a powerful technique for doing this: augmenting the state vector with integrator states. This will introduce integral action into our state-space controller, providing a robust solution for achieving zero steady-state error.