True Digital Control or using the fact that

  • Slides: 38
Download presentation
“True” Digital Control. . or using the fact that we are sampling the signals

“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.

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).

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

The sampler • When the switch (sampler) closes, the signal at A proceeds to B. A 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.

The Hold • But the ‘plant’ will need to be given an input all

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. . .

The Zero-Order Hold • This is the idea: A C Hold B • The

The Zero-Order Hold • This is the idea: A C Hold B • The value of the signal at C is ‘caught’ by the hold and held constant until the sampler closes again.

Why a ‘Zero-Order Hold’ ? • Because it just catches the value of the

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 !

What will it consist of ? • Normally a latching-type output port on the

What will it consist of ? • Normally a latching-type output port on the control computer attached to a D-A converter.

Now for the z-transform • It only tells us what happens at sampling intervals

Now for the z-transform • It only tells us what happens at sampling intervals • Consider this diagram: y y(4 Ts) y(Ts) Ts 3 Ts 5 Ts etc Time ( t)

The z-transform -- Continued • Suppose the switch closes for a time Tc at

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-n. Ts to allow for the time at which it occurs • So the Laplace Transform of the complete sampled signal will be:

. . and continues further. . . • Tc(y(0) + y(Ts)e-s. Ts + y(2

. . and continues further. . . • Tc(y(0) + y(Ts)e-s. Ts + y(2 Ts)e-2 s. Ts +. . . ) • or • We now put z = es. Ts and it simplifies. . .

So working them out looks heavy going. . . • But fortunately, like Laplace

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 ‘c 2 dm’ function. • This time, we leave the ‘tustin’ out. . . • [npd, dpd]=c 2 dm(num, den, ts, ’zoh’) • The ‘zoh’ can be omitted.

Rules for converting Block Diagrams to z • If blocks are separated by a

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. . .

An Example • The samplers close at each sampling instant +-- Zero-order hold Plant

An Example • The samplers close at each sampling instant +-- Zero-order hold Plant G(s) • We must first combine the zero-order hold and the plant in s. . . • . . . and then convert to z.

Send for MATLAB ! • ‘c 2 dm’ will convert the hold-plant combination to

Send for MATLAB ! • ‘c 2 dm’ 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.

An example situation • We will re-examine our plant of transfer function • 40/(s

An example situation • We will re-examine our plant of transfer function • 40/(s 2 + 10 s + 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.

Our intended step-response 1 Amplitude 0. 8 0. 6 0. 4 0. 2 0

Our intended step-response 1 Amplitude 0. 8 0. 6 0. 4 0. 2 0 0 0. 5 1 Time (secs) 1. 5 2

Converting the plant T. F. to z • We enlist the aid of MATLAB

Converting the plant T. F. to z • We enlist the aid of MATLAB and ‘c 2 dm’, entering • num=40; • den=[1 10 20]; • [npd, dpd]=c 2 dm(num, den, . 1) • and we obtain

The digitised plant T. F. • • • npd = 0 0. 1449 0.

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. 1449 z + 0. 1038)/(z 2 - 1. 2435 z + 0. 3679)

The digitised plant TF Continued • or since it is (apart from MATLAB) usually

The digitised plant TF Continued • or since it is (apart from MATLAB) usually more convenient to use negative powers of z • (0. 1449 z-1 + 0. 1038 z-2)/(1 - 1. 2435 z-1 + 0. 3679 z-2)

The required closed-loop T. F. • Input = unit step converting to z/(z -

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) =

The required C. L. T. F. -Continued • Which becomes with Ts = 0.

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)

Now for the required D(z) • • • We do a DG/(1 + DG)

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. 7788 DG = 0. 2212 + 0. 2212 DG and D = 0. 2212/[(z - 1)G]

And now for D(z). . . • • G(z) was (0. 1449 z +

And now for D(z). . . • • G(z) was (0. 1449 z + 0. 1038)/(z 2 - 1. 2435 z + 0. 3679) so by rearranging, D(z) becomes 1. 5267 - 1. 8985 z-1 + 0. 5616 z-2 ------------------1. 0000 - 0. 2833 z-1 - 0. 7167 z-2 We will try this in SIMULINK. .

The resulting step-response 1. 5 1 0. 5 0 1 2 3 Time (second)

The resulting step-response 1. 5 1 0. 5 0 1 2 3 Time (second) 4

Not quite as intended ! • Oh dear ! There is a slight wobble

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.

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

The Ringing Pole • The denominator of the controller transfer function was calculated by: • (z - 1)(0. 1449 z-1 + 0. 1038 z-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

The s- and z-planes • We remember that in s. . . • .

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 ?

This one may be ignored by nonmathematicians. . . • • We think of

This one may be ignored by nonmathematicians. . . • • We think of s as a + jw Normally a > 0 means instability For z, e(a + jw)Ts = ea. Ts x ejw. Ts De Moivre: ejw. Ts = cos(w. Ts) + j sin(w. Ts) so its magnitude is 1. And |z| > 1 if a > 0 So for stability |z| < 1.

Rules of the z-plane • Systems with all their poles inside a circle of

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 !!!

“Oh, my controller is ringing !” • What we need to do to stop

“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.

“The bell is removed. . . ” • • We start from 0. 1449

“The bell is removed. . . ” • • We start from 0. 1449 z-1 + 0. 1038 z-2 Putting z = 1 gives 0. 2487 Reinstating the z-1 gives 0. 2487 z-1 The complete controller T. F. becomes 0. 8894 - 1. 1062 z-1 + 0. 3273 z-2 ------------------1 z-1 This one works much better

Response - no ringing pole 1 0. 8 0. 6 0. 4 0. 2

Response - no ringing pole 1 0. 8 0. 6 0. 4 0. 2 0 1 2 3 Time (second) 4

The Kalman Controller • “Back to basics !” • nth-order systems can be made

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”.

Producing a Kalman Controller • We start with the plant transfer function in z.

Producing a Kalman Controller • We start with the plant transfer function in z. . . in our example: • (0. 1449 z + 0. 1038)/(z 2 - 1. 2435 z + 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. . .

The Kalman -- Continued • . . . and dividing top and bottom of

The Kalman -- Continued • . . . and dividing top and bottom of our T. F. by that number. • The plant T. F. becomes • 0. 5825 z-1 + 0. 4175 z-2 • ------------------ • 4. 020 - 4. 9995 z-1 + 1. 4790 z-2 • and we regard it as P(z)/Q(z).

Nearly to the Kalman ! • It turns out that the controller TF should

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. 9995 z-1 + 1. 4790 z-2 • ----------------- • 1 - 0. 5825 z-1 - 0. 4175 z-2 • and we duly test with SIMULINK. . .

The response with the Kalman 4 3 2 1 0 -1 0. 2 0.

The response with the Kalman 4 3 2 1 0 -1 0. 2 0. 4 0. 6 Time (second) 0. 8 1

Why don’t we always use the Kalman ? • It depends on a good

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’