# ECE 486 Control Systems

Lecture 9

## Proportional-Integral-Derivative Control

We discussed basic properties and benefits of feedback control. We will introduce Proportional-Integral-Derivative (PID) control today. PID control is the industry standard since 1950’s. The study of its basic features and capabilities includes arbitrary pole placement, reference tracking, and disturbance rejection.

Recall from last time, with feedback control, we can

- reduce steady-state error to disturbances;
- reduce steady-state sensitivity to model uncertainty (parameter variations) and
- improve time response.

So far, we have only looked at **proportional** control (control \(K\) is a scalar
gain) and plants with first order transfer functions. Now we will add two more
basic ingredients and examine their effect on higher-order systems.

### Proportional Control

Consider the following plant transfer function,

\[ G(s) = \frac{1}{s^2-1}. \]

Quick inspection tells us the transfer function \(G(s)\) is not stable since it has a RHP pole at \(s= +1\). \(G(s)\) is also a second order transfer function. It will not be as easy as DC motor, which was first order and stable.

Figure 1: Proportional control with gain \(K_{\rm P}\)

In Figure 1, \(K_{\rm P}\) is the *proportional gain* (sometimes, P-gain)
thus control effort depends on error proportionally, \(U = K_{\rm P}E\).

Let’s find a value of \(K_{\rm P}\) that would stabilize the system, (if this \(K_{\rm P}\) exists)

\begin{align*} \frac{Y}{R}(s) &= \frac{\dfrac{K_{\rm P}}{s^2-1}}{1 + \dfrac{K_{\rm P}}{s^2-1}} \\ \tag{1} \label{d9_eq1} &= \frac{K_{\rm P}}{s^2 - 1 + K_{\rm P}}. \end{align*}
The resulting characteristic polynomial has zero coefficient of the \(s\) term
hence it fails the necessary condition for stability according to
Routh-Hurwitz criterion. The feedback system is not **strictly** stable for **any** value of
\(K_{\rm P}\)! Proportional control only would not work for this plant \(G(s)\).

### Derivative Control

Let’s feed the *derivative of the error* instead; multiplying \(E\) by some gain
\(K_{\rm D}\), back into the plant

Figure 2: Derivative control with gain \(K_{\rm D}\)

Intuitively, derivative term indicates the rate of change; it implies faster the change,
the more the control is needed. But one problem of multiplying \(s\) is that it
is not a **causal** operation. Indeed, taking derivative using **forward
difference**,

\[ \dot{e}(t) \approx \frac{e(t+\delta)-e(t)}{\delta} \text{, for small $\delta$}. \]

When \(\delta > 0\), using \(e(t+\delta)\) means pulling information in the future of \(e(t)\).

Similar argument applies to derivative by **central difference** but one may
argue it might not be a problem with derivative by **backward difference**.

Compute the system transfer function in Figure 2,

\begin{align*} \frac{Y}{R}(s) &= \frac{\dfrac{K_{\rm D}s}{s^2-1}}{1 + \dfrac{K_{\rm D}s}{s^2-1}}\\ &= \frac{K_{\rm D}s}{s^2 + K_{\rm D}s-1}. \end{align*}We see the denominator has a negative coefficient in the constant term, hence this system is closed loop unstable. Also we have picked up a zero at the origin.

Note, by Figure 1, proportional control \(K_{\rm P}\) enters the constant term in the characteristic polynomial. (See Equation \eqref{d9_eq1}.) Here derivative control enters the coefficient of \(s\) term, so we can combine proportional and derivative control to manipulate the poles of a second order transfer function. Before we talk about PD control, below are two caveats on D-control.

#### Two Disclaimers about D-Control

D-control lacks causality and amplifies noise.

- Lack of Causality

First consider single input single output state-space model with zero \(D\) matrix,

\begin{align*} \dot{x} &= Ax + Bu\\ y &= Cx. \end{align*}The transfer function from input \(U(s)\) to \(Y(s)\) is therefore

\begin{align*} \frac{Y}{U}(s) &= C(sI-A)^{-1}B \\ &= \frac{q(s)}{p(s)} \end{align*}for some polynomials \(p(s)\) and \(q(s)\) with \(\deg(q(s)) < \deg(p(s))\), i.e., the system transfer function \(\frac{Y}{U}(s)\) is

