Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

Name:

ID number (DNI, NIE or passport):

Seating location (row, column) from teacher’s desk: ( , )

Second Short Exam ODD Column Control and Guidance (J. Carlos Aguado) Nov 25, 2021

Let us continue with the DEMON is experimental UAV, remember that it can also be
controlled by a non-standard elevator and the power. So we can use its linearized transfer
function from its non-standard elevator angle, h(t), to the acquired pitch angle, q(t)
without the inclusion of its actuator dynamics:

Θ(s) −37.99(s+3.332)(s+0.04257)
= 2
Η(s) (s +0.04865 s+0.08479)(s2 +4.04 s+35.2)

Choose whatever questions to sum 10 points

1) Assume that we want to control it with a microprocessor, ZOH D/A converter and A/D
converter, all of them with a period of 0.0Z seconds, where Z is equal to the last digit of your
personal identification number (DNI, NIE or passport), if it is 0 use 5. Is it acceptable? Show
and justify the location of the discrete poles (1 point, 3 minutes)

Very clearly the maximum natural frequency is nearly 6:

>> damp(G02)

Pole Damping Frequency Time Constant


(rad/seconds) (seconds)

-2.43e-02 + 2.90e-01i 8.35e-02 2.91e-01 4.11e+01


-2.43e-02 - 2.90e-01i 8.35e-02 2.91e-01 4.11e+01
-2.02e+00 + 5.58e+00i 3.40e-01 5.93e+00 4.95e-01
-2.02e+00 - 5.58e+00i 3.40e-01 5.93e+00 4.95e-01

Therefore we consider sampling frequencies bigger than 60, 120 or 180 rad/s, and the
corresponding sampling periods have to be smaller than 0.1, 0.07 or 0.035 s.

Let us assume a sampling period 0.05 s:

>> Gz02 = c2d(G02, 0.05)

Gz02 =

-0.04662 z^3 + 0.03994 z^2 + 0.04554 z - 0.03889


------------------------------------------------
z^4 - 3.735 z^3 + 5.286 z^2 - 3.366 z + 0.8151

And the poles will be as expected:

>> pole(Gz01)

ans =

0.8690 + 0.2489i
0.8690 - 0.2489i
0.9987 + 0.0145i
0.9987 - 0.0145i

>> exp(0.05*(-2.02e+00 + 5.58e+00i))

ans =

0.8690 + 0.2489i

3) Can we use just a proportional controller? If we can, what would its optimal value (at least
a value that makes the system stable) and why? (Be sure to include “zoom-ins”). (1 point, 3
minutes)

We need the root locus:


>> rlocus(Gz02)

and of course we need to zoom in:

and even more:


The stability zone is ridiculously small, so we will have bad precision, always oscillations,
and a terribly slow system (if we try a gain of 0.001 we have a final value of -0.0018,
overshoot of 600% and settling time bigger than 4 minutes). Remember that our plant
has a negative sign.

3) Can we use a negative proportional controller? If we can, find its optimal gain (1 point, 3
minutes)

Yes, probably we should, because the plant has a negative sign:


>> rlocus(-Gz02)

and of course we need to zoom in to find an optimal value:


but it is necessary to check that we have stability for that value (oscillations never
disappear):

We do, so we get stability, low precision, maximum speed and minimal but existent
oscillations.

4) To avoid running out of time let us change our plant to something much simpler: the servo
actuator and elevator we had previously left out. A servo controller is a moving piece with an
integrated simple control loop, in this case:
Η(s) 625
= 2
Ηd (s) s +30 s+625
What are its stability, precision, shape of response and speed? What sampling period do we
need? (1 point, 3 minutes)

We are going to have stability, oscillations, perfect precision to step input and quite high
speed, the natural frequency is 25. Therefore we need to sample at more than 250, 500 or
750 rad/s, corresponding to sampling periods smaller than 0.025, 0.0126 or 0.084 s

>> damp(G1)

Pole Damping Frequency Time Constant


(rad/seconds) (seconds)
-1.50e+01 + 2.00e+01i 6.00e-01 2.50e+01 6.67e-02
-1.50e+01 - 2.00e+01i 6.00e-01 2.50e+01 6.67e-02

5) Discretize it with sampling period 0.01. Does it make sense to use a proportional controller
(either positive or negative)? Now you can compare the plant (because it already was a servo)
and the discrete automatic control system (2 points, 6 minutes)

>> Gz1=c2d(G1, 0.01)

Gz1 =

0.0282 z + 0.02551
----------------------
z^2 - 1.687 z + 0.7408

>> rlocus(Gz1)

