2A2 Discrete Systems

1 downloads 0 Views 793KB Size Report
G F Franklin, J D Powell & M Workman Digital Control of Dynamic Sys- tems 3rd ... on material previous produced for related courses by Will Moore and Ron.
CONTENTS

2

Contents

2A2 Discrete Systems 4 lectures Hilary Term 2014 Tutorial sheet 2A2H

Mark Cannon [email protected]

1 Introduction 1.1 Example – Engine management system . . . . . . . . . . . . .

4

1.2 Recommended text . . . . . . . . . . . . . . . . . . . . . . . . .

6

1.3 Lecture notes . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6

2 Fast sampling control systems Syllabus Fast-sampling digital systems, zero-order hold. Effect of sample rate on control systems. Converting differential equations to difference equations. The z-transform. Obtaining z-transforms for continuous systems plus zero order hold using Laplace transfer functions. Properties of z-transforms. Mapping from s-plane to z-plane. Significance of pole position. Discrete time system specifications.

4

7

2.1 Digitization . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7

2.2 Sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

2.3 Reconstruction . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

2.4 Nyquist’s Sampling Theorem and aliasing . . . . . . . . . . . .

9

2.5 Euler’s approximation . . . . . . . . . . . . . . . . . . . . . . . 10 2.6 Effects of sampling . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.7 PID control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.8 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Lectures 1. Sample rate selection and implementation of continuous control systems approximately in discrete time. 2. Transfer function representations of difference equations and z-transforms of sequences. 3. Discrete time models of continuous time systems. 4. Step response, transfer function poles and control system specifications.

2.9 Summary of section 2 . . . . . . . . . . . . . . . . . . . . . . . 19 3 Discrete Systems Analysis

20

3.1 Linear Recurrence Equations . . . . . . . . . . . . . . . . . . . 20 3.2 The discrete transfer function . . . . . . . . . . . . . . . . . . . 20 3.3 The z-Transform . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.4 Pulse response . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3.5 Convolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 3.6 Summary of section 3 . . . . . . . . . . . . . . . . . . . . . . . 30

CONTENTS

3

4 Discrete models of sampled data systems

31

4.1 More on z-transforms . . . . . . . . . . . . . . . . . . . . . . . 31

4

1

Introduction

4.2 Properties of the z-transform . . . . . . . . . . . . . . . . . . . 32

This course is about discrete time systems – dynamic systems whose inputs and outputs are defined at discrete time instants. We will consider how to

4.3 Pulse transfer function models . . . . . . . . . . . . . . . . . . 33

model and analyse their behaviour, and how to control them using feedback.

4.4 ZOH transfer function . . . . . . . . . . . . . . . . . . . . . . . 36

This is the third part of the series of A2 lectures on instrumentation and computers, the first of which, Signal Conditioning, looked at how to get infor-

4.5 Aside: impulse modulation . . . . . . . . . . . . . . . . . . . . . 37 4.6 Signal analysis and dynamic response . . . . . . . . . . . . . . 38 4.7 Systems with several outputs . . . . . . . . . . . . . . . . . . . 42 4.8 Summary of section 4 . . . . . . . . . . . . . . . . . . . . . . . 43 5 Step response and pole locations

44

5.1 Poles in the z-plane . . . . . . . . . . . . . . . . . . . . . . . . 44

mation into and out of computers, and the second, Microcontroller Systems, considered digital logic and microprocessors. Digital computers perceive and interact with the world via sequences of discrete packets of information, so the four lectures of this third part provide a basic understanding of discrete systems that you will need in order to apply computers to monitoring, analysis and control problems.

1.1

Example – Engine management system

5.2 The mapping between s-plane and z-plane . . . . . . . . . . . 48 5.3 Damping ratio and natural frequency . . . . . . . . . . . . . . . 50 5.4 System specifications . . . . . . . . . . . . . . . . . . . . . . . 50 5.5 Fast sampling revisited . . . . . . . . . . . . . . . . . . . . . . . 55

Many modern cars use microprocessor-based engine control units to regulate the fuel mixture and ignition timing of their engines. These devices optimize engine performance and can also interact with the gearbox to provide traction control and prevent skidding.

5.6 Summary of section 5 . . . . . . . . . . . . . . . . . . . . . . . 56 5.7 Learning Outcomes . . . . . . . . . . . . . . . . . . . . . . . . 57

Figure 1: Formula 1 engine control unit (2008) manufactured by McLaren/Microsoft

Traction control is a controversial issue in Formula 1 racing, so much so that competing teams are now required to use a standard engine control unit.

Introduction

5

1.2 Recommended text

1.2

6

Recommended text

• G F Franklin, J D Powell & M Workman Digital Control of Dynamic Systems 3rd edition, Addison Wesley, 1998. Other reading • M Sami Fadali & Antonio Visioli Digital Control Engineering: Analysis and Design Academic Press, 2009

Figure 2: Block diagram of a simplified engine control system

• R C Dorf & R H Bishop Modern Control Systems Pearson Prentice Hall, 2008

The engine control unit does the following at each sampling instant: 1. reads in measurements from sensors monitoring throttle position, crankshaft position and car acceleration 2. computes the required air and fuel flow-rates, ignition and valve timings 3. outputs control signals to spark plugs, fuel injectors, exhaust and cooling systems. The controller here is clearly a discrete system. It could either be designed in continuous time (using e.g. methods from the A2 Introduction to Control Theory course) using a continuous time model of the engine and vehicle, and then implemented approximately in discrete time, or it could be designed directly as a discrete system using a discrete time model of the engine and vehicle. Both types of approach are discussed in this course.

3

Microprocessors are embedded in a vast range of objects, from obvious (e.g. mp3 players) to almost invisible (e.g. credit cards). Their widespread use is due to: • Accuracy: digital signals are usually represented using 12 bits or more.

• Reliability: number crunching digital signals avoids the noise and uncertainty in component values that affect analogue signal processing. • Flexibility: limited only by processing power (and programming ability!)

• Cost: advances in technology make microcontrollers economical even for small, low cost applications.

• K J Astrom & B Wittenmark Computer-Controlled Systems: Theory and design Prentice Hall 1997 • A V Oppenheim, A S Willsky & S Hamid Signals and Systems 2nd edition, Prentice-Hall, 1996, Chapter 10

The course follows the first book above (referred to as Franklin in these notes) quite closely. Don’t confuse it with “Feedback Control of Dynamic Systems”, by Franklin, Powell and Emami-Naeini, which is another good book, but which deals mainly with continuous time rather than discrete time control systems. References to relevant chapters and sections are given throughout these notes. Franklin also provides some useful example problems.

1.3

Lecture notes