**strictly**proper. (Why?*Hint*: For the inverse matrix of \((sI - A)\), it is defined as the ratio of \({\rm adj} (sI - A)\) and \(\det (sI - A)\). The adjugate of \((sI-A)\) depends on its cofactor matrix, which again depends on its minor. A minor is computed by deleting one row and one column, causing the degree of adjugate to be at least \(1\) less than the degree of the determinant.)Similarly, if the \(D\) matrix is nonzero in the state-space model, we consider

\begin{align*} \dot{x} &= Ax + Bu\\ y &= Cx + Du. \end{align*}The transfer function from input \(U(s)\) to \(Y(s)\) is therefore

\begin{align*} \frac{Y}{U}(s) &= C(sI-A)^{-1}B + D \\ &= \frac{q(s)}{p(s)} \end{align*}for some polynomials \(p(s)\) and \(q(s)\). If \(D \neq 0\), then \(\deg (q(s)) = \deg (p(s))\) for the same reason why \(\deg (q(s)) < \deg (p(s))\) when \(D = 0\). (See the hint above.)

In either case, for a causal system we have \(\deg (q(s)) \leq \deg (p(s))\). Hence causal systems have

**proper**transfer functions.This implies the system with transfer function

\[\frac{U}{E}(s) = K s\]

based on derivative feedback \(u(t) = K \dot{e}(t)\) is not causal since the degree of the numerator is greater than the degree of the denominator.

Although \(E \mapsto K_{\rm D} s E\) is not directly implementable, we can use an approximation, e.g.

\[ \frac{K_{\rm D}as}{a+s} \to K_{\rm D}s \text{, let $a \to \infty$}. \]

This can be done using differentiator circuit .

Alternatively, we can approximate derivative operation using finite difference as mentioned above.

\[ \dot{e}(t) \approx \frac{e(t+\delta) - e(t)}{\delta}. \]

In the above forward finite difference, we must tolerate delays since we must wait until time \(t+\delta\) to issue a control signal meant for time \(t\).

- Noise Amplification

Differentiators amplify noise, more on this shall be discussed in Chapter 6. (See page 364, FPE 7th.)

In the lab, D-feedback is implemented differently. Since reference is a constant input signal, differentiating \(e(t) = r - y(t)\) is the same as differentiating \(y(t)\). So the trick used in the lab is to put D-control in the feedback path.

Figure 3: Derivative control gain \(K_{\rm D}\) put in feedback path

This way the system transfer function changes from

\[ \frac{Y}{R}(s) = \frac{K_{\rm D}s G(s)}{1 + K_{\rm D}s G(s)} \hspace{3cm} \text{(by Figure 2)} \] to \[ \frac{Y}{R}(s) = \frac{G(s)}{1+K_{\rm D}sG(s)}. \hspace{2.9cm} \text{(by Figure 3)} \]

The characteristic polynomial stays the same as \(1+K_{\rm D}s G(s)\), though the transfer function now has a different set of zeros. We can manipulate the system poles with \(K_{\rm D}\) by solving \(1+K_{\rm D}sG(s) = 0\) at the same time avoiding differentiating reference \(R(s)\). This rearrangement says the reference signal \(R(s)\) is

**smoothed out**by the plant \(G(s)\) before entering the differentiator \(K_{\rm D}s\). This minimizes distortion due to noise.

### Proportional-Derivative (PD) Control

By Figure 4, the closed loop transfer function is

\begin{align*} \frac{Y}{R}(s) &= \frac{\dfrac{K_{\rm P} + K_{\rm D}s}{s^2-1}}{1 + \dfrac{K_{\rm P} + K_{\rm D}s}{s^2-1}} \\ &= \frac{K_{\rm P} + K_{\rm D}s}{s^2 + K_{\rm D}s + K_{\rm P}-1}. \end{align*}

Figure 4: PD control with proportional control gain \(K_{\rm P}\), derivative control gain \(K_{\rm D}\)

If we set \(K_{\rm D} > 0\) and \(K_{\rm P} > 1\), then the transfer function is guaranteed stable by Example 3 in Lecture 7 of Routh-Hurwitz criterion for second order transfer functions.

As mentioned above, by choosing proportional control gain \(K_{\rm P}\) and
derivative control gain \(K_{\rm D}\), we can
**arbitrarily** assign coefficients of the denominator of closed loop transfer
function, and therefore
manipulating the poles of the transfer function.

**Upshot**: PD control gives us arbitrary pole placement.

Also we note that the addition of proportional control gain \(K_{\rm P}\) moves the zero of the system transfer function,