The critical gain is close to 8, the system will be oscillatory and not too fast, without any
guarantee of precision. The negative one looks much better:

>> rlocus(-Gz1)

Nevertheless again the system will be slow and without precision (and it needs a negative
prefilter). In this case it makes sense to compare plant and control system because the
plant was already a servo:

>> Tz1 = feedback(-0.592*Gz1, 1)


Tz1 =

-0.0167 z - 0.0151
----------------------
z^2 - 1.704 z + 0.7257

>> step(G1, -Tz1)

This control system is not precise and slower (but without oscillations)

6) Can we use a discrete PID? Comment the results (2 points, 6 minutes)

If stability is maintained it will guarantee precision and we can try to find speed, let us try:

>>PIDz = ((z-0.9)*(z-0.8))/(z*(z-1));
>> rlocus(PIDz*Gz1);

Let us try this “optimal” (stability, precision, minimum oscillations, not real maximum
speed because we have a dominant branch but we hope its contribution is small) and
compare it with the original plant (because it was already a servo):

>> Tz1=feedback(7.6*PIDz*Gz1, 1)
>> step(G1, Tz1)
The system is slower (nevertheless really fast), but the oscillations have been reduced a
bit and best of all WE DO NOT HAVE OVERSHOOT

7) Can you implement a dead-beat controller that implies a global transfer function as a single
delay? If it is not implementable, more delays can change it? (2 points, 6 minutes)

The plant has relative order one, so theoretically we could use a single-period delay, but
for implementation on a real computer we will need 2 of them:

−1
1 C (z)G(z) T (z) z 1
Remember T (z)= = ⇒C (z)= = −1
=
z 1+C (z)G(z) G (z)(1−T (z)) G (z)(1−z ) G(z)( z−1)

>> Cz = 1/(Gz1*(z-1))

Cz =

z^2 - 1.687 z + 0.7408


---------------------------------
0.0282 z^2 - 0.002687 z – 0.02551

>> pole(Cz)
ans =

1.0000
-0.9047

The controller is feasible, but non-strictly causal, therefore not implementable in a


microprocessor that would need at least one delay, positive relative order. It also has a
pole at -1 (marginal instability, that we could tolerate, even though it would always be
spending energy)

>> minreal(Cz*Gz1)
ans =

1
-----
z-1

So theoretically it would be perfect:


>> rlocus(minreal(Cz*Gz1))

For gain equal to one and unit feedback it will be a single delay, Matlab is making small
numerical errors.

Let us try two delays:


1 C (z)G(z) T (z) z−2 1
T (z)= 2 = ⇒ C ( z)= = −2
=
z 1+C ( z)G(z) G(z)(1−T (z)) G( z)(1−z ) G (z)(z 2−1)

>> Cz2 = 1/(Gz1*(z^2-1))

Cz2 =

z^2 - 1.687 z + 0.7408


---------------------------------------------
0.0282 z^3 + 0.02551 z^2 - 0.0282 z - 0.02551

>> pole(Cz2)

ans =

1.0000
-1.0000
-0.9047

Also marginal instability, but we could implement it:

−3
1 C (z)G( z) T (z) z 1
T (z)= 3 = ⇒ C ( z)= = −3
=
z 1+C ( z)G(z) G(z)(1−T ( z)) G( z)(1− z ) G (z)(z 3−1)

>> minreal(Cz2)

ans =

35.46 z^2 - 59.82 z + 26.27


-----------------------------
z^3 + 0.9047 z^2 - z - 0.9047

>> Tz= minreal(feedback(Cz2*Gz1, 1))


Tz =

1
---
z^2

8) Choose a controller, give its equation and justify whether it will be implementable within a
computer (1 point, 3 minutes)

We should try the dead beat controller globally acting as two delays, Cz2 (feasible, strictly
causal and therefore straightforward implementable but marginally unstable, always
spending energy and depending on the perfect cancellation of zeros and poles).

35.46 z 2−59.82 z +26.27 Ηd (z) Ηd (z)


C 2 ( z)= = =
z +0.9047 z −z−0.9047 E( z) Ηref ( z)−Η(z)
3 2

and therefore the equation is:

η d (k +3)+0.9047 η d (k +2)−η d (k+1)−0.9047 η d (k )=35.46 e(k+2)−59.82 e(k +1)+26.27 e(k)

η d (k )=−0.9047 η d (k−1)+η d (k−2)+0.9047 η d (k −3)+35.46 e(k−1)−59.82 e(k−2)+26.27 e(k−3)

9) Can a dead-beat control use only the controller at the feedback branch, H(z)? (1 point, 3
minutes)

