Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

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

ess=limte(t)=limt(r(t)y(t))e_{ss} = \lim_{t \to \infty} e(t) = \lim_{t \to \infty} (r(t) - y(t))

where r(t)r(t) is the reference and y(t)y(t) is the output, as in unity feedback shown below.

Standard unity feedback diagram.

Figure 1:Standard unity feedback diagram.

To compute the steady-state error for a given input r(t)r(t), we should start by finding the transfer function from rr to ee. We can do this algebraically, but a useful trick is to redraw the block diagram with ee as the output instead of yy. This is shown below.

Redrawn unity feedback diagram with e as the output.

Figure 2:Redrawn unity feedback diagram with ee as the output.

From the block diagram, we can see that the transfer function from rr to ee is

E(s)R(s)=(forward path)1+(loop gain)=11+G(s)C(s)\frac{E(s)}{R(s)} = \frac{\textsf{(forward path})}{1 + \textsf{(loop gain)}} = \frac{1}{1 + G(s)C(s)}

Now, we can apply the FVT:

ess=lims0sE(s)=lims0sR(s)1+G(s)C(s)\begin{aligned} e_{ss} &= \lim_{s \to 0} s E(s) \\ &= \lim_{s \to 0} \frac{sR(s)}{1 + G(s)C(s)} \end{aligned}

If the input is a step, then R(s)=1/sR(s) = 1/s, and we have

ess=lims011+G(s)C(s)e_{ss} = \lim_{s \to 0} \frac{1}{1 + G(s)C(s)}

The only way to make this zero is to have lims0G(s)C(s)=\lim_{s \to 0} G(s)C(s) = \infty. 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.

Example: first-order system

Let’s return to the first-order example. If G(s)=1τs+1G(s) = \frac{1}{\tau s + 1} and C(s)=kC(s) = k, then the steady-state error to a step input is

ess=lims011+kτs+1=11+k0e_{ss} = \lim_{s \to 0} \frac{1}{1 + \frac{k}{\tau s + 1}} = \frac{1}{1 + k} \neq 0

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 yss=k1+ky_{ss} = \frac{k}{1 + k}, which means that the steady-state error is ess=1yss=11+ke_{ss} = 1 - y_{ss} = \frac{1}{1 + k}.

Now let’s verify that the error becomes zero when we add an integrator to the compensator. Let’s assume C(s)=ksC(s) = \frac{k}{s} (this is called integral control or I-control). The steady-state error is now:

ess=lims011+ks(τs+1)=lims0s(τs+1)s(τs+1)+k=0e_{ss} = \lim_{s \to 0} \frac{1}{1 + \frac{k}{s(\tau s + 1)}} = \lim_{s \to 0} \frac{s(\tau s + 1)}{s(\tau s + 1) + k} = 0

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:

General result

Suppose our reference input looks like 1sm+1\frac{1}{s^{m+1}}, which corresponds to a polynomial input of degree mm. Then the steady-state error, via Eq. (3), is

ess=lims0sR(s)1+G(s)C(s)=lims011+G(s)C(s)1sm\begin{aligned} e_{ss} &= \lim_{s \to 0} \frac{sR(s)}{1 + G(s)C(s)} \\ &= \lim_{s \to 0} \frac{1}{1 + G(s)C(s)} \cdot \frac{1}{s^{m}} \end{aligned}

This will be:

