PI control
So far, we have only discussed P control, which is a simple and intuitive control strategy. However, P control causes a steady-state error when applied to first and second-order systems. In this section, we take a closer look at steady-state error and how to eliminate it using PI control.
Steady-state error¶
The steady-state error is defined as the difference between the reference input and the output as time goes to infinity. Mathematically, it is
where is the reference and is the output, as in unity feedback shown below.
Figure 1:Standard unity feedback diagram.
To compute the steady-state error for a given input , we should start by finding the transfer function from to . We can do this algebraically, but a useful trick is to redraw the block diagram with as the output instead of . This is shown below.
Figure 2:Redrawn unity feedback diagram with as the output.
From the block diagram, we can see that the transfer function from to is
Now, we can apply the FVT:
If the input is a step, then , and we have
The only way to make this zero is to have . This means that the loop gain must have an integrator. The integrator can be in the plant or in the controller. If our plant contains no integrators, then we must add one to the controller.
An integrator drives the steady-state error to zero robustly: it works regardless of the exact value of the plant’s DC gain, and it also rejects constant disturbances. This is a major advantage over the feedforward approach, which only cancels the error for one precisely-known plant model. Tolerating model error like this is exactly the kind of robustness that makes feedback so powerful.
Example: first-order system¶
Let’s return to the first-order example. If and , then the steady-state error to a step input is
This is the same result we found by looking at the step response in the section on P-control, where we found the steady-state value of the output to be , which means that the steady-state error is .
Now let’s verify that the error becomes zero when we add an integrator to the compensator. Let’s assume (this is called integral control or I-control). The steady-state error is now:
System type¶
If we want to generalize this idea to more complicated reference inputs, we may need to add more integrators. To this end, let’s define the notion of system type.
Some examples:
If , the system is type 0.
If , the system is type 1.
If , the system is type 2.
General result¶
Suppose our reference input looks like , which corresponds to a polynomial input of degree . Then the steady-state error, via Eq. (3), is
This will be:
We can make a table showing when the steady-state error is zero, finite, or infinite for different types of systems and different reference inputs.
Table 1:Steady-state error for different system types and reference inputs
| System type | Impulse () | Step () | Ramp () | Quadratic () |
|---|---|---|---|---|
| 0 | 0 | finite | ||
| 1 | 0 | 0 | finite | |
| 2 | 0 | 0 | 0 | finite |
| 3 | 0 | 0 | 0 | 0 |
Integral (I) control¶
Let’s return to our first-order example:
Here is what we found so far:
Using a P-controller results in a steady-state error .
Using an I-controller results in zero steady-state error.
Unfortunately, the I-controller has poor performance. Let’s take a closer look. The closed-loop transfer function from to using I-control is
As anticipated, the DC gain of this closed-loop transfer function is 1, which means that the steady-state error to a step input is zero. However, this came at a cost. The system is now second-order! Unlike with P-control, making the gain larger does not make the system respond faster. To see why, notice that we will have an underdamped response whenever . In this case, the poles are located at:
We conclude two things:
The real part of the poles is fixed at , so increasing does not make the system respond faster. The system will respond with settling time , which is half the speed of the original first-order system.
The imaginary part of the poles grows with , so increasing makes the system more oscillatory. This is similar to what happened when we tried using P-control on a second-order system.
So clearly, I-control replaced one problem (nonzero steady-state error) with another problem (slow and oscillatory response). The solution to this problem is to use a proportional-integral (PI) controller, which is a combination of a proportional gain and an integrator
Internal model principle (bonus)¶
We have seen that to achieve zero steady-state error when the input is (a step), we need the loop gain to contain an integrator . This is not a coincidence. In fact, to achieve perfect tracking of any reference , the loop gain must contain the same unstable poles as . This is known as the internal model principle.
To see why, apply the FVT to compute the steady-state error:
Suppose has an unstable pole at . In order to apply FVT, the transfer function must be stable, so it cannot have a pole at . The only way to ensure this is to have a pole at in the denominator, which means that must have a pole at . In other words, the loop gain must contain the same unstable pole as the reference input. This argument applies to all unstable poles of , so the loop gain must contain all unstable poles of .
For example, if the reference input is a sinusoid at frequency , then has unstable poles at . To achieve perfect tracking of this sinusoid, the loop gain must contain poles at as well. So if the plant does not contain these poles, the controller must. If it does not, then we may still have a stable closed-loop system, but it will have a nonzero steady-state error to the sinusoidal input.
Proportional-integral (PI) control¶
A proportional-integral (PI) controller, is a combination of a proportional gain and an integrator:
This controller has two tuning parameters, and , which we can adjust to achieve good performance while still maintaining zero steady-state error. The reason this works is that we can rewrite the PI controller as
This still has an integrator, so it still increases the system type by 1 and makes the steady-state error zero, but the numerator gives us more freedom to shape the transient response of the system. In fact, the PI compensator adds a zero to the loop gain at .
Example: first-order system¶
Let’s see how the PI controller works on our first-order example. The closed-loop transfer function from to is
We now have independent control over the real and imaginary parts of the poles, so we can make the system respond as fast as we want without making it more oscillatory. It’s not that straightforward though, because the system also contains a zero, which we saw can have an effect on the transient response (see the section on zeros).
One common approach is to use the zero to cancel one of the poles of the plant. To accomplish this, we would choose:
Now the loop gain is , which is a pure integrator! The closed-loop transfer function is
This is a first-order system with time constant , and DC-gain 1, so we can make the system respond as fast as we want by increasing , without making it more oscillatory, and also maintain zero steady-state error. We get it all! This is a common design strategy for PI controllers: use the zero to cancel one of the poles of the plant, and then tune the gain to achieve the desired speed of response. Of course, the usual caveats about high-gain control still apply.
Examples revisited¶
In the section on P-control and steady-state error, we argued that P-control couldn’t achieve zero steady-state error for a shower temperature control problem and a drone altitude control problem. One way to fix this problem is to control the rate of change of the input rather than the input itself:
For the shower control example, we control whether we increase or decrease the knob angle; not the knob angle itself.
For the drone control example, we control whether we increase or decrease the thrust; not the thrust itself.
If the original thing we were controlling was “position” (knob angle, throttle amount), you can think of this as controlling “velocity” (rate of change of position) instead.
So instead of picking , we pick . Writing out the equations, we have:
As a block diagram, it looks like this:
Figure 3:Unity feedback with velocity control rather than position control. The net effect is that we have added an integrator to the loop gain, thereby increasing the type by 1 and eliminating the steady-state error to a step input if we use P-control.
The net effect of this change is that we have added an integrator to the loop gain, which increases the system type by 1. So now proportional control will achieve zero steady-state error to a step input, which is what we wanted!
That being said, proportional control of the velocity is simply I-control of the original system, and we saw that this didn’t perform well. So while this approach does eliminate the steady-state error, a better approach is to use a PI controller on the position.
Test your knowledge¶
Solution to Exercise 1 #
We use the steady-state error formula for unity feedback:
(a) Proportional control. With and a unit step input ,
Evaluating at ,
To achieve :
Solving,
The steady-state error cannot be made exactly zero with proportional control, since the system is type 0.
(b) Integral control. Now let .
For the step input, we have:
For a unit ramp, , so we find:
So the ramp steady-state error is finite. The system type is type 1 (one integrator in the loop gain).
(c) Proportional–integral control
We design a PI controller by placing its zero to cancel the plant pole at .
Write the PI controller as
To cancel , choose proportional to , i.e.
The loop gain is now:
Therefore, the closed-loop transfer function is first-order:
We can verify that the DC gain is 1, so the steady-state error to a step input is zero. The time constant of this system is , so the settling time is approximately 4 times the time constant:
We want seconds, so
Thus, referring back to Eq. (32), our PI gains are: