“True” Digital Control

38
“True” Digital Control .. or using the fact that we are sampling the signals to our advantge

description

“True” Digital Control. .. or using the fact that we are sampling the signals to our advantge. More on the z-transform. We need to examine the z-transform in more detail. - PowerPoint PPT Presentation

Transcript of “True” Digital Control

Page 1: “True” Digital Control

“True” Digital Control

.. or using the fact that we are sampling the signals to our

advantge

Page 2: “True” Digital Control

More on the z-transform

• We need to examine the z-transform in more detail.

• First, we look at two of the elements we have considered before -- SAMPLERS and the ZERO-ORDER HOLD (often referred to just as a HOLD).

Page 3: “True” Digital Control

The sampler

• When the switch (sampler) closes, the signal at A proceeds to B.

• No signal reaches B except when the sampler closes.

• This idea represents the action of a digital controller in that it only calculates its output at the sampling instants.

A B

Page 4: “True” Digital Control

The Hold

• But the ‘plant’ will need to be given an input all the time -- just a ‘punch on the nose’ at the sampling instants is unlikely to work well.

• This is where the Zero-Order Hold comes into action ...

Page 5: “True” Digital Control

The Zero-Order Hold

• This is the idea:

• The value of the signal at C is ‘caught’ by the hold and held constant until the sampler closes again.

HoldA BC

Page 6: “True” Digital Control

Why a ‘Zero-Order Hold’ ?

• Because it just catches the value of the signal at C.

• A ‘First-Order Hold” would also catch the rate of change of the signal ...

• ... and keep it changing at that rate.

• But that is complicated, so the Zero-Order Hold is invariably used !

Page 7: “True” Digital Control

What will it consist of ?

• Normally a latching-type output port on the control computer attached to a D-A converter.

Page 8: “True” Digital Control

Now for the z-transform

• It only tells us what happens at sampling intervals

• Consider this diagram:y

Time ( t)Ts 3Ts 5Ts etc

y(Ts)

y(4Ts)

Page 9: “True” Digital Control

The z-transform -- Continued

• Suppose the switch closes for a time Tc at each sampling instant

• We have a series of impulses

• Each has a Laplace Transform equal to its area (‘strength’) times e-nTs to allow for the time at which it occurs

• So the Laplace Transform of the complete sampled signal will be:

Page 10: “True” Digital Control

..and continues further ...

• Tc(y(0) + y(Ts)e-sTs + y(2Ts)e-2sTs + ...)

• or

• We now put z = esTs and it simplifies ...

T y rT ec s

srT

r

s( )

0

T y rT zc s

r

r

( )

0

Page 11: “True” Digital Control

So working them out looks heavy going ...

• But fortunately, like Laplace Transforms, they can be looked up in tables ...

• ... or converted by MATLAB using the ‘c2dm’ function.

• This time, we leave the ‘tustin’ out...

• [npd,dpd]=c2dm(num,den,ts,’zoh’)

• The ‘zoh’ can be omitted.

Page 12: “True” Digital Control

Rules for converting Block Diagrams to z

• If blocks are separated by a sampler, convert the TFs to z and then combine the blocks.

• If they are not, combine them in s and then convert to z.

• This sounds complicated but it is actually easier than it looks ...

Page 13: “True” Digital Control

An Example

• The samplers close at each sampling instant

• We must first combine the zero-order hold and the plant in s ...

• ... and then convert to z.

Zero-orderhold

PlantG(s)+--

Page 14: “True” Digital Control

Send for MATLAB !

• ‘c2dm’ will convert the hold-plant combination to z for us.

• In order to determine the required D(z), we then specify the required closed-loop performance as a C.L.T.F. in z ...

• ... and work out what D(z) will have to be in order to provide it.

• We will find that a problem arises but it is not insurmountable.

Page 15: “True” Digital Control

An example situation

• We will re-examine our plant of transfer function

• 40/(s2 + 10s + 20)

• and we will try to work out a controller D(z) which will produce a unit step-response following a nice gentle first-order exponential.

• We will use a time constant of 0.4 second.

Page 16: “True” Digital Control

Our intended step-response

0 0.5 1 1.5 20

0.2

0.4

0.6

0.8

1

Time (secs)

Am

plitu

de

Page 17: “True” Digital Control

Converting the plant T.F. to z

• We enlist the aid of MATLAB and ‘c2dm’, entering

• num=40;

• den=[1 10 20];

• [npd,dpd]=c2dm(num,den,.1)

• and we obtain

Page 18: “True” Digital Control

The digitised plant T.F.

• npd =

• 0 0.1449 0.1038

• dpd =

• 1.0000 -1.2435 0.3679

• So the TF of plant + hold is

• (0.1449z + 0.1038)/(z2 - 1.2435z + 0.3679)

Page 19: “True” Digital Control

The digitised plant TF - Continued

• or since it is (apart from MATLAB) usually more convenient to use negative powers of z

• (0.1449z-1 + 0.1038z-2)/(1 - 1.2435z-1 + 0.3679z-2)

Page 20: “True” Digital Control

The required closed-loop T.F.

• Input = unit step converting to z/(z - 1) (from tables)

• Output = 1 - e-t/0.4

• Another ‘bout’ with the tables produces

• Output(z) = ( )