\[ K_{\rm D}s + K_P = 0, \text{ LHP zero at } -\frac{K_{\rm P}}{K_{\rm D}}. \]

But the DC gain of \(\dfrac{Y}{R}(s)\) is

\begin{align*} \text{DC gain} &= \dfrac{Y}{R}(s)\Bigg|_{s=0} \\ &= \dfrac{K_{\rm P}}{K_{\rm P}-1} \neq 1, \tag{2} \label{d9_eq2} \end{align*}which means we cannot have perfect tracking of constant reference.

### Proportional-Integral-Derivative (PID) Control

We were so close to a “perfect” controller–PD control would give us arbitrary pole placement however it lacks perfect tracking. On top of PD control, we add one more component, that is integral control. Its job is to get rid of steady state error which PD control suffers according to Equation \eqref{d9_eq2}.

\[ U = \left(K_{\rm P} + K_{\rm D}s + \dfrac{K_{\rm I}}{s}\right)E,\text{the classic three-term controller} \]

Now consider PID control diagram with a constant disturbance.

Figure 5: PID control with proportional control gain \(K_{\rm P}\), integral control gain \(K_{\rm I}\) and derivative control gain \(K_{\rm D}\) with presence of input disturbance \(W(s)\)

We will see that with PID control, our goals of

- tracking a constant reference \(r\) and
- rejecting a constant disturbance \(w\)

can be accomplished in one shot.

Based on Figure 5, there are two system input signals, reference \(R(s)\) and disturbance \(W(s)\); one system output signal, \(Y(s)\). Similar to what we did in Lecture 8 for feedback control set-up of DC motor, we want to write output \(Y(s)\) in terms of inputs \(R(s)\) and \(W(s)\),

\begin{align*} Y(s) = \left[ \frac{Y}{R}(s) \right] R(s) + \left[ \frac{Y}{W}(s) \right] W(s). \end{align*}By linearity, to compute transfer function from \(R(s)\) to \(Y(s)\), zero out \(W(s)\) in the diagram in Figure 5, apply (forward gain)/(\(1\) + loop gain) to the standard negative feedback control connection, simplify it, we obtain \[ \frac{Y}{R}(s) = \frac{K_{\rm D}s^2 + K_{\rm P}s + K_{\rm I}}{s^3 + K_{\rm D}s^2 + (K_{\rm P}-1)s + K_{\rm I}}. \]

Similarly, to compute transfer function from \(W(s)\) to \(Y(s)\), zero out \(R(s)\) in the diagram in Figure 5, reshape the diagram such that \(W(s)\) appears as the left most input signal, \(\frac{1}{s^2 - 1}\) as forward path and \(K_{\rm P} + K_{\rm D} s + \frac{K_{\rm I}}s\) as the feedback path, apply (forward gain)/(\(1\) + loop gain) to the reshaped diagram, simplify it, we have \[ \frac{Y}{W}(s) = \frac{s}{s^3 + K_{\rm D}s^2 + (K_{\rm P}-1)s + K_{\rm I}}. \]

Therefore, output \(Y(s)\) in terms of reference input \(R(s)\) and disturbance input \(W(s)\) is

\begin{align*} Y(s) &= \frac{K_{\rm D}s^2 + K_{\rm P}s + K_{\rm I}}{s^3 + K_{\rm D}s^2 + (K_{\rm P}-1)s + K_{\rm I}} R(s) \\ & + \frac{s}{s^3 + K_{\rm D}s^2 + (K_{\rm P}-1)s + K_{\rm I}}W(s). \end{align*}Run stability test as in Example 3 in Lecture 7 of Routh-Hurwitz criterion for third order transfer functions,

- we need all coefficients of characteristic polynomial to be positive, i.e., \(K_{\rm D} > 0\), \(K_{\rm P} > 1\), \(K_{\rm I} > 0\) (necessary condition) and
- on top of this, \(K_{\rm D}(K_{\rm P}-1) > K_{\rm I}\).

Since \(K_{\rm D}\) controls the coefficient of \(s^2\) term, \(K_{\rm P}\) the \(s\) term and \(K_{\rm I}\) the constant term, we can still assign coefficients arbitrarily by choosing \(K_{\rm P}, K_{\rm I}, K_{\rm D}\).

The transfer function from **reference to output** \(\frac{Y}{R}(s)\) has DC gain

therefore with the addition of I-control, we remove earlier limitation of PD
control and achieve **perfect tracking**.