These lecture notes (but not the lecture slides) are provided as handouts in lectures. Both the notes and slides are available on the course web page (http://www.eng.ox.ac.uk/⇠conmrc/dcs) and on weblearn. The notes draw on material previous produced for related courses by Will Moore and Ron Daniel. Their input is gratefully acknowledged. Please send comments or corrections to [email protected]

Fast sampling control systems

7

2

Fast sampling digital control systems

2.1

Digitization?

Digitization is the process of converting a continuous controller (Figure 3) into a set of difference equations that can be implemented by a computer within a digital control system (Figure 4). The digital controller operates on samples of the sensed output rather than the continuous signal y(t). This provides practical advantages in terms of accuracy and noise rejection, and simplifies monitoring and simultaneous control of large numbers of feedback loops.

2.2 Sampling

2.2

8

Sampling

If a digital computer is used to process a signal, then clearly the signal has to be represented using finite precision numbers. An analogue to digital converter (ADC) typically produces a binary number (e.g. 12 bits), though this may be translated to a floating point number if the computer uses floating point arithmetic. For simplicity in this course we ignore the quantization error introduced by this finite precision representation. Normally we sample the signal at a constant rate: T = sample period (or sampling interval) 1/T = sample rate (or sampling frequency) in Hz

However the ability of a digital control system to achieve specified design criteria depends on the choice of digitization method and sample rate.

[2⇡/T = sample rate in rad s 1 ] tk = kT are the sample times with k = {. . . 2, 1, 0, 1, 2, 3, . . . }. Sampling a continuous signal produces a sampled signal: y(t)

sample

! y(kT ).

y(kT ) is now a discrete signal which we may write in one of three ways: y(kT ) ⌘ y(k) ⌘ yk Figure 3: Continuous Controller

2.3

Reconstruction

At the output of the computer a sampled signal must be converted back to a continuous time signal. This is usually done by means of a digital to analogue converter (DAC) and a hold circuit which holds the output signal constant during the sampling interval. This is known as a zero-order hold (ZOH).

Figure 4: Digital Controller. The dashed box contains sampled signals.

? Franklin

§3.1

Figure 5: The piecewise constant signal produced by the ZOH.

Fast sampling control systems

9

2.4

2.5 Euler’s approximation

10

The Nyquist Sampling Theorem and aliasing

When reconstructing a continuous signal from its samples, we need to know the conditions under which a continuous signal is uniquely defined by its samples. There are obviously any number of continuous signals that pass through a given set of samples (Fig. 6).

Figure 8: Spectrum of the original signal at frequency ! ˆ and the alias at !s

! ˆ.

If the condition of the Nyquist sampling theorem holds, i.e. if !s > 2 ! ˆ,

Figure 6: Two continuous signals with the same samples.

The Nyquist sampling theorem (also known as the Nyquist-Shannon sampling theorem) provides the following answer:

then the aliased signal is at a frequency !s ! ˆ > ! ˆ , so the original signal and its alias remain separated in the frequency domain. In this case therefore, the original signal can be recovered without distortion by just removing components of the sampled signal at all frequencies exceeding !s /2.

A signal y(t) is uniquely defined by its samples y(kT ) if the sampling frequency is more than twice the bandwidth of y(t). To get an idea of how this works, consider a sinusoidal signal (or sinusoidal component of a signal) with frequency ! ˆ sampled at frequency !s = 2⇡/T : y(t) = cos(ˆ ! t)

sample

! y(kT ) = cos(k ! ˆ T ) = cos(2⇡k ! ˆ /!s )

Identical samples are obtained from a sinusoid with frequency !s cos (!s

! ˆ )t

sample

! cos k(!s

! ˆ )T = cos(2⇡k

! ˆ:

!s ± ! ˆ , 2!s ± ! ˆ , 3!s ± ! ˆ, . . .

1

cos(ˆ ! t)

y

0



−0.5 −1 0

cos (!s



0.2

0.4

0.6

0.8

t

Figure 7: Sinusoidal signals at frequencies ! ˆ = 3⇡ rad s and !s equally spaced samples at a sampling frequency of !s = 8⇡ rad s 1 . 1

! ˆ )t

! ˆ (Fig. 8).

But to show that sampling at a frequency more than twice the bandwidth of y is sufficient for exact reconstruction of y(t) from its samples, we also need to show that there are no other components in the spectrum of y(kT ). This requires a bit more work, and will be covered fully in the A1 Time-Frequency Analysis course.

1

! ˆ = 5⇡ rad s

1

give identical

This implies that the spectrum of the sampled signal y(kT ) contains an alias (a copy of the original signal y(t) shifted to a different frequency) at frequency !s

By the same argument it is easy to show that the sampled signal contains an infinite sequence of aliases at frequencies

2⇡k ! ˆ /!s ) = cos(2⇡k ! ˆ /!s )

0.5

Figure 9: Spectrum of the sampled signal y(kT ) for ! > 0.

2.5

Euler’s approximation

To derive a model of a sampled data system, we first consider how to approximate continuous differential equations using discrete difference equations. You have seen how to approximate continuous derivatives using finite

Fast sampling control systems

11

2.5 Euler’s approximation

differences (e.g. the forward difference approximation) in the P1 course. The simplest approach uses Euler’s approximation to the first order derivative:

Suppose we want to implement a controller with transfer function: D(s) =

U (s) K(s + a) = . E(s) (s + b)

(s + b)U (s) = K(s + a)E(s). Next find the corresponding differential equation with s replaced by d/dt: ⇣ de ⌘ du + bu = K + ae , dt dt

and then use Euler’s approximation to turn it into a difference equation: ⇣e ⌘ uk+1 uk ek k+1 + b uk = K + a ek . T T

Finally, to implement this we need the new control value, uk+1 : bT )uk + Kek+1 + K(aT

1)ek .

Normally T , K, a & b are fixed, so it’s easier to see what the computer has to calculate every cycle by writing it in the standard form: uk+1 =

1

0.5

0

We first unravel this as:

