Scilab in Systems and Control
Scilab in Systems and Control
Dr. Balasaheb M. Patre, Professor and Head, Department of Instrumentation Engineering, SGGS Institute of Engineering and Technology, Vishnupuri, Nanded-431606. E-mail: [email protected]
www.scilab.org
Company LOGO
Introduction
A powerful tool to the numerical study of:
Input-Output dynamic systems Input-State-Output dynamic system Feedback analysis Feedback control design
SGGS Institute of Engg & Technology, Nanded 2
www.scilab.org
Company LOGO
Transfer Function
-->s=%s; // first create a variable -->num=36;den=36+3*s+s^2;
-->//create a scilab continuous system LTI object
-->TF=syslin(c,num,den) TF =
36 -------------36 + 3s + s2
Company LOGO
Company LOGO
Impulse Response
www.scilab.org
Company LOGO
Step Response
www.scilab.org
Company LOGO
Ramp Response
www.scilab.org
Company LOGO
TF to SS Conversion
-->SS1=tf2ss(TF) SS1 = SS1(1) (state-space system:) !lss A B C D X0 dt ! SS1(2) = A matrix = 0. 8. - 4.5 - 3. SS1(3) = B matrix = 0. 6. SS1(4) = C matrix = 0.75 0. SS1(5) = D matrix = 0. SS1(6) = X0 (initial state) = 0. 0. SS1(7) = Time domain = c
SGGS Institute of Engg & Technology, Nanded 8
www.scilab.org
Company LOGO
SS to TF Conversion
-->TF1=ss2tf(SS1) TF1 = 36 ---------- ------2 36 + 3s + s -->roots(den) ans = - 1.5 + 5.809475i - 1.5 - 5.809475i -->c=companion(den) c = - 3. - 36. 1. 0.
SGGS Institute of Engg & Technology, Nanded 9
www.scilab.org
Company LOGO
Transfer Function
-->s=%s; // first create a variable -->num=36;den=36+3*s+s^2;
-->//create a scilab continuous system LTI object
-->TF=syslin(c,num,den) TF =
36 -------------36 + 3s + s2
Company LOGO
Transfer Function
-->z=%z; -->Pd=syslin(d,1,z-0.5) Pd = 1 ------- 0.5 + z -->typeof(Pd) ans = rational
SGGS Institute of Engg & Technology, Nanded 11
www.scilab.org
Company LOGO
Company LOGO
Company LOGO
14
www.scilab.org
Company LOGO
15
www.scilab.org
Company LOGO
Conversion ss<->tf
Conversions are always possible tf2ss Ss2tf Conversions are subtles, refer to dynamic systems textbooks Affected by round-off errors See minss, minreal
SGGS Institute of Engg & Technology, Nanded 16
www.scilab.org
Company LOGO
17
www.scilab.org
Company LOGO
18
www.scilab.org
Company LOGO
| 6 0 |x + | 1 |u |-1 0 |x
19
www.scilab.org
Company LOGO
20
www.scilab.org
Company LOGO
21
www.scilab.org
Company LOGO
Root Locus
-->n=2+s; -->d=7+5*s+3*s^2; -->TF2=syslin('c',n,d) TF2 = 2+s --------------2 7 + 5s + 3s -->evans(TF2,20) -->xgrid
SGGS Institute of Engg & Technology, Nanded 22
www.scilab.org
Company LOGO
Root Locus
Default points useless! use evans(TF2,20)
23
www.scilab.org
Company LOGO
Root Locus
The basic operation needed to design with the root locus tool is to calculate the value of k that corresponds to a certain point in the locus: -->k=-1/real(horner(Stf,[1,%i]*locate(1))) locate returns the coordinates of a point in the graphic selected with the mouse horner computes a rational or polynomial in a given point
SGGS Institute of Engg & Technology, Nanded 24
www.scilab.org
Company LOGO
Nichols
black(); chart()
25
www.scilab.org
Company LOGO
Nichols
The curve is parametrized according to a constant range(!) Continuous time: [103, 103]Hz Discrete time: [103, 0.5] Better to use the whole syntax assigning frequency range: black(sl, [fmin,fmax] [,step] [,comments])
SGGS Institute of Engg & Technology, Nanded 26
www.scilab.org
Company LOGO
Bode
bode(); gainplot() Same considerations done for the Nichols diagram Better to use: bode(sl, [fmin,fmax] [,step] [,comments])
27
www.scilab.org
Company LOGO
Nyquist
nyquist(); m_circle()
28
www.scilab.org
Company LOGO
Company LOGO
Company LOGO
31
www.scilab.org