صفحه 1:
www.elecdl.com
Application Software
Course
Control
&
Simulink
By: Mahdi Akbari
November,09
صفحه 2:
Roots
6+و5 + 42 + تو3 + “و2 + م - (و)6
>> roots([1,2,3,4,5,6])
ans =
0.5517+ 1.25331
0.5517- 1.25331
-1.4918
-0.8058+ 1.2229
-0.8058- 12229
صفحه 3:
Symbolic Mathematic
Sym: Create symbolic object
x=sym(’x’) <<
Syms: Shortcut for creating multiple
symbolic objects
syms x,y <<
صفحه 4:
5۱00
Integral Transforms
fourier Fourier transform
ifourier Inverse Fourier transform
ilaplace Inverse Laplace transform
iztrans Inverse Z-transform
laplace Laplace transform
ztrans Z-transform
صفحه 5:
Examp
le
2
ip) = +3846
+ 75+ و3 + و
syms s <<
>> f= (5*s*2 + 3*5 +6)/(s*4 + 3*8*3 +
Sa 2 TONS تم
>> ilaplace(f )
صفحه 6:
Transfer Functions
St+5
CS F428 43544545
>> num=[1,5];
>> den=[1,2,3,4,5];
>> G=tf(num,den)
صفحه 7:
Transfer Functions
6(s+5)
G(s) =
(S'+3s+1) (5+6)(8'+6s +5s+3)
den=conv(conv(conv([1,3,1],[1,3,1]),[1,6]), <<
;[1,6,5,3])
jnum=6*[1,5] <<
G=tf(num,den) <<
صفحه 8:
Transformation of
System Model
(Steady State)
نا جلك دعر
y=Cx+ Du
>> G=ss(A,B,C,D)
صفحه 9:
©
۱
- ,066,۰06 :۵,66 ,۰66,466 ,666 :۰ ,406 ,6 ,06 ۵]عی <د
:0.26 ,۵.۵6 ,42۵ ,۵6 :1664
>> [© ,0 :6 ,6 :6,6 زه ,]دمر
:]0, ©, 0, ٩: ۵, 6, 0, 6[ >>
>> (©,©) د
>> (۵,۵,0,0)سع
صفحه 10:
Transformation of System Model
درم وم ها _ و1
Ag 7 den OF A B+D
X=Ax+ Bu
y=Cx+ Du
tf2ss (num, den) = [A, B, C, D]
ss2tf (A, B, C, D) = [num, den]
0
صفحه 11:
Zero-pole-gain Description
53 + 0.928
72i)(s — 0.0433 + 0.6412i)
(s+1
(s + 0.9567 + 1
G(s) =6
>> KGuc=O;
>> T=[.960F; -0.09G9+0.9807;; -0.0969-0.980?]];
>> P=-O.9G0?+1.CC TE; -0.OGOTA.CS PE;
0. 0899*0060: +0.0F99-0.006];
<< ,)ات ۳,۵۰۰
a
صفحه 12:
step responses
Y MP
Y Rise time
Y Fall time
Y Over shoot
step (num,den) <<
step (A,B,C,D) <<
:for find
صفحه 13:
:Form 3
>> [y,x,t] = step (num,den,t)
>> plot(t,y)
/\¢ oscil model
06
صفحه 14:
impulse responses
As) _ 1
As) s+1
:For impulse responses
R(s)=1
کر ee
OB emer 5
_ Ad _ s
5 1 +1
Step (s G(s) )
ag
صفحه 15:
impulse responses
impulse (num, den) <<
صفحه 16:
Ramp responses
* Crp (GG )
صفحه 17:
ما ۳ 0 ب Feedback
Gt=feedback(G,H) <<
syms 01 02 % declare symbolic variables <<
Gt=feedback(g1,g2,+1); %Defult: <<
negative feedback
pretty(Gt) <<
صفحه 18:
:Example
>> G1=tf(1,[1,2,1]); سره
>> G2=tf(1,[1,1]);
>> G=feedback(G1,G2) %:
8+1
ae
صفحه 19:
Bis) _ num _ B(l)s" +6(2)s""1 +...4. b(n)
A(s) قلعط a(1)s" + a(2)s""1 +...+ a(n)
residue(num, den) = [r, p, k]<<
Bis) rl) r(2) rn)
= h(a) + + +o 4
A(s) (1)م-و s~pl2) s— p(n)
صفحه 20:
Root Locus Plots
0 G
R 1+GH p 5 |G Cc
11
nocus (num, den) = [r, k]
nocus (num, den, &) = [r, k]
nocus (A, B, C, D) =[r, kK
nocus (A, B, C, D, K) - ] Kl
eo
صفحه 21:
Example a
رو + وق + وه
jnum = [000 1] <<
;den = [159 0] <<
;rlocus(num, den) << 5
Root Locus
Imag Axis
هه
صفحه 22:
Bode Diagrams
bode(num, den)
bode(num, den, W)
bode(A, B, C, D) (3.36)
bode(A, B, C, D, W)
bode (num, den) = [mag, phase, w]
bode (num, den, w) = [mag, phase, w]
bode (A, B, C, D) = [mag, phase, w]
bode (A, B, C,D, w) = [mag, phase, w]
bode (A, B, C, D, iu, w) = [mag, phase, w]
ee
صفحه 23:
Example ) + 07۳
5
G(s) = 29.125
Bode diagram% <~
jnum= [29.125 33.2025 9.4627] <<
;den= [0 1 0] << سر
bode (num, den) << _ « بعر
ه06
صفحه 24:
Nyquist Plots
nyquist (num, den, w)
nyquist (A, B, C, D)
nyquist (A, B, C, D, w)
nyquist (A, B, C, D, iu, w)
nyquist (num, den) = [re, im, w]
nyquist (num, den, w) = [re, im, w]
nyquist (A, B, C, D) = [re, im, w]
nyquist (A, B, C, D, w) = [re, im, w]
nyquist (A, B, C, D, iu, w) = [re, im, w]
ee
صفحه 25:
Example Gs) = k(s + Dis+ 3+ 7i(s+3-7i)
و)(:7 + ق + و)(3 + و)(1 + و) + 3 - 71(
5153502 ددر
>> [7*1 - 3 -7*1 + 3 - 5 - 3 -1 -] > مر
jk = 30 >>
nyquist (num, den) <<
Nyquist Diagram
Imaginary Axis
9
es
صفحه 26:
?What Is Simulink
¢Simulink is a software package
for modeling, simulating, and
analyzing dynamical systems.
* It supports linear and nonlinear
systems, modeled in continuous
time, sampled time,
or a hybrid of the two.
صفحه 27:
How to open simulink
٠ Click oc this مجلا
ah eA)
seen
۰ ۲۲ ees
en
صفحه 28:
یود
create a model
Dp cred the wodel, Pirst pe
اند ۲ the DBTLOB
cowwand wiedow. Ou
ODierosoht Dicdaws, the Gicvulick
Library Orawser uppeus.
9
صفحه 29:
Open new window
TeX Yon tb
eae |
Sommer sed Blk sine Camnol
[Commonly Used Blocks 8
Cat
eden Ts To
Fist 3) 0 2-7 26 ب هه هزه
صفحه 30:
Model Editor
الالضلعا 9
bar سل فا م۳ مهافت Tle
سم | نع ه ۸ 3ه 2 هم
Contest
canvas لم face ۳
جى | ول« me
be o
دی
Ready foe Rf Status br
280
صفحه 31:
View Command History
+ Beek =(Depkye ke 5
تاه و Pornward=( (Displays the
ee ee
2 )متا So Parect )
90
صفحه 32:
Building a Simple Model
° Dhis exccple shows pou how to لايجا a code usicgy c7tay oP the
worded buikdiccy
* یه له ممم pou will use to build pour sud wodels
° Dke wodel ioteqrotes o stor wove ood displays the resul, uizag
wits the sice wave. Nhe block dora oF the wooded lochs lke this
صفحه 33:
Create example model
Do oredr this wodel, you wil صا لوه copy blocks toto the wodet
Prov the Pollouvtcgy Gieruttak block thrones:
(Cores dra (be Ore (are beet)
(Gre teary (he Geece beech)
Couticuvus library (the هه block)
. Oxqrs & Opstews tbrury (the Dux block)
صفحه 34:
2
0
computor etn
۳ سای نج
سس ] سس
locate
مره الیو بط
عن ملسا ل
5 عادص فاه
و
هه
1
وود
هه دود نک
om seca دود ند
Bae
‘Be Sources [Be] | Signal Generar
User-Defined Functions: 2
2a ١ م
۱
مومت ۷
Bisons so ما بط
ita teustonToobae
RA] سین
fib]
|
2
3 Uri Rana _ Sock Params
صفحه 35:
اه 5 ایا
‘Fle Edt View Simulation Format Tools Help 1
Die 5| ۸ دهاع ه ۵
م 6096لا
صفحه 36:
(ik ol he blocks copied tv the sordel widow, the code should looks
سوام the.
۳ }
ا اج =e
Imegraior
Qow t's tere ty opener the blocks.
بط لاور the comer butoa ced wove he cursor to he top apd port oF the
Dre block, Dotice that he tor ts dashed while the wouse bution te dow cd tat
thr puree cope ماو ۱ سوه مها موه وا وا موم fae (Doe
4
و
block.
صفحه 37:
۰ Dow مت من با واه The blocks one ovocerted
& ل
و
۰ Press und hold dow the Ot key. Press ۶ ۲۵۵۵ 0 Rea
deay the pointer to the Ioteqrator block's iaput port or over the
وا اس مه[
م8
صفحه 38:
۱ block cooceniives. Dkeo pou door, pour wodet
should look sowethtary like this.
80
صفحه 39:
نالهك
Feet Tack Hep
وس 1 ۳ سا ۱ ها زب ۳۰۵ : 51 8 8اه
تنن يي جيم Peay
66
صفحه 40:
Qow, opes the Scope bck to view موجه culpa. Keepiay ie Scope
widow oped, موه 0 ۵ موجه مد و )ود وه
Paraweters Brow the Gkoukaioa wrcu. موه روا مور موجه با
Ou
ihe thedon box bool وميه
swiire thot the عم م۵0
ص ادك سا 000.0
oh) فمخط ص)
0
صفحه 41:
۰ Choose Groat Prow the Groukaiog weou ood Wwaoick the teases oP
the Goope block's input.
60
صفحه 42:
Oiewiery Ghonouts اول۱(0)
Microsoft Windows:
۳
۷
1
9 Arrow
۳
0
0
f
Space
Hold dawn p or q and drag mouse
ot ShifteLeft Arrow
‘tor Shif¥Right Arrow
Delete or Back Space
Use arrow keys
Task
Zoomin
Zoom out
Zoom to normal (100%),
Pan et
Pan nght
Pan up
Pan down
Fitselectonto screen
Fit ciagramt0 sersen
Penwith mouse
[Go backin parvzoom history
رطان ممسكودم ل سوسوم و
مامه واو
Move selection
6
صفحه 43:
(lock Oingreaws سر[
Gelert Low وا Prow the Oiew eau (or ype 7) to edhe the view. rte
Dove Ou Prow the Orw wea (or pe v) to اه
the view.
Gekert Pt Opstew To Otew Prow he Otew weau (or press he spare bur)
ty Pathe dagrenn he view. 3 سس
Gelert مت وتا he Otew تج |
۲ «ممسوعمك جما بصا وا )0 (or pe
whl size. i
9
صفحه 44:
colors
۰ لوق ulows you to speciPy the Poregrousrd ood backyrued
polors oF cay block
* select موق olor Prow the Giulia Porat wea
ee
صفحه 45:
Connecting Blocks
Crceentoy Tu Blocks Te cute pooner ty blocks: Gelert te
source block.
© Wold devs Ot ced fePoioks the desticratica blo. Gierukets czcraerts the
source block to the desticratica blot
ff | ظ
يا
عه مه روموت عه عرو ول(
possible beter the tue blocks us thustrated مومت رجشسصاا( عا و
Before avlaconnect ‘Mier ouloconnect
©) Okeu coocertiagy tw blocks, Oi
9
صفحه 46:
Connecting Groups of
Source Blocks
oP sexier blocker tot deat bleeds pa a و و و و امه
و اه وت و امه و وا ماو اه ی و و اما مود
blots: ما و ره توا
* Gelert the source blocks.
* Wold dows Ord ced teP عاصاص the desticatica block.
Bl #4
صفحه 47:
connect a source block toa
group of destination blocks
* Gelert the desticaiva blocks.
قلا
سپس
قلا
دود اوعد
* Wold dove Cid aed feP click the source block.
Co
8 Display
قلا
Displayl
صفحه 48:
Moving a Line Segment
۰ Do wove ه hee veut:
* (osiivg the poister vo the seqsved pou woot 7 wovr.
٠ Orog the pointer to the desired lovato.
6
صفحه 49:
Inserting Blocks in a
Line
:عملا ه دز كاعصاط د و و ۰
* @osiico the poister over the blocs ced press the tePt ous buttos.
Ba تاه
٠ هذ صجلا جكاا عصيص عاصصاط جذاا بع( whick pou woot 7 tasert the block.
iba
Bsa
* Release the wouse buttos to drop the blocks vo the foe.
* Gtevuhok toserts the block where pou dropped it.
۲
9
صفحه 50:
Disconnecting Blocks
٠ سول و u block Prow روم جلا lies,
لاوا dow the GHP Rep, theo drag the block to a
.ددص زره
صفحه 51:
Creating Subsystems
* Os pour wodel eoreuses fa size ced powplexiy, pou cot
sioplPy it by evupiey blocks into subspstews. )1( 55
subspstews hus these advectayes!
۰ A thelps reduce the cucber oP blocks displayed to pour
اس مت
۱ و toyether
صفحه 52:
Creating a Subsystem by
Adding the Subsystem
Block
* To create a subsystem before adding the blocks
* Copy the Subsystem block from the Ports &
Subsystems library into your model.
* Open the Subsystem block by double-clicking it.
* In the empty Subsystem window, create the
subsystem.
¢ For example, the subsystem shown includes a
Sum block and inport and Outport blocks to
represent input (7
it
subsystem. In 7
+ رت
(24 Out
Sum
Ind ده
صفحه 53:
Creating a Subsystem by
Grund Existing Blocks
dl woeased و سس مسا ae
هط تن ne emer ited
سلج toe ler جا امد دص meee: te عسي لحن ليلا نمايو <
23 كاها ماممدا ها رخاس متحت رولا بجنا lrg eer aka coved
.لمهت ذا تصصاد©) جما يجاوب برا عجن زرط by selectag thew
Choose Create Gubs
مت
the ender ry sys, مس © AP pou open the Cubs ۰
shown below.