uk+1 = (1

1.5 Plant Output y

xk+1 xk dx ⇡ . dt T

a1 uk + b0 ek+1 + b1 ek .

Note another very important thing: The coefficients of the difference equation change with T For this reason the sample rate is usually fixed!

Example To illustrate the effect of the sampling interval T on controller performance, we next apply this controller with K = 70, a = 2 rad s 1 , b = 10 rad s 1 to

12

0

0.5

1

1.5 2 2.5 Time (sec) Figure 10: Step response with continuous controller

3

a plant with transfer function G(s) = 1/(s(s + 1)). First consider the step response for the closed loop system with the continuous controller: Comparing with HLT p168, this looks like a second-order system response with !0 ⇡ 2⇡ rad/s (f0 ⇡ 1 Hz) and ⇣ ⇡ 0.4 [Very roughly, the time to the first peak is half the period of f0 , but see Franklin §2.1.7 for some slightly better criteria for estimating the poles of 2nd order systems]. We say the response is dominated by these poles; of course, there is also a real pole and a zero present but they have only had a slight effect on the response. We expect Euler’s approximation to be adequate when the interval T is small enough but less good when T is larger. Figure 11 shows the step responses when the sample rate is 80 Hz, 40 Hz, 20 Hz and 10 Hz. Clearly the discrepancy between the continuous system and the discrete approximation gets bigger as the sample rate reduces. The difference is hardly noticeable at 40 Hz, but at 10 Hz there are quite significant differences. 3

Fast sampling control systems

13

Plant output y

1 0.5

1/T = 80 Hz

0.2

0.4 0.6 Time (sec)

0.8

1

Plant output y

1

In the previous example, the bandwidth can be estimated from the step 0.5 0 0

1/T = 40 Hz

0.2

0.4 0.6 Time (sec)

0.8

1

response in Figure 10. [Note that we would get a more accurate value from the magnitude Bode diagram for the transfer function of the closed loop system with the continuous controller, if this were available]. Since ⇣ is small, the corner frequency associated with the dominant 2nd order poles is roughly !0 , so the bandwidth is about f0 = 1 Hz. From the rule of thumb above, we then get 1/T > 30 Hz, which agrees with the step responses in Fig. 11.

1.5 Plant output y

Conventional wisdom among control engineers gives a “rule of thumb” that we can probably ignore the error introduced by the discrete approximation to the continuous controller if 1/T > 30 ⇥ the bandwidth of the system

1.5

1 0.5

This brings us to the key conclusions:

1/T = 20 Hz

1.5

(a). If the computer can perform the sampling, computation and output fast enough, it can look just like a continuous system.

1

(b). If the computer does not go that fast, then we have to think more carefully about the controller.

0 0

Plant output y

14

The Nyquist sampling theorem states that we must sample at a frequency at least twice the bandwidth of interest, but it is clear here that we must sample at a much higher rate with this approach.

1.5

0 0

2.5 Euler’s approximation

0.2

0.5 0 0

0.4 0.6 Time (sec)

0.8

1

1/T = 10 Hz

0.2

0.4 0.6 Time (sec)

The latter conclusion will take us to look at: 0.8

1

Figure 11: Step responses with discrete controller (red –x–) and continuous controller (blue —)

(i). Better ways of approximating continuous systems (ii). Methods of designing discrete controllers directly.

Fast sampling control systems

15

2.6

Effects of sampling?

2.7 PID control

2.7

From the example above, it can be seen that the response at low sample rates is more oscillatory (less damped) than at high sample rates. This is a very general trend. The sampling process produces an inherent delay

16

PID control?

For continuous control systems, an extremely common and effective controller consists of a proportional gain plus an integral term plus a derivative

and consequently, in the frequency domain, a phase lag. As in the case of continuous controllers considered earlier in the A2 course, this extra delay and extra phase lag have a destabilizing effect on control.

term (a PID controller). This takes the form: ✓ ◆ 1 U (s) =K 1+ + TD s . D(s) = E(s) TI s

Consider the output from the ZOH circuit when the input is the sequence of samples u(kT ) of a continuous signal u(t):

Euler’s approximation can again be used to derive a discrete approximation to this continuous controller, but we need to start by writing the controller

⇣ ⇣⇣ ⇣⇣ ) ⇣ ⇣⇣ ⇣⇣ ⇣⇣ ) ⇣ ⇣⇣ ⇣ )

ZOH output

fundamental component of ZOH output

It is clear that, on average, the control signal produced by the ZOH is delayed by T /2 compared to u(t). At a frequency !, this corresponds to a phase lag of !T /2, in other words the phase lag increases at higher frequencies. By the time we get to the Nyquist sampling rate, ! = 2⇡/2T , the phase lag reaches ⇡/2 = 90 which is clearly unacceptable for most control systems. The 30 ⇥ bandwidth rule of thumb implies a sample rate of 15 ⇥ Nyquist’s minimum, when the phase lag caused by the ZOH has fallen to a more modest 6 which we may find we can ignore. Clearly the computer will take a finite amount of time to compute the signal u(kT ) and this will cause an additional delay. This is certainly true but (if necessary) we can minimize the effect by performing almost all the calculation of uk+1 before the new samples yk+1 and rk+1 arrive and then just add in the term dependent on ek+1 at the last moment. §3.2

 du de 1 d2 e =K + e + TD 2 . dt dt TI dt