ess={if the system is type <mfiniteif the system is type m0if the system is type >me_{ss} = \begin{cases} \infty & \textsf{if the system is type } < m \\ \textsf{finite} & \textsf{if the system is type } m \\ 0 & \textsf{if the system is type } > m \end{cases}

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 typeImpulse (11 )Step (1s\frac{1}{s})Ramp (1s2\frac{1}{s^2})Quadratic (1s3\frac{1}{s^3})
00finite\infty\infty
100finite\infty
2000finite
30000

Integral (I) control

Let’s return to our first-order example:

G(s)=1τs+1G(s) = \frac{1}{\tau s + 1}

Here is what we found so far:

Unfortunately, the I-controller has poor performance. Let’s take a closer look. The closed-loop transfer function from rr to yy using I-control is

GCL(s)=G(s)C(s)1+G(s)C(s)=ks(τs+1)1+ks(τs+1)=kτs2+s+k=kτs2+1τs+kτ\begin{aligned} G_\textsf{CL}(s) &= \frac{G(s)C(s)}{1 + G(s)C(s)} \\ &= \frac{\frac{k}{s(\tau s + 1)}}{1 + \frac{k}{s(\tau s + 1)}} \\ &= \frac{k}{\tau s^2 + s + k} \\ &= \frac{\frac{k}{\tau}}{s^2 + \frac{1}{\tau}s + \frac{k}{\tau}} \end{aligned}

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 kk larger does not make the system respond faster. To see why, notice that we will have an underdamped response whenever k>14τk > \frac{1}{4\tau}. In this case, the poles are located at:

s=12τ±jkτ14τ2s = -\frac{1}{2\tau} \pm j\sqrt{\frac{k}{\tau} - \frac{1}{4\tau^2}}

We conclude two things:

  1. The real part of the poles is fixed at 12τ-\frac{1}{2\tau}, so increasing kk does not make the system respond faster. The system will respond with settling time 8τ8\tau, which is half the speed of the original first-order system.

  2. The imaginary part of the poles grows with kk, so increasing kk 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

Proportional-integral (PI) control

A proportional-integral (PI) controller, is a combination of a proportional gain and an integrator:

C(s)=kp+kisC(s) = k_p + \frac{k_i}{s}

This controller has two tuning parameters, kpk_p and kik_i, 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

C(s)=kps+kisC(s) = \frac{k_p s + k_i}{s}

This still has an integrator, so it still increases the system type by 1 and makes the steady-state error zero, but the numerator kps+kik_p s + k_i 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 s=kikps = -\frac{k_i}{k_p}.

Example: first-order system

Let’s see how the PI controller works on our first-order example. The closed-loop transfer function from rr to yy is

GCL(s)=G(s)C(s)1+G(s)C(s)=kps+kis(τs+1)1+kps+kis(τs+1)=kps+kiτs2+(1+kp)s+ki\begin{aligned} G_\textsf{CL}(s) &= \frac{G(s)C(s)}{1 + G(s)C(s)} \\ &= \frac{\frac{k_p s + k_i}{s(\tau s + 1)}}{1 + \frac{k_p s + k_i}{s(\tau s + 1)}} \\ &= \frac{k_p s + k_i}{\tau s^2 + (1 + k_p)s + k_i} \end{aligned}

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:

C(s)=k(τs+1)sC(s) = \frac{k(\tau s + 1)}{s}

Now the loop gain is G(s)C(s)=ksG(s)C(s) = \frac{k}{s}, which is a pure integrator! The closed-loop transfer function is

GCL(s)=ks1+ks=ks+kG_\textsf{CL}(s) = \frac{\frac{k}{s}}{1 + \frac{k}{s}} = \frac{k}{s + k}

This is a first-order system with time constant 1k\frac{1}{k}, and DC-gain 1, so we can make the system respond as fast as we want by increasing kk, 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:

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 uu, we pick v=u˙v = \dot u. Writing out the equations, we have:

Y(s)=G(s)U(s)(plant equation)U(s)=1sV(s)(definition of v)V(s)=C(s)E(s)(compensator)\begin{aligned} Y(s) &= G(s)U(s) && \textsf{(plant equation)} \\ U(s) &= \frac{1}{s}V(s) && \textsf{(definition of }v\textsf{)} \\ V(s) &= C(s) E(s) && \textsf{(compensator)} \end{aligned}

As a block diagram, it looks like this:

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.

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:

ess=lims0sR(s)1+G(s)C(s).e_{ss} = \lim_{s\to 0} \frac{sR(s)}{1+G(s)C(s)}.

(a) Proportional control. With C(s)=kC(s)=k and a unit step input R(s)=1/sR(s)=1/s,

ess=lims011+G(s)C(s)=lims011+5ks+2.e_{ss} = \lim_{s\to 0} \frac{1}{1+G(s)C(s)} = \lim_{s\to 0} \frac{1}{1+\frac{5k}{s+2}}.

Evaluating at s=0s=0,

ess=11+5k2=22+5k.e_{ss} = \frac{1}{1+\frac{5k}{2}} = \frac{2}{2+5k}.

To achieve ess0.05e_{ss} \le 0.05:

22+5k0.05.\frac{2}{2+5k} \le 0.05.

Solving,

20.05(2+5k)20.1+0.25k1.90.25kk7.6.\begin{aligned} 2 &\le 0.05(2+5k) \\ 2 &\le 0.1 + 0.25k \\ 1.9 &\le 0.25k \\ k &\ge 7.6. \end{aligned}

The steady-state error cannot be made exactly zero with proportional control, since the system is type 0.

(b) Integral control. Now let C(s)=ksC(s)=\frac{k}{s}.

For the step input, we have:

ess=lims011+5ks(s+2)=0e_{ss} = \lim_{s\to 0} \frac{1}{1+\frac{5k}{s(s+2)}} = 0

For a unit ramp, R(s)=1/s2R(s)=1/s^2, so we find:

ess=lims011+5ks(s+2)1s=25k.e_{ss} = \lim_{s\to 0} \frac{1}{1+\frac{5k}{s(s+2)}} \cdot \frac{1}{s} = \frac{2}{5k}.

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 s=2s=-2.
Write the PI controller as

C(s)=kp+kis=kps+kis.C(s)=k_p+\frac{k_i}{s}=\frac{k_ps+k_i}{s}.

To cancel s+2s+2, choose kps+kik_ps+k_i proportional to s+2s+2, i.e.

kps+ki=k(s+2)    kp=k,    ki=2k.k_ps+k_i = k (s+2) \quad\implies\quad k_p=k,\;\; k_i=2k.

The loop gain is now:

G(s)C(s)=5s+2k(s+2)s=5ks.G(s)C(s) = \frac{5}{s+2}\cdot \frac{k(s+2)}{s} = \frac{5k}{s}.

Therefore, the closed-loop transfer function is first-order:

GCL(s)=5ks1+5ks=5ks+5k.G_\textsf{CL}(s) = \frac{\frac{5k}{s}}{1 + \frac{5k}{s}} = \frac{5k}{s + 5k}.

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 15k\frac{1}{5k}, so the settling time is approximately 4 times the time constant:

ts45k.t_s \approx \frac{4}{5k}.

We want ts=2t_s=2 seconds, so

45k=2            k=0.4.\frac{4}{5k}=2 \;\;\implies\;\; k=0.4.

Thus, referring back to Eq. (31), our PI gains are:

kp=0.4,ki=0.8.k_p = 0.4, \qquad k_i = 0.8.