Part 9 - Discrete Systems

Introduction

All signals we have dealt with so far have been continuous-time signals, i.e., they are defined for all <t<+-\infty < t < +\infty

Each device in the system such as the controller, plant or a sensor can be viewed as a signal processor or filter.

The relation between input and output is described by a transfer fucntion in the ss-domain or a differential equation in the time-domain.

Analog computers can be made by RLC (Resistor, Inductor, Capacitor) circuits plus OP-AMPs (Operational Amplifiers).

However, the cost of these devices are high, they’re heavy and bulky, and sensitive to noise. Too many drawbacks.

From Continuous to Discrete

Previously, all signals have been continuously variables (analogue) and defined for all instants in time.

Because controllers are now usually implemented on computers, we must deal with signal which are discrete in nature.

  • Discrete-time
    • Signals are determined only at certain instants in time (multiple of TUT_U).
  • Discrete-value
    • Signals are allowed only to have certain discrete values at any time step (multiples of ΔV\Delta V.

Discrete values levels arise because of fixed resolution of A-to-D (and D-to-A) converters.

Discrete times arise because of fixed update rate of computer-based controllers.

A/D Converter (ADC)

A/D converter is a device that converts a continuous-time signal e(t)e(t) into a discrete-time signal.

Assume,

e(t)={cos(t)t0 0t<0e(t) = \begin{cases} \cos(t) & \quad t \geq 0 \ 0 & \quad t < 0 \end{cases}

Then, the discrete-time signal is,

e(kT)={cos(kT)k=0,1,2, 0k=1,2,3,e(kT) = \begin{cases} \cos(kT) & \quad k = 0, 1, 2, \ldots \ 0 & \quad k = -1, -2, -3, \ldots \end{cases}

where T>0T > 0 is called the sample period in seconds, 1T>0\frac{1}{T} > 0 is called the sample rate in Hz.

Note that e(kT)e(kT) is only defined for integer values of kk. It is undefined between kT<t<(k+1)TkT < t < (k + 1)T, k=0,±1,±2,k = 0, \pm 1, \pm 2, \ldots.

Thus, e(kT)e(kT) is called discrete-time (DT) signal. We usually just write e(k)e(k).

A digital processor is a discrete-time device that takes a discrete-time signal as input and produces a discrete-time signal as output according to a certain algortihm (difference equation, more on this later).

D/A Converter (DAC)

A D/A converter is a device that converts a DT signal into a CT signal.

An example is the zero-order hold DAC, in which the output is held constant between samples.

Difference Equation and Discrete-Time System

A discrete-time system is described by a difference equation of the form,

y(k)=b0u(k)+b1u(k1)++bnu(kn)a1y(k1)any(kn)k0.\begin{align*} y(k) & = b_0 u(k) + b_1 u(k - 1) + \ldots + b_n u(k - n) \newline & \quad - a_1 y(k - 1) - \ldots - a_n y(k - n) \quad k \geq 0. \end{align*}

where b0,,bn,a1,,anb_0, \ldots, b_n, a_1, \ldots, a_n are real constants, and an0a_n \neq 0.

u(k),k=0,1,u(k), k = 0, 1, \ldots is a given DT signal called the input of the system.

y(k),k=0,1,y(k), k = 0, 1, \ldots is obtained by the above equation and is called the output of the system. We will assume y(k)=0,k<0y(k) = 0, k < 0.

nn is the order of the system.

The difference equation can also be written as,

y(k+n)=b0u(k+n)+b1u(k+n1)++bnu(k)a1y(k+n1)any(k)k0.\begin{align*} y(k + n ) & = b_0 u(k + n) + b_1 u(k + n - 1) + \ldots + b_n u(k) \newline & \quad - a_1 y(k + n - 1) - \ldots - a_n y(k) \quad k \geq 0. \end{align*}

This is the same equation, but we have replaced kk with k+nk + n.

Example

Consider the difference equation,

y(k)=2u(k)+3y(k1)2y(k2)y(k) = 2u(k) + 3y(k - 1) - 2y(k - 2)

where u(k){kk00k<0u(k) \begin{cases} k & k \geq 0 \newline 0 & k < 0 \end{cases}

By definition we have,

y(0)=2u(0)=0y(1)=2u(1)+3y(0)=2y(2)=2u(2)+3y(1)2y(0)=10\begin{align*} y(0) &= 2u(0) = 0 \newline y(1) &= 2u(1) + 3y(0) = 2 \newline y(2) &= 2u(2) + 3y(1) - 2y(0) = 10 \newline \end{align*}

We can also solve this with the ZZ-transform.

The ZZ-transform is a discrete counterpart of the Laplace transform.

Let’s first recall an important property of the Laplace transform. With continuous systems, ss is an *operator. Multiplying a signal by ss differentiates that signal in the time domain. Division by ss integrates the signal.

With discrete-time systems, zz is also an operator. Multiplying a signal by zz advance that signal one “tick” in time. Division by zz delays the signal by one “tick”.

Assume {f(k)}\{f(k)\} is a discrete-time signal with f(k)=0,k<0f(k) = 0, k < 0. Then,

F(z)=k=0f(k)zkZ{f(k)}F(z) = \sum_{k=0}^{\infty} f(k)z^{-k} \triangleq \mathcal{Z}\{f(k)\}

where zz is a complex variable, and is called the Z\mathcal{Z}-transform of f(k)f(k).

Remark: F(z)F(z) is a power series of z1z^{-1}, which usually converges to a rational function.

Examples

Let’s start easy with the impulse function,

f(k)={1k=00k0f(k) = \begin{cases} 1 & k = 0 \newline 0 & k \neq 0 \end{cases}

Then,

F(z))k=0f(k)zk=1F(z) ) \sum_{k=0}^{\infty} f(k)z^{-k} = 1

Another example is the unit step function,

f(k)={1k=0,1,2,0k<0f(k) = \begin{cases} 1 & k = 0, 1, 2, \ldots \newline 0 & k < 0 \end{cases}

Then,

F(z)=k=0f(k)zk=k=0zk=11z1=zz1,F(z) = \sum_{k=0}^{\infty} f(k)z^{-k} = \sum_{k=0}^{\infty} z^{-k} = \frac{1}{1 - z^{-1}} = \frac{z}{z - 1},

since the power series of 1+x+x2+1 + x + x^2 + \ldots is 11x\frac{1}{1 - x}.

Remark

We will assume that the discrete-time signal f(k)f(k) is obtained by sampling a continuous-time signal f(t)f(t), i.e., f(k)f(kT)f(k) \triangleq f(kT) where TT is the sample period. We will use the notation Z{f(t)}\mathcal{Z}\{f(t)\} or Z{F(s)}\mathcal{Z}\{F(s)\} or Z{f(k)}\mathcal{Z}\{f(k)\} to mean k=0f(kT)zk\sum_{k=0}^{\infty} f(kT) z^{-k}.

Properties of the Z\mathcal{Z}-transform

  1. Linearity: Assume Z{f1(k)}=F1(z)\mathcal{Z}\{f_1(k)\} = F_1(z) and Z{f2(k)}=F2(z)\mathcal{Z}\{f_2(k)\} = F_2(z). Then,
Z{af1(k)+bf2(k)}=aF1(z)+bF2(z)\mathcal{Z}\{af_1(k) + bf_2(k)\} = aF_1(z) + bF_2(z)

for any constants aa and bb.

  1. Shifting Theorem: Assume Z{f(k)}=F(z)\mathcal{Z}\{f(k)\} = F(z). Then for any positive integer nn,
Z{f(kn)}k=0f(kn)zk=znF(z)\mathcal{Z}\{f(k - n)\} \triangleq \sum_{k=0}^{\infty} f(k - n)z^{-k} = z^{-n}F(z)
  1. Final Value Theorem: Assume X(z)=Z{x(k)}X(z) = \mathcal{Z}\{x(k)\} and all the poles of (1z1)X(z)(1 - z^{-1})X(z) are inside the unit circle. Then,
limkx(k)=limz1(1z1)X(z)\lim_{k \to \infty} x(k) = \lim_{z \to 1} (1 - z^{-1})X(z)

Transfer Function of a DT System

Given,

y(k)=b0u(k)+b1u(k1)++bnu(kn)a1y(k1)any(kn)k0\begin{align*} y(k) & = b_0 u(k) + b_1 u(k - 1) + \ldots + b_n u(k - n) \newline & \quad - a_1 y(k - 1) - \ldots - a_n y(k - n) \quad k \geq 0 \end{align*}

Assume Y(z)=Z{y(k)},U(z)=Z{u(k)}Y(z) = \mathcal{Z}\{y(k)\}, U(z) = \mathcal{Z}\{u(k)\}. Then Y(z)U(z)\frac{Y(z)}{U(z)} is called the transfer function of the above difference equation, and,

Y(z)U(z)=b0+b1z1++bnzn1+a1z1++anzn=b0zn+b1zn1++bnzn+a1zn1++an\frac{Y(z)}{U(z)} = \frac{b_0 + b_1 z^{-1} + \ldots + b_n z^{-n}}{1 + a_1 z^{-1} + \ldots + a_n z^{-n}} = \frac{b_0 z^n + b_1 z^{n - 1} + \ldots + b_n}{z^n + a_1 z^{n - 1} + \ldots + a_n}
Example

Let y(k)=2u(k)+3y(k1)2y(k2)y(k) = 2u(k) + 3y(k - 1) - 2y(k - 2)

Then the transfer function is,

Y(z)U(z)=213z1+2z2\frac{Y(z)}{U(z)} = \frac{2}{1 - 3z^{-1} + 2z^{-2}}

Stability of DT Systems

We have discussed what BIBO stability means for continuous-time systems. We can define the same for discrete-time systems.

A DT system is said to be BIBO stable if,

u(k)<M1|u(k)| < M_1

for all kk, and some finite M1M_1 implies,

y(k)<M2|y(k)| < M_2

for all kk and some finite M2M_2.

The stability criterion for DT systems is the following.

Let,

D(z)=β(z)α(z)=b0zn+b1zn1++bnzn+a1zn1++anD(z) = \frac{\beta(z)}{\alpha(z)} = \frac{b_0 z^n + b_1 z^{n - 1} + \ldots + b_n}{z^n + a_1 z^{n - 1} + \ldots + a_n}

Assume z1,,znz_1, \ldots, z_n are the poles of D(z)D(z), i.e., α(zi)=0,i=1,,n\alpha(z_i) = 0, i = 1, \ldots , n. Then D(z)D(z) is (BIBO) stable if,

zi<1,i=1,,n|z_i| < 1, i = 1, \ldots, n

and D(z)D(z) is not (BIBO) stable if there exists at least one i such that,

zi1|z_i| \geq 1

In reality, if a pole lies on the unit circle, we have a marginally stable system, but we will consider these as unstable for simplicity.

Relation of Poles of F(s)F(s) and F(z)F(z)

Consider,

f(t)={eatt00t<0f(t) = \begin{cases} e^{-at} & t \geq 0 \newline 0 & t < 0 \end{cases}

Then,

F(s)L{f(t)}=1s+a.F(s) \triangleq \mathcal{L}\{f(t)\} = \frac{1}{s + a}.

We can see this has a pole at s=as = -a.

On the other hand, let,

F(z)=Z{eakT}=zzeaTF(z) = \mathcal{Z}\{e^{-akT}\} = \frac{z}{z - e^{-aT}}

which has a pole at z=eaTz = e^{-aT}.

Conclusion: Given f(t)f(t) and sampling period TT, assume F(s)=L{f(t)}F(s) = \mathcal{L}\{f(t)\} and F(z)=Z{f(k)}F(z) = \mathcal{Z}\{f(k)\}. Then the poles of F(s)F(s) and F(z)F(z) are related by,

z=esTz = e^{sT}

Let s=σ+jωs = \sigma + j \omega. Then z=eσTejωTz = e^{\sigma T} e^{j \omega T}. Clearly,

z<1if and only ifσ<0|z| < 1 \quad \text{if and only if} \quad \sigma < 0

Thus a DT system is (BIBO) stable if and only if all its poles are strictly inside the unit circle.

From Continuous to Discrete

Tustin’s approximation is a method to convert a continuous-time transfer function to a discrete-time transfer function.

z=esT=esT/2esT/21+sT/21sT/2z = e^{sT} = \frac{e^{sT/2}}{e^{-sT/2}} \approxeq \frac{1 + sT/2}{1 - sT/2}

where ss,

s=2Tz1z+1s = \frac{2}{T} \frac{z - 1}{z + 1}
Example

Let G(s)=(1+3.2s)(1+0.2s)G(s) = \frac{(1 + 3.2s)}{(1 + 0.2s)} with an update-time of T=0.2sT = 0.2s

Firstly,

s=20.2z1z+1=10z1z+1s = \frac{2}{0.2} \frac{z - 1}{z + 1} = 10 \frac{z - 1}{z + 1}

Then,

G(z)=(1+3.2(10(z1)/(z+1)))(1+0.2(10(z1)/(z+1)))=(1+32(z1)/(z+1))(1+2(z1)/(z+1))=(z+31)(z+3)G(z) = \frac{(1 + 3.2(10(z - 1)/(z + 1)))}{(1 + 0.2(10(z - 1)/(z + 1)))} = \frac{(1 + 32(z - 1)/(z + 1))}{(1 + 2(z - 1)/(z + 1))} = \frac{(z + 31)}{(z + 3)}

If this transfer function represents the relationship between an output signal C(z)C(z) and an input signal E(z)E(z), then the expression,

C(z)E(z)=(z+31)(z+3)\frac{C(z)}{E(z)} = \frac{(z + 31)}{(z + 3)}

We can rewrite this as,

C(z)(z+3)=E(z)(z+31)=zC(z)+3C(z)=zE(z)+31E(z)C(z)(z + 3) = E(z)(z + 31) = zC(z) + 3C(z) = zE(z) + 31E(z)

This is the difference equation of the system. Let’s take the inverse zz-transform of this equation.

c(k+1)+3c(k)=e(k+1)+31e(k)c(k + 1) + 3c(k) = e(k + 1) + 31e(k)

Controller Design

Given a continuous plant G(s)G(s), a reference input r(t)r(t), and some control specifications, find a digital controller (A/D, difference equation, D/A), such that the control specifications are satisfied.

One can do this in two following ways.

  1. Emulation
    • Design a continuous controller D(s)D(s) (differential equation).
    • Approximate D(s)D(s) by a difference equation.
  2. Discrete Design
    • Design difference equation directly without designing D(s)D(s) first.

Design by Emulation

Given an analog controller D(s)D(s), find TT and D(z)D(z) such that the digital implementation of D(s)D(s) has an input-output relation similar to that of D(s)D(s).

In other words, TT and D(z)D(z) are subject to ud(t)u(t)u_d(t) \approx u(t) for the same e(t),t0e(t), t \geq 0

There are two methods to do this

  1. Tustin’s Method (as we have seen)
  2. Matched Pole-Zero (MPZ) Method
Tustin’s Method

Tustin’s method is defined as,

D(z)=D(s)s=2Tz1z+1D(z) = D(s) \Big|_{s = \frac{2}{T} \frac{z - 1}{z + 1}}

We call s=2Tz1z+1s = \frac{2}{T} \frac{z - 1}{z + 1} as a bilinear transformation or Tustin’s transformation.

We also call the above equation as Tustin’s method for designing digital controllers.

Remark: For Tustin’ts method, the task at each step is to use a trapezoidal integration, that is, to approximate e(t)e(t) by a straight line between two samples.

Let’s see an example.

Given D(s)=70s+2s+10D(s) = 70 \frac{s + 2}{s + 10} and T=115T = \frac{1}{15}.

Firstly,

s=2Tz1z+1=30z1z+1s = \frac{2}{T} \frac{z - 1}{z + 1} = 30 \frac{z - 1}{z + 1}

Then,

D(z)=D(s)s=30z1z+1=7030z1z+1+230z1z+1+10=7030z+2830z+40D(z) = D(s) \Big|_{s = 30 \frac{z - 1}{z + 1}} = 70 \frac{30 \frac{z - 1}{z + 1} + 2}{30 \frac{z - 1}{z + 1} + 10} = 70 \frac{30z + 28}{30z + 40}
Matched Pole-Zero (MPZ) Method

Given a CT controller,

D(s)=kc(s+a)s+b,a>0,b>0D(s) = \frac{k_c(s + a)}{s + b}, \quad a > 0, b > 0

Find a DT controller of the form,

D(z)=kd(zza)zzbD(z) = \frac{k_d(z - z_a)}{z - z_b}

so that the behavior of the DT controller is similar to that of the CT controller.

To find this, we do the following.

Map poles and zeroes according to,

z=esTz = e^{sT}

wich gives za=eaTz_a = e^{-aT} and zb=ebTz_b = e^{-bT}.

Thus,

D(z)=kd(zeaT)zebTD(z) = \frac{k_d(z - e^{-aT})}{z - e^{-bT}}

Then we need to determine kdk_d such that,

DC gain of D(s)=DC gain of D(z)\text{DC gain of } D(s) = \text{DC gain of } D(z)

Thus,

DC gain =lims0sY(s)=lims0sD(s)U(s)=lims0skc(s+a)s+b1s=D(0)=kcab\begin{align*} \text{DC gain } & = \lim_{s \to 0} sY(s) = \lim_{s \to 0} sD(s) U(s) \newline & = \lim_{s \to 0} s \frac{k_c(s + a)}{s + b} \frac{1}{s} = D(0) = \frac{k_c a}{b} \end{align*}

For DT systems, the DC gain is also defined as the final value of the output under the unit step input.

Thus,

DC gain =limz1(1z1)D(z)U(z)=limz1(1z1)kd(zeaT)zebT11z1=limz1kdzeaTzebT=D(1)=kd(1eaT)1ebT\begin{align*} \text{DC gain } &= \lim_{z \to 1} (1 - z^{-1})D(z)U(z) \newline &= \lim_{z \to 1} (1 - z^{-1}) \frac{k_d(z - e^{-aT})}{z - e^{-bT}} \frac{1}{1 - z^{-1}} \newline &= \lim_{z \to 1} k_d \frac{z - e^{-aT}}{z - e^{-bT}} = D(1) = \frac{k_d (1 - e^{-aT})}{1 - e^{-bT}} \end{align*}

Thus,

kcab=kd(1eaT)1ebT\frac{k_c a}{b} = \frac{k_d (1 - e^{-aT})}{1 - e^{-bT}}

and we can solve for kdk_d,

kd=kca(1ebT)b(1eaT)k_d = \frac{k_c a (1 - e^{-bT})}{b (1 - e^{-aT})}

Let’s see an example.

Given G(s)=1s2G(s) = \frac{1}{s^2}, design a digital controller so that the closed-loop system has a natural frequency ωn=0.3rads\omega_n = 0.3 \frac{rad}{s} and a damping ratio ζ=0.7\zeta = 0.7.

Suppose a CT controller has been designed as,

D(s)=0.81s+0.2s+2.D(s) = 0.81 \frac{s + 0.2}{s + 2}.

We first need to find TT. A rule of thumb of TT is that the sample rate satifes,

ωs2πT>20ωn\omega_s \triangleq \frac{2 \pi}{T} > 20 \omega_n

Letting 2πT=20ωn=6\frac{2 \pi}{T} = 20 \omega_n = 6, thus T6T \approx 6.

Which means eaT=0.82e^{-aT} = 0.82 and ebT=0.135e^{-bT} = 0.135.

Finally, we can find kdk_d,

kd=0.810.2(10.135)2(10.82)=0.1k_d = \frac{0.81 \cdot 0.2 \cdot (1 - 0.135)}{2 \cdot (1 - 0.82)} = 0.1

Thus,

D(z)=0.1z0.82z0.135D(z) = 0.1 \frac{z - 0.82}{z - 0.135}