u(t)

Figure 12: Zero-order hold output

? Franklin

as a differential equation. That means expanding it out in terms of U and E, and differentiating U in order to get rid of the integral term:

We then need an approximation for the second derivative as well as the first:  uk uk 1 ek ek 1 1 ek 2ek 1 + ek 2 =K + ek + TD . T T TI T2 Rearranging this gives: ⇣ T TD ⌘ uk = uk 1 + K 1 + + ek TI T



1+

2TD ⌘ ek T

1

+

TD ek T

2

.

This looks complicated, but of course the coefficients of the uk 1 , ek , ek 1 , and ek 2 are constant and we can again reveal the required calculation by writing it in standard form: uk = ? Franklin

§3.3

a1 u k

1

+ b0 e k + b1 e k

1

+ b2 e k 2 .

Fast sampling control systems

17

Consider the plant consisting of a small servo-motor with transfer function (speed in rad s 1 over Volts) G(s) = 360000/((s + 60)(s + 600)) and suppose that the speed is measured by a sensor with 1 Volt per rad s 1 . Using K = 5, TD = 0.0008 and TI = 0.003, the continuous controller produces the satisfactory response below.

1.5

0.5

1

2

3

4 Time (ms)

5

6

7

8

Figure 15: Step response with discrete controller at sample rate 3.3 kHz

Obviously the response at the lower sample rate is significantly less damped.

0.5

1

2

3

4 Time (ms)

5

6

7

8

We can try to compensate for the changes due to the low sample rate by changing the parameters of the PID controller. By trial and error, we can reduce K slightly (to 3.2) and increase TD (to 0.0011), to obtain the following step response at the lower sample rate of 3.3 kHz, which is close to the original continuous system response (Fig. 16).

Comparing this with standard 2nd order step responses (HLT p168), the dominant poles give a second order response with natural frequency 1/(4 ms) or 250 Hz, indicating a bandwidth of around 250 Hz. Sampling at 30 times this bandwidth requires a sample rate of 7.5 kHz. Below is the step response with a 10 kHz sample rate:

1.5 Speed (rad/s)

Speed (rad/s)

1

Figure 13: Step response with continuous controller

1 0.5 0 0

1.5 Speed (rad/s)

1

0 0

1.5

0 0

18

This is probably acceptable but what happens at a lower sample rate? e.g. 3.3 kHz:

Example

Speed (rad/s)

2.8

2.8 Example

1

2

3

4 Time (ms)

5

6

7

8

Figure 16: Step response with modified discrete controller at sample rate 3.3 kHz

1

3 0.5 0 0

The above somewhat arbitrary choice of sampling rate and ad hoc tuning 1

2

3

4 Time (ms)

5

6

7

Figure 14: Step response with discrete controller at sample rate 10 kHz

8

of the controller gains may be good enough for a very simple system, but is clearly not very satisfactory in general. To eliminate approximation errors and to design controllers directly in the discrete domain, we first need to consider how to analyze discrete systems in more detail.

Fast sampling control systems

19

2.9

Summary of section 2

This section discusses the choice of sample rate in digital signal processing and considers fast sampling approximations of digital control systems. • A sample rate: fs > 2B allows exact reconstruction of a signal with bandwidth B (by the Nyquist sampling theorem). • Continuous controllers may be approximated in discrete time by difference equations derived using e.g. Euler’s approximation.

20

3

Discrete systems analysis

3.1

Linear recurrence equations

We have seen that, in a typical controller, the new control output is calculated as a function of the new error, plus previous values of error and control output. To simplify tuning and analysis it makes good sense to use a linear function if possible. In general we have a linear recurrence equation (also often called a linear difference equation? ): a1 u k 1 a2 u k 2 · · · ak n m X X ai u k i + bj e k j .

uk =

• Reconstruction by a ZOH introduces a delay of T /2, which is equivalent to a phase delay of !T /2 at frequency !.

=