Dead-beat controller by changing H instead of C:

G(z) G(z)−T ( z)
T (z)= ⇒G ( z)=T (z)+T ( z)G(z) H (z)⇒G ( z)T ( z) H ( z)=G( z)−T (z)⇒ H (z)=
1+G (z) H (z) G (z)T (z)

If we want the automatic control system act as a number of delays:

−n G ( z) G (z)−z−n z n G (z)−1
T (z)=z = ⇒ H (z)= ⇒ H (z)=
1+G( z) H ( z) G (z) z−n G(z)

Therefore delays are going to make the system unfeasible instead of feasible. It is
IMPOSSIBLE.

10) Can a discrete automatic control system be faster than the original plant? (1 point, 3
minutes)

Even if it is not easy to understand, yes we can often, not always, make a system faster
by adding a controller, remember the root locus of a single pole, a branch that goes to the
left.

11) Matlab gives the answer of a discrete control system step like but sisotool as purely
continuous, which one is right and why? (1 point, 3 minutes)

From the point of view of the computer (controller) everything is discrete, the orders that
it gives to the plant and the measures it gets from the plant, so all graphs could be
isolated points, not steps, and the usual Matlab representation is WRONG. But from the
“real world”, the output if the plant is continuous, so the sisotool representation is RIGHT.
Name:

ID number (DNI, NIE or passport):

Seating location (row, column) from teacher’s desk: ( , )

Second Short Exam EVEN Column Control and Guidance (J. Carlos Aguado) Nov 25, 2021

Let us continue with the DEMON is experimental UAV, remember that it can also be
controlled by a non-standard elevator and the power. So we can use its linearized transfer
function from its torque, t(t), to the acquired horizontal speed, u(t) without the inclusion
of its actuator dynamics:
2
U (s) 2.5267(s+0.0502)(s +4.107 s+35.59)
= 2
Τ (s) (s +0.04865 s+0.08479)(s 2+ 4.04 s+35.2)

Choose whatever questions to sum 10 points

1) Assume that we want to control it with a microprocessor, ZOH D/A converter and A/D
converter, all of them with a period of 0.0Z seconds, where Z is equal to the last digit of your
personal identification number (DNI, NIE or passport), if it is 0 use 5. Is it acceptable? Show
and justify the location of the discrete poles (1 point, 3 minutes)

Very clearly the maximum natural frequency is nearly 6:

>> damp(G01)

Pole Damping Frequency Time Constant


(rad/seconds) (seconds)

-2.43e-02 + 2.90e-01i 8.35e-02 2.91e-01 4.11e+01


-2.43e-02 - 2.90e-01i 8.35e-02 2.91e-01 4.11e+01
-2.02e+00 + 5.58e+00i 3.40e-01 5.93e+00 4.95e-01
-2.02e+00 - 5.58e+00i 3.40e-01 5.93e+00 4.95e-01

Therefore we consider sampling frequencies bigger than 60, 120 or 180 rad/s, and the
corresponding sampling periods have to be smaller than 0.1, 0.07 or 0.035 s.

Let us assume a sampling period 0.05 s:


>> Gz01 = c2d(G01, 0.05)

Gz01 =

0.1266 z^3 - 0.3457 z^2 + 0.322 z - 0.1028


----------------------------------------------
z^4 - 3.735 z^3 + 5.286 z^2 - 3.366 z + 0.8151

And the poles will be as expected:

>> pole(Gz01)

ans =

0.8690 + 0.2489i
0.8690 - 0.2489i
0.9987 + 0.0145i
0.9987 - 0.0145i

>> exp(0.05*(-2.02e+00 + 5.58e+00i))

ans =

0.8690 + 0.2489i

2) Can we use just a proportional controller? If we can, what would its optimal value (at least
a value that makes the system stable) and why? (Be sure to include “zoom-ins”). (1 point, 3
minutes)

We need the root locus:


>> rlocus(Gz01)

and of course we need to zoom in:

So yes, we can find an optimal value in the sense of stability, maximum speed and
minimal oscillations but oscillations will always exist and the precision will be probably
bad.
3) To avoid running out of time let us change our plant to something much simpler: the
simplest model of a human pilot. On average, good human pilots would behave approximately
like this:
Y (s) 2 e−0.3 s
=
X (s) s+2
What are its stability, precision, shape of response and speed? What sampling period do we
need? (1 point, 3 minutes)

We are going to have stability, no oscillations, perfect precision to step and not a very high
speed but acceptable. The problem is the delay of 0.3 seconds, terrible in fed-back
continuous systems but easier to treat in discrete ones. The natural frequency is 2
therefore we need to sample at more than 20, 40 or 60 rad/s, corresponding to sampling
periods smaller than 0.314, 0.157 or 0.105 s

