Download RTAI-Lab tutorial
Transcript
4.3 4.3.1 From continuous- to discrete-time Discretize the system Say a continuous-time feedback system includes a plant modeled by the transfer function: G(s) = 20 . s2 + 4s Use Scilab to discretize the system with a sampling time of 1 ms. -->s = poly(0,’s’); -->G = [20/(s^2 + 4*s)] G = 20 -----2 4s + s -->Gc = syslin(’c’,G); -->T = 0.001; -->Gd = ss2tf(dscr(tf2ss(Gc),T)) Gd = 0.0000100 + 0.0000100z -----------------------2 0.9960080 - 1.996008z + z The system’s discrete-time transfer function is therefore: G(z) = 10−6 4.3.2 z2 10z + 10 . − 1.996z + 0.996 Block diagram and simulation Replicate the block diagram of figure 12 (you will use palettes Sources, Sinks, Linear, and Branching). num(z) den(z) 2 Mux −1 Figure 12: Scicos block diagram to simulate the step response of a discretized plant. • Clock block: set Period = 0.001, Init time = 0 • Step block: set step time = 1, Initial value = 0, Final value = 1. • Gain block: set gain to 2 25