• The phase delay implies a more oscillatory response (than for a continuous controller), but the delay has negligible effect if fs > 30B. • It is possible to design discrete controllers giving good performance at lower sample rates, but this requires more accurate analysis of discrete signals and systems.

i=1

3.2

n uk n

+ b0 e k + b1 e k

1

+ · · · + bm e k

m

j=0

The discrete transfer function†

When considering continuous control systems, although we often begin with a time domain description in terms of variables and their derivatives such as: u(t) =

a1

du dt

a2

d2 u dt2

· · · + b0 e + b1

de d2 e + b2 2 + · · · dt dt

it can be more convenient to analyze behaviour in the frequency domain. Using the Laplace transform we can transform this linear differential equation into a linear polynomial equation in s: U (s) =

a1 sU (s)

a2 s2 U (s)

· · · + b0 E(s) + b1 sE(s) + b2 s2 E(s) + · · ·

Then we have at our disposal a number of techniques for shaping the behaviour of the closed-loop system based on the transfer function: D(s) =

U (s) b0 + b1 s + b2 s2 + · · · + bm sm = . E(s) 1 + a1 s + a2 s 2 + · · · + an s n

So can we use transforms to analyze discrete systems? ? Franklin

p74 explains the differences between the two for the rare occasions when we feel the need to be pedantic † Franklin §4.2

Discrete Systems Analysis

21

Assume for the moment that we find a way to transform the discrete Time Domain variable uk = u(kT ) into a Frequency Domain variable U 0 (s). Then how can we represent the other versions of u, i.e. uk 1 , uk 2 , etc?

3.2 The discrete transfer function

22

Now you may begin to see where this is leading. If the Laplace transform can be used to transform a linear differential equation into a linear polynomial equation in s and thus obtain a transfer function in s, we now have all that is required to turn a linear recurrence equation into a linear polynomial equation in z. Namely

Clearly uk 1 is just a version of uk delayed by a sample period T and uk 2 is uk delayed by 2T , etc. Remember that in the Laplace frequency domain, a time delay can be introduced into a signal by multiplying its Laplace transform by the operator e T s . So L.T.

if

0

uk ! U (s)

then uk

1

uk

2

L.T.

Ts

!e .. .

2T s

L.T.

a1 u k

1

a2 u k

2

···

ak

n uk n

+ b0 e k + b1 e k

1

+ · · · + bm e k

m

transforms to: U 0 (z) =

a1 z 1 U 0 (z)

a2 z 2 U 0 (z)

· · · + b0 E 0 (z) + b1 z 1 E 0 (z) + · · ·

From this we obtain the z-transform transfer function:

U 0 (s)

!e

uk =

0

U (s)

etc.

D(z) =

U 0 (z) b0 + b1 z = E 0 (z) 1 + a1 z

1

+ b2 z 1+a z 2

2 2

+ ··· . + ···

The choice of z = eT s rather than z = e T s is not at all obvious yet, but we can rationalize the transfer function by multiplying top & bottom by z n (as in previous section, we take the last coefficient in the denominator to be an ): D(z) =

Factors such as e

kT s

necessarily occur very frequently in discrete sys-

tems so we simplify the notation by defining the discrete frequency domain operator : z = eT s

With this definition, the above relations can be written: L.T.

uk ! U 0 (s) uk

1

uk

2

L.T.

! z 1 U 0 (s)

L.T.

! z 2 U 0 (s) ...

etc.

b0 z n + b1 z n 1 + b2 z n 2 + · · · + bm z n z n + a1 z n 1 + a2 z n 2 + · · · + an

m

.

As in the case of the Laplace transform transfer function, useful information is obtained by factorizing these two linear polynomials: D(z) = b0

⇧m j=1 (z ⇧ni=1 (z

zj ) n z pi )

m

(assuming b0 6= 0) where, as before, the zj are the zeros and the pi are the poles and they occur either as real values or in complex conjugate pairs. Obviously when n > m, there are (n m) zeros at the origin and when n < m, there are (m n) poles at the origin. Like continuous systems we must have at least as many poles as zeros? . If b0 6= 0, we have an equal number

of each and if b0 = 0, we have one fewer zeros. Likewise if b0 = b1 = 0 we have two fewer zeros, etc. It is therefore clear that, by defining the z-domain in this way, we can re-use for discrete systems all the techniques that were developed for continuous ? A greater number of zeros than poles in D(z) would indicate that the system is non-causal since uk would then depend on ek+i , for i > 0

