Matlab tutorial 3 CG 2020 PDF

Title Matlab tutorial 3 CG 2020
Course Control y Guiaje
Institution Universitat Politècnica de Catalunya
Pages 21
File Size 1.3 MB
File Type PDF
Total Downloads 71
Total Views 151

Summary

Matlab tutorial 3 CG 2020 Ejercicios practica 3 Matlab...


Description

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

1. Satellite attitude control Discrete transfer function 1) Is our (continuous) plant stable in open and closed loop? Check it directly, and also with the root locus, the Bode (double) diagram and indicate both the gain and phase margins. >>pole(G)

Absolutely unstable in the open loop.

1

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

>>T=feedback(G,1) >>pole(T)

With oscillations and marginally (un)stable in the closed loop 2

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

2) What sampling time should you select and why? (Nyquist criterion) Try different sampling times, for instance 1, 0.1 and 0.01. Do you perceive any difference in the open loop transfer function? In its step response (zoom-in)? What about the closed loop with unit feedback? >>damp(G)

The value of frequency is 0rad/s, therefore the value of sampling time is infinite so any sampling time used would work. >>Gz1=c2d(G,1)

T=feedback(Gz1,1)

3

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

>>Gz2=c2d(G,0.1)

>>T=feedback(Gz2,1)

>>Gz3=c2d(G,0.001)

4

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

>>T=feedback(Gz3,1)

>>step(Gz1,Gz2,Gz3,20)

Zooming in:

5

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

3) Draw the root locus for the different sampling period discretizations. Any difference at all? Sure?

The shape of the root locus is the same for each of the three signals but the values of gain differ by a value of 100 between them. We have complete instability due to the fact we have a double pole at the limit of the unit circle and as gain increases it just keeps gaining instability.

6

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

4) Now let us try a different discretization method assuming that the D/A converter has a FOH, Gz2 = c2d(G,Ts,'FOH'). What should this method guarantee? Compare the open loop step responses of the original functions and their discretizations (only for a common sampling time, 1, 0.1 or 0.01). What is the effect of different sampling times? Hint: represent 20 seconds, step(G, G1, G2, 20) >>Gz11=c2d(G,1,'FOH') >>step(G,Gz1,Gz11,20)

7

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

The zero order hold maintains the previous value but the first order hold looks ahead to the next value and between the previous and the next it maintains an average value.

Root locus and compensation 5) From now on, choose and stay with a single sampling time and therefore just a Gz (ZOH method) from now on. Draw its root locus, how can you stabilize it? It seems that just adding a zero would do the trick. Is it really so? Describe which one would be the feasible part of the root locus for the closed-loop poles to satisfy the design requirements. >>rlocus(Gz1)

8

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

>>z=tf('z',1) >>rlocus(Gz1*z)

But in this case it’s non-strictly causal.

9

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

6) Now let us use the SISOtool. Make it show transfer functions in zpk (gain, zeros and poles) form. Can you use a differentiator (as MatLab understands it) to compensate the plant? Why? Choose a suitable compensator, select the gain value and plot the response of the closed-loop system to a discrete step entry θref=12º. Obtain the overshoot M and the peak time tp corresponding to the requirements.

10

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

We have an overshoot M=69.9% and a tp=1s. But these are approximations due to it being a third order system.

11

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

Dead-beat controller (variation of Truxal method) 7) Discrete-time systems can be very flexible, and we can design our closed loop transfer function to operate just as a delay of a sampling period, the simplest pure dead-beat controller. Is the controller feasible, physically possible? Why? >>Cz=1/(Gz1*(z-1)) >>minreal(Cz)

>>impulse(Cz,20)

12

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

Marginally unstable.

>>T7=feedback(Cz*Gz1,1) >>minreal(T7)

13

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

>>step(T7,20)

14

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

The controller is physically possible but due to its relative order being 0 it’s unfeasible.

15

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

8) Calculate the needed controller, indicating every step, and then plot, with the aid of MatLab, the consequent closed loop step response. Represent also the input that the controller should supply to the plant. How would the −1

−2

controller change if we prefer 𝑇(𝑧) = 0. 62 𝑧 + 0. 38 𝑧 as closed loop response (total transfer function)? Why could we prefer this second approach? %Truxal >>T8=((0.62/z)+0.38/(z^2) >>C8 = T8/(Gz1*(1-T8)) >>minreal(C8)

>>step(T8)

16

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

Also physically possible but unfeasible

17

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

We could prefer this option due to the fact it consumes less energy than the one before.

18

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

2. Additional considerations on the sampling period 9 & 10) What is the effect of the sampling time on its discretization (let us assume ZOH)? Try 0.1 and 10 seconds, check stability (with care, pay attention to the details) and the theoretical impulse and step responses in both open and close loop (with unit feedback). Can you notice something unexpected? >>G9=0.1/(s*(s+1)) >>damp(G)

We have to take the sampling period corresponding to the highest natural frequency, therefore we have to take a sampling frequency of 10, 20 or 30rad/s which equals 0.62s, 0.31s or 0.15s as sampling time. The 0.1s option would be valid but the 10s one would meet the requirements. >>Gz1=c2d(G9,0.1) >>Gz2=c2d(G9,10) >>figure(1) >>rlocus(Gz1) >>figure(2) >>rlocus(Gz2)

19

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

20

Uriel López Fernández, Arnau Padullés Menal Matlab tutorial 3

At first glance you could think that the root locus looks much better for the sampling time of 10s, if you look at the critical gain values, you will see that the 0.1s root locus has a much greater region of stability than the 10s.

21...


Similar Free PDFs