( )( )

.

.

1

1

0 4

0 4

e z

z z e

T

T

s

s

Page 21: “True” Digital Control

The required C.L.T.F. -- Continued

• Which becomes with Ts = 0.1 second

• And we divide by the input z/(z - 1) to give the CLTF

• 0.2212/(z - 0.7788)

0 22121 0 7788

.( )( . )

zz z

Page 22: “True” Digital Control

Now for the required D(z)

• We do a DG/(1 + DG) act again:

• DG/(1 + DG) = 0.2212/(z - 0.7788)

• and by rearranging

• DGz - 0.7788DG = 0.2212 + 0.2212DG

• and

• D = 0.2212/[(z - 1)G]

Page 23: “True” Digital Control

And now for D(z) ...

• G(z) was

• (0.1449z + 0.1038)/(z2 - 1.2435z + 0.3679)

• so by rearranging, D(z) becomes

• 1.5267 - 1.8985z-1 + 0.5616z-2

• -------------------------------------

• 1.0000 - 0.2833z-1 - 0.7167z-2

• We will try this in SIMULINK ....

Page 24: “True” Digital Control

The resulting step-response

1 2 3 4

0

0.5

1

1.5

Time (second)

Page 25: “True” Digital Control

Not quite as intended !

• Oh dear ! There is a slight wobble on the plant output ...

• ... and a much worse one from the controller.

• Let us examine D(z) again.

Page 26: “True” Digital Control

The Ringing Pole

• The denominator of the controller transfer function was calculated by:

• (z - 1)(0.1449z-1 + 0.1038z-2)

• The second bracket is zero when z = - 0.72

• So the controller has a pole at z = - 0.72

• This is a Ringing Pole .. a Bad Thing

Page 27: “True” Digital Control

The s- and z-planes

• We remember that in s ...

• ...poles with positive real parts meant unstable systems, and ..

• ...poles with non-zero imaginary parts meant systems with overshoot.

• What is the situation in z ?

Page 28: “True” Digital Control

This one may be ignored by non-mathematicians ...

• We think of s as a + jw

• Normally a > 0 means instability

• For z, e(a + jw)Ts = eaTs x ejwTs

• De Moivre: ejwTs = cos(wTs) + j sin(wTs)

• so its magnitude is 1.

• And |z| > 1 if a > 0

• So for stability |z| < 1.

Page 29: “True” Digital Control

Rules of the z-plane

• Systems with all their poles inside a circle of radius 1 unit centred on the origin -- the Unit Circle -- are stable.

• Again, poles off the real axis indicate step overshoot.

• Additionally, poles with negative REAL parts indicate oscillatory behaviour at half the sampling frequency.

• We avoid them at all costs !!!

Page 30: “True” Digital Control

“Oh, my controller is ringing !”

• What we need to do to stop it is to replace the offending bracket by an equivalent static gain.

• Not as difficult as it sounds

• Calculate the gain by putting z = 1 ...

• ... and keep the most positive (or least negative) power of z.

Page 31: “True” Digital Control

“The bell is removed ... ”

• We start from 0.1449z-1 + 0.1038z-2

• Putting z = 1 gives 0.2487

• Reinstating the z-1 gives 0.2487z-1

• The complete controller T.F. becomes

• 0.8894 - 1.1062z-1 + 0.3273z-2

• ------------------------------------

• 1 - z-1

• This one works much better

Page 32: “True” Digital Control

Response - no ringing pole

1 2 3 40

0.2

0.4

0.6

0.8

1

Time (second)

Page 33: “True” Digital Control

The Kalman Controller

• “Back to basics !”

• nth-order systems can be made to settle in n sampling intervals

• For a second-order, we could regard the first interval controller action as the “accelerator” and the second one as the “brakes”.

Page 34: “True” Digital Control

Producing a Kalman Controller

• We start with the plant transfer function in z ... in our example:

• (0.1449z + 0.1038)/(z2 - 1.2435z + 0.3679)

• and we make the coefficients in the numerator add up to 1 (known as ‘normalising’ the T.F.)

• We do this by adding the 0.1449 and the 0.1038 together, giving 0.2487 ...

Page 35: “True” Digital Control

The Kalman -- Continued

• ... and dividing top and bottom of our T.F. by that number.

• The plant T.F. becomes

• 0.5825z-1 + 0.4175z-2

• ------------------------------------

• 4.020 - 4.9995z-1 + 1.4790z-2

• and we regard it as P(z)/Q(z).

Page 36: “True” Digital Control

Nearly to the Kalman !

• It turns out that the controller TF should be Q(z)/[1 - P(z)] !

• So it will be

• 4.020 - 4.9995z-1 + 1.4790z-2

• -----------------------------------

• 1 - 0.5825z-1 - 0.4175z-2

• and we duly test with SIMULINK ...

Page 37: “True” Digital Control

The response with the Kalman

0.2 0.4 0.6 0.8 1-1

0

1

2

3

4

Time (second)

Page 38: “True” Digital Control

Why don’t we always use the Kalman ?

• It depends on a good plant model being available (and the plant dynamics not changing) in order to work well

• A heavy controller action is usual unless we sample slowly enough to encounter aliasing problems -- we will revisit this problem in the lecture on ‘Practicalities’