Discrete Systems Analysis

23

systems using the s-domain. Of course you should expect a few variations, and we will look at these later. 3.3

3.3 The z-Transform

24

Example Sample a decaying exponential signal: x(t) = Ce unit step function) to give xk = Ce akT , for k 0.

The z-Transform

Then

So far z 1 has been considered as a delay operator. This has made it possible to construct transfer functions mapping discrete signals to other discrete signals without needing to define precisely what the z-transform is. Just as with continuous systems, most of the intellectual effort lies in trying to understand transfer functions (positions of poles in the z-plane, Nyquist diagram, gain and phase margins, damping factor, peak gain, etc.), with only the occasional bit of sweaty maths needed to work out the step response or steady-state error. However, we also need to consider time domain properties like step responses and steady state errors, and for these we need to introduce a definition for the z-transform:

E(z) = Z e(kT ) = Z ek 1 1 X X = e(kT ) z k = ek z k=0

X(z) =

1 X

xk z

k

=C

k=0

1 X

e

akT

z

k

at

U (t) (where U (t) is the

1 X

=C

k=0

(e

aT

z 1 )k .

k=0

This is a geometric series and has a closed form solution if |z| > e X(z) =

1

C e aT z

1

=

z

Cz e

aT

.

aT

: 3

A fundamental property of the z-transform is that if a signal is delayed by a period T , its z-transform gets multiplied by z 1 . This is consistent with the derivation above of the discrete transfer function [in fact it is possible to derive the definition of the z-transform from this property].

Example k

Suppose we have a sequence ek such that:

k=0

Note: Franklin uses a slightly more complicated definition than necessary for this course: • Franklin uses the “two-sided” z-transform with the index k starting at 1 whereas these notes (along with HLT and many other texts) use the “single sided” z-Transform to correspond to the single sided Laplace transform that you are already familiar with. In this course, all variables are defined to be zero for k < 0 so the two definitions yield the same results.

• Franklin puts bounds of r0 and R0 on the magnitude of z to be sure the series converges and we’ll look at this case by case (see below).

e0 , e1 , e2 , e3 , e4 , . . . = 1.5, 1.6, 1.7, 0, 0, . . . then delaying e by a period T will create a new sequence (let’s call it fk ) with f0 , f1 , f2 , f3 , f4 , . . . = 0, 1.5, 1.6, 1.7, 0, . . . Using the above definition of the z-transform gives: E(z) =

1 X

ek z

k

= 1.5 + 1.6z

fk z

k

= 1.5z

1

+ 1.7z

2

k=0

and

F (z) =

1 X k=0 1

= z (1.5 + 1.6z

1

1

+ 1.6z

2

+ 1.7z

3

+ 1.7z 2 ) = z 1 E(z)

3

Discrete Systems Analysis

25

3.4 Pulse response

26

Example

3.4

Likewise if we delay the exponential signal

In continuous systems there is a fundamental connection between the transfer function in the frequency domain and the impulse response in the time domain – they are a Laplace transform pair.

x(t) = Ce

at

U (t)

(where U (t) is the unit step function) by T to give the delayed signal a(t T )

y(t) = Ce then yk = Ce

for k

a(k 1)T

U (t

T) ,

Pulse response

Is there a corresponding property for discrete systems?

1. E(z)

U (z) = D(z) E(z) D(z)

In this case therefore, the z-transform of yk is Y (z) =

1 X

yk z

k

=

k=0

= Cz = Cz

1 X

Ce

a(k 1)T

z

e(kT )

k

C e

z

aT

u(kT ) = ?

k=0

1

1

1 X k=0 1 X

(e

aT

(e

aT

z 1 )k

1

z 1 )j = z 1 X(z)

j=0

which gives Y (z) =

?

.

3

Z-transform overview

Take the case where e(kT ) is the discrete version of the unit pulse, i.e. 8 0 this can be written as ek =

k.

In this case

To summarise: X(z) provides an easy way to convert between sequences, recurrence equations and their closed-form solutions.

E(z) =

1 X

ek z

k

= 1,

k=0

therefore

U (z) = D(z) E(z) = D(z) [just like Laplace!]

z-Transform X(z) Solution xk = x(k)

Sequence {x0 , x1 , . . .} Recurrence equation x k = a1 x k 1 + · · · + an x k

n

As we have applied a unit pulse to this system, the output, u(kT ) will be its pulse response and U (z) will be the z-transform of the pulse response. This means that: the transfer function D(z) is the z-transform of the pulse response

Discrete Systems Analysis

27

Example

3.5 Convolution

3.5

Suppose a controller is defined by the recurrence equation:

28

Convolution

Now consider a general input sequence e(kT ):

T uk = uk 1 + (ek + ek 1 ). 2

E(z)

With some elementary manipulation we deduce that the transfer function from E(z) to U (z) is given by ✓ ◆ U (z) T z + 1 D(z) = = E(z) 2 z 1

U (z) = D(z) E(z) D(z)

e(kT )

d(kT )

u(kT ) = ?

Because the system is linear and because e(kT ) is just a sequence of values, for example, e0 , e1 , e2 , e3 , e4 , . . . = 1.0, 1.2, 1.3, 0, 0, . . ., we can decompose e(kT ) into a series of pulses: e(kT ) = 1.0 k + 1.2 k 1 + 1.3 k 2 .

To check this, apply a unit pulse, ek =

and look at the pulse response

k

(assume as always that uk = 0 for k < 0): k uk 0

1

0

1 T /2 2 T 3 T .. .

ek ek

uk

1

1

0

T /2

0 0 0

1 0 0

T T T .. .

d0 , d1 , d2 , d3 , d4 , d5 , . . . = 1, 0.5, 0.3, 0.2, 0.1, 0, . . . then this is what we get: k

0

e(kT )

e(2) d(kT

U (z) = T /2 + T z 1 X = Tz k

1

+ Tz

1

+ Tz

3

u(kT )

+ ...

T T = 2 2

2

3

4

5

6

7

0

0

0

0

0

0 0

0 0

1 0.5 0.3 0.2 0.1 0 0 1.2 0.6 0.36 0.24 0.12

2T ) 0

0

1.3 0.65 0.39 0.26 0.13 0

1 1.7 2.2 1.21 0.73 0.38 0.13 0

From the table it can be seen that

T /2

k=0

T = 1 z

2

1

1 1.2 1.3

e(0) d(kT ) e(1) d(kT T )

The z-transform of uk is:

as expected.

Now we can find the response of u(kT ) for each of the individual pulses and simply sum them to get the response when the input is e(kT ). Suppose the pulse response of the system is:



z+1 z 1



u0 = e 0 d 0 u1 = e 0 d 1 + e 1 d 0 3

u2 = e 0 d 2 + e 1 d 1 + e 2 d 0 u3 = e 0 d 3 + e 1 d 2 + e 2 d 1 + e 3 d 0 ... etc.

Discrete Systems Analysis

29

In general: uk =

k X

ei dk

3.6 Summary of section 3

30

We can therefore complete the block diagram showing how the signals at the input and output of a discrete system are related in the discrete time and frequency domains:

i,

i=0

which is the convolution of the input and the pulse response (sometimes written as uk = ek ⇤ dk ), therefore

E(z)

U (z) = D(z) E(z) D(z)

multiplying the input by the transfer function in the frequency domain is equivalent to

e(kT )

convolving the input with the pulse response in the time domain

d(kT )

u(kT ) = e(kT ) ⇤ d(kT )

[Aside: For continuous systems, it is usually more convenient to multiply in the frequency domain than to convolve in the time domain (which involves integrating). However for discrete systems the convolution involves only multiplying and adding, which computers find very easy.] 3.6

Summary of section 3

This section looks at linear discrete system models in terms of recurrence equations and discrete transfer functions, and introduces the z-transform. u0 = e 0 d 0

u1 = e 0 d 1 + e 1 d 0 • The inputs and outputs of discrete systems are related by recurrence equations, e.g. mapping a sequence ek to a sequence uk . • Discrete transfer functions can be determined directly from linear recurrence equations by using the z 1 delay operator.

u2 = e 0 d 2 + e 1 d 1 + e2 d0

u3 = e 0 d 3 + e 1 d 2 + e2 d1 + e3 d0

• Discrete transfer functions map the z-transform of the input sequence to the z-transform of the output sequence, e.g. U (z) = D(z)E(z). P k • The z-transform of a sequence uk is defined U (z) = 1 k=0 uk z .

• The discrete transfer function of a linear system is the z-transform of the system’s pulse response.

Figure 17: Graphical illustration of how to compute the convolution of two sequences, ek and dk

• Multiplication in the z-domain is equivalent to convolution in the timeP domain, e.g. uk = 1 i=0 ei dk i .