>> G2wo = 2/(s+2);


>> damp(G2wo)

Pole Damping Frequency Time Constant


(rad/seconds) (seconds)

-2.00e+00 1.00e+00 2.00e+00 5.00e-01

Of course the system will have no oscillations and will have perfect precision to step. Until
recently Matlab (and any other automatic control software was strangely unable to deal
with both continuous transfer functions and graphs of delayed systems, but now it can:

>> G = (2*exp(-0.3*s))/(s+2)

G=

2
exp(-0.3*s) * -----
s+2

>> step(G)
4) Discretize it with sampling period 0.1. HINT: Discretize without the delay and then add it in
discrete form. (1 point, 3 minutes)

>> Gz2wo=c2d(G2wo,0.1)

Gz2wo =

0.1813
----------
z – 0.8187

>> z= tf('z');
>> Gz2=Gz2wo/z^3

Gz2 =

0.1813
----------------
z^4 - 0.8187 z^3

But Matlab can also do it directly now:

>> Gz=c2d(G, 0.1)

Gz =

0.1813
z^(-3) * ----------
z - 0.8187

Sample time: 0.1 seconds


Discrete-time transfer function.

5) Can you control it with a proportional controller, either positive or negative? (1 point, 3
minutes)

>> rlocus(Gz)

The critical gain is close to 2.8, the system will always be oscillatory (because of both
sinusoidal components and alternating signs) and not too fast, without any guarantee of
precision.

>> Tz = feedback(0.261*Gz2,1)
>> step(Tz)
As expected, delay of 3 periods (3 times 0.1 seconds) and VERY imprecise system (the
original one has a comparable speed).

The negative proportional controller also provokes permanent oscillations of both kinds,
limited stability, and the control system would be slow and not precise (and getting slower
with bigger gains):

>> rlocus(-Gz2)

6) Can we use instead of a discrete PID a single pole at 1? Comment the results (2 points, 6
minutes)

>> PID=1/(z-1)
>> rlocus(PID*Gz2)
and zooming in, a possible optimal value, which nevertheless does not avoid both kinds of
oscillations:

>> Tz = feedback(0.0349*PID*Gz2, 1)
>> step(Tz)

Precise system, unnoticeable oscillations but very slow, as expected

7) Can you implement a dead-beat controller that implies a global transfer function as a single
delay? If it is not implementable, more delays can change it? (1 point, 3 minutes)

Absolutely not, we have a plant which is the average of the reactions of many pilots
(linearized and very simplified), dead-beat controllers are based on exactly canceling their
zeros and poles, it is never going to work with human real pilots.
8) Choose a controller, give its equation and justify whether it will be implementable within a
computer (1 point, 3 minutes)

The only possibility is our PID (single pole at 1), but it was slow because we did not have
any approximate derivative part. It is strictly causal and therefore straightforward
implementable:

X (z) X (z) 1
PID( z)= = =
E (z) Y r ( z)Y ( z) z−1

x (k +1)−x(k)=e(k )⇒ x(k)=x(k−1)+e(k−1)

9) Can a dead-beat control use only the controller at the feedback branch, H(z)? (1 point, 3
minutes)

Dead-beat controller by changing H instead of C:

G(z) G(z)−T ( z)
T (z)= ⇒G ( z)=T (z)+T ( z)G(z) H (z)⇒G ( z)T ( z) H ( z)=G( z)−T (z)⇒ H (z)=
1+G (z) H (z) G (z)T (z)

If we want the automatic control system act as a number of delays:

−n G ( z) G (z)−z−n z n G (z)−1
T (z)=z = ⇒ H (z)= ⇒ H (z)=
1+G( z) H ( z) G (z) z−n G(z)

Therefore delays are going to make the system unfeasible instead of feasible. It is
IMPOSSIBLE.

10) Can a discrete automatic control system be faster than the original plant? (1 point, 3
minutes)

Even if it is not easy to understand, yes we can often, not always, make a system faster
by adding a controller, remember the root locus of a single pole, a branch that goes to the
left.

11) Matlab gives the answer of a discrete control system step like but sisotool as purely
continuous, which one is right and why? (1 point, 3 minutes)

From the point of view of the computer (controller) everything is discrete, the orders that
it gives to the plant and the measures it gets from the plant, so all graphs could be
isolated points, not steps, and the usual Matlab representation is WRONG. But from the
“real world”, the output if the plant is continuous, so the sisotool representation is RIGHT.

You might also like