The transfer function from **disturbance to output** \(\frac{Y}{W}(s)\) has DC gain

therefore integral control also gives **complete attenuation** of constant
disturbances, i.e., system is not sensitive to constant disturbance input at all.

**Upshot**: PID gives arbitrary pole placement (PD) and perfect tracking plus
(constant) disturbance rejection (I).

### Wind-Up Phenomenon

When the actuator saturates, the error continues to be integrated, resulting in large overshoot.

Figure 6: Integral control with saturation

We say that the integrator “winds up”–the error may be small, but its integrated past history builds up over time.

There are various anti-windup schemes to deal with this practically important
issue. Essentially, we attempt to detect the onset of saturation and turn
the integrator off. You can check out this `Matlab`

tutorial from Mathworks.

## System Type

The fact that \(\frac{1}s\) leads to perfect tracking of constant references and perfect rejection of constant disturbances is a special case of a more general analysis.

Figure 7: Unity feedback without disturbance

Consider the reference input \(r(t) = \dfrac{t^k}{k!}1(t)\), its Laplace transform \(R(s) = \dfrac{1}{s^{k+1}}\). Based on Figure 7, the error signal

\begin{align*} E &= \dfrac{1}{1+KP}R \\ &= \dfrac{1}{1+KP}\dfrac{1}{s^{k+1}}.\tag{3} \label{d9_eq3} \end{align*}Assuming stability, Final Value Theorem gives

\begin{align*} e(\infty) &= sE(s) \Big|_{s=0} \\ &= \dfrac{1}{1+KP} \frac{1}{s^{k}} \Bigg|_{s=0}. \end{align*}Let’s see how the forward path transfer function \(KP(s)\) affects tracking performance.

We define *system type* as the order of poles of the forward path transfer
function \(KP(s)\) at origin.
\[
KP(s) = {H(s)}\frac{1}{s^n}, \tag{4} \label{d9_eq4}
\]
where \(H(s)\) has no poles at origin. Factorization in Equation \eqref{d9_eq4}
says \(s^n\) sucks out all the powers of \(s\) in the denominator of \(KP(s)\).

System type is also the degree of the lowest-degree polynomial as input signal that cannot be tracked in feedback with zero steady-state error.

**Note**: The system type is defined or calculated from the **forward path**
transfer function, although we are talking about system type of the
**closed-loop system**.

Suppose that \(KP(s)\) has $n$th-order pole at \(s=0\), then \(KP(s) = \dfrac{K_0}{s^n}\),

\begin{align*} sE(s) &= \frac{1}{\left(1 + \frac{K_0}{s^n}\right)s^k} \\ &= \frac{s^{n-k}}{s^n + K_0}. \end{align*}Pass \(sE(s)\) to the limit and recall reference \(r(t)\) is a polynomial of degree \(k\),

\begin{align*} e(\infty) &= sE(s)\Big|_{s=0} \\ &= \left\{ \begin{array}{ll} 0, & \text{ $n > k$, perfect tracking} \\ \text{nonzero const,} & \text{ $n = k$, imperfect tracking} \\ \infty, & \text{ $n < k$, no tracking} \end{array} \right. \end{align*}As an example, we take a look at the small cases for \(n\).

- Type \(0\): There is no pole of \(KP(s)\) at the origin. This is what we saw without the integral control–There was nonzero steady state error to constant references.
- Type \(1\): There is a single pole at the origin. This is what we saw with
I-control–It can track constant references, reject constant disturbances with zero error.
- We can also check that there is a nonzero (but finite) error when tracking ramp reference inputs.

- Type \(2\): There are a double pole at the origin. It can track ramp references without error, but not for higher order polynomial inputs \(t^2, t^3, \ldots\) etc.

## PID Control: Summary and Further Comments

In today’s lecture, we saw

- Proportional control, is the simplest to implement, but not always sufficient for stabilization.
- Derivative control, helps achieve stability, improves time response, i.e., more
control over pole locations.
- PD control gives arbitrary pole placement (only valid for second order
response); in general though, we still have control over two
**dominant poles**. - Derivative control cannot be implemented directly, so need approximate implementation; D-control also amplifies noise.

- PD control gives arbitrary pole placement (only valid for second order
response); in general though, we still have control over two
- Integral control, is essential for perfect steady-state tracking of
constant reference and rejection of constant disturbance.
- The element \(\frac{1}s\) is not a stable by itself, so one must be careful. It can destabilize the system if the feedback loop is broken because integrator winds up.