Sunteți pe pagina 1din 10

Department of Chemical Engineering University of Texas, Austin

ChE 360 Spring, 00!

"ntro#uction to the $AT%A& S"$U%"'( )rogram


Reference: Seborg, Edgar, and Mellichamp, Process Dyamics and Control, 2nd ed., Wiley (2004). MA !A", #hich $%and$ for MATrix LABoratory, i$ a %echnical comp&%ing en'ironmen% for high(performance n&meric comp&%a%ion and 'i$&ali)a%ion. S*M+!*,- i$ a par% of MA !A" %ha% can be &$ed %o $im&la%e dynamic $y$%em$. o facili%a%e model defini%ion, S*M+!*,- add$ a ne# cla$$ of #indo#$ called block diagram #indo#$. *n %he$e #indo#$, model$ are crea%ed and edi%ed primarily by mo&$e( dri'en command$. .ar% of ma$%ering S*M+!*,- i$ %o become familiar #i%h manip&la%ing model componen%$ #i%hin %he$e #indo#$. he p&rpo$e of %hi$ %&%orial i$ %o in%rod&ce yo& %o S*M+!*,- and gi'e yo& e/perience $im&la%ing dynamic $y$%em$. *n %he fir$% par% of %hi$ %&%orial, yo& #ill &$e S*M+!*,- %o genera%e an open(loop $e%(poin% and di$%&rbance re$pon$e for a dynamic proce$$. *n %he $econd par% of %he %&%orial, yo& #ill genera%e %he clo$ed(loop $e%(poin% and di$%&rbance re$pon$e$. .lea$e re'ie# Appendi/ 0 in Seborg e% al. before a%%emp%ing %hi$ %&%orial. !og on%o one of %he .0 comp&%er$. 0lic1 on %he Micro$of% 2S%ar%3 b&%%on in %he bo%%om corner of yo&r $creen and MA !A" #ill be li$%ed &nder 2.rogram$3. 4pen MA !A". o in'o1e S*M+!*,-, %ype simulink a% %he MA !A" promp% #hich i$ indica%ed by 2553 in 6ig&re 7 belo#. A ne# #indo# %i%led simulink #ill open $ome#here on %he $creen.

*igure+, *ni%ial Ma%lab Screen

*igure , Sim&lin1 !ibrary "ro#$er 8o& #ill ha'e %o righ% clic1 on %he Sim&lin1 bloc1 %o ma1e %he men& on %he righ% 'ie#able. 4nce %he $im&lin1 #indo# bloc1 on %he righ% i$ open, yo& are ready %o b&ild a S*M+!*,- model. hi$ %&%orial i$ di'ided in%o %#o $ec%ion$. *n %he fir$% $ec%ion, yo& #ill b&ild a model of %he open(loop $y$%em for %he $econd order pl&$ %ime delay proce$$ 2 e s G( s) = and de%ermine %he &ni% $e%(poin% and &ni% di$%&rbance re$pon$e$. (70 s + 7)(9s + 7) *n %he $econd $ec%ion, yo& #ill b&ild a clo$ed(loop model of %he $ame proce$$. Af%er %he clo$ed(loop model i$ con$%r&c%ed, yo& $ho&ld $im&la%e %he &ni% di$%&rbance re$pon$e and %he &ni% $e%(poin% re$pon$e for %#o differen% .*: con%roller %&ning me%hod$, * AE ($e%( poin%) and * AE (load), in able 72.; (SEM). he follo#ing $%ep$ #ill g&ide yo& %hro&gh %he di$c&$$ed %a$1$. Construction of an -pen.%oop &loc/ Diagram 0Chapters 1, 2, 6, an# 34 7. 4pen a ne# emp%y $y$%em #indo# by $elec%ing 'e5 follo#ed by $o#el from %he *ile men& in %he $im&lin1 #indo#. he ne# #indo# #ill be %i%led untitled. 8o& #ill b&ild yo&r clo$ed loop model in$ide %hi$ #indo#. Sa'e %he emp%y model by

choo$ing Save from %he *ile men& in %he &n%i%led #indo#. ,ame %he model, examplesim. 6rom %hi$ poin% on, %he model #ill be referred %o a$ examplesim. 2. !oo1 a% %he li$% belo# 2$im&lin13 in %he Sim&lin1 !ibrary "ro#$er #indo#. 0lic1 on 2So&rce$3 and $elec% %he cloc1 from %he ne# li$% and drag %he cloc1 bloc1 from %he Sim&lin1 !ibrary "ro#$er (6ig&re 2) %o %he examplesim #indo#. 0lic1 on %he 2Sin1$3 bloc1 in %he $im&lin1 #indo# and drag %he o Wor1$pace bloc1 %o examplesim. 0onnec% %he o&%p&% of %he cloc1 bloc1 %o %he inp&% of %he o Wor1$pace bloc1. :o&ble(clic1 on %he o Wor1$pace bloc1 %o open i%$ dialog bo/. 0hange <ariable name from simout %o t. Se% %he $a'e forma% $ho#n a% %he bo%%om of %he dialog bo/ a$ 2Array3. *f yo& ha'e follo#ed %he abo'e $%ep$ correc%ly, %he model #ill loo1 li1e %hi$:
t Clock To Workspace

*igure 3, 0on$%r&c%ion of ime <ec%or he $imple model abo'e #ill o&%p&% a %ime 'ec%or t %o %he #or1$pace #hich can be &$ed #i%h %he plot command. A$ yo& ha'e $een, do&ble(clic1ing on a bloc1 #ill open a #indo# filled #i%h more bloc1$ or open %he dialog bo/ of %he bloc1. he dialog bo/ i$ &$ed %o $pecify parame%er$ %ha% go'ern %he opera%ion of %he bloc1. ;. 0opy %he ran$fer 6cn and ran$por% :elay bloc1$ from %he 20on%in&o&$3 bloc1, re$pec%i'ely, %o xamplesim. 0onnec% %he o&%p&% of %he ran$fer 6cn bloc1 %o %he inp&% of %he ran$por% :elay bloc1. 0lic1 on %he 2 Trans!er "cn3 label and rename %he ran$fer 6cn bloc1 =.roce$$ 6=. hi$ bloc1 repre$en%$ %he proce$$. ,o%e %ha% in %hi$ problem, %he proce$$ i$ >($) ? > '>p>m, no% >p. 4pen %he dialog bo/ of .roce$$ 6 by do&ble(clic1ing on i%. Specify ,&mera%or a$ @2A and :enomina%or a$ @90 79 7A. hi$ indica%e$ %he %ran$fer f&nc%ion 2B(90$ 2 C 79$ C 7). he ran$fer 6cn bloc1 reD&ire$ $pecifica%ion of 'ec%or$ for %he n&mera%or and denomina%or. he 'ec%or elemen%$ are %rea%ed a$ %he coefficien%$ of de$cending po#er$ of $ in %he polynomial$ repre$en%ing %he n&mera%or and denomina%or of %he %ran$fer f&nc%ion. o $ee %he denomina%or polynomial of $ comple%ely di$played in %he bloc1E$ icon, yo& may ha'e %o re$i)e %he bloc1F$ icon. :o&ble(clic1 on %he ran$por% :elay and $e% ime delay %o 7. ,o%e %ha% %he ran$por% :elay bloc1 can be &$ed %o repre$en% o%her %ype$, $&ch a$ mea$&remen% delay. 0opy %he .roce$$ 6 and ran$por% :elay bloc1$ and place %he copie$ $ligh%ly abo'e %he original$. he copie$ #ill a&%oma%ically change name$ %o #Process T"$% and #Trans!er Delay$%. ,o %#o bloc1$ can ha'e %he $ame name in on S*M+!*,- #indo#. o D&ic1ly copy %he original bloc1$, $elec% bo%h of %hem and drag %hem &$ing %he righ% mo&$e b&%%on. Rename %he .roce$$ 67 bloc1 #Disturbance T"%. *n %hi$ e/ample >p and >! are %he $ame, $o %he ,&mera%or

4.

and :enomina%or parame%er$ in %he dialog bo/ of :i$%&rbance 6 are no% changed (See 6ig&re 4). 9. .lace a copy of %he S&m bloc1, loca%ed in %he 2Ma%h3 men&, %o %he righ% of %he ran$por% :elay bloc1. :o&ble clic1 abo'e %he $&m bloc1 and label %he bloc1 2S&m3. 0onnec% %he o&%p&% from each ran$por% :elay bloc1 %o %he inp&% of %he S&m bloc1. he n&mber of inp&%$ and %heir polari%y can be modified from %he dialog bo/. !a%er in %he %&%orial yo& #ill be reD&ired %o do %hi$. G. 0opy %he o Wor1$pace bloc1 %o %he righ% of %he S&m bloc1 and connec% %he o&%p&% of %he S&m bloc1 %o %he ne# o Wor1$pace bloc1. :o&ble(clic1 on %he ne# bloc1 and $e% <ariable name %o Y. he model de'eloped %o %hi$ poin% i$ a model of %he open(loop $y$%em. 0opy a S%ep *np&% bloc1 from %he 2So&rce$3 men&, place %he bloc1 %o %he lef% of :i$%&rbance 6 and connec% i% %o %he inp&% of :i$%&rbance 6. he S%ep *np&% bloc1 genera%e$ a $%ep f&nc%ion. he $%ep %ime (%ime a% #hich %he $%ep occ&r$), ini%ial 'al&e, and final 'al&e of %he f&nc%ion can be $pecified. 6or no#, open i%$ dialog bo/ and $e% %he $%ep %ime, ini%ial 'al&e, and final 'al&e %o )ero, i.e., di$abling %he bloc1. Rename %he bloc1 2:3. .lace a copy of : %o %he far lef% of .roce$$ 6 and rename %he ne# bloc1 2 &3. 0onnec% + %o %he inp&% of .roce$$ 6. :o&ble(clic1 on + and $e% S%ep %ime %o 0, *ni%ial 'al&e %o 0 and 6inal 'al&e 7. + #ill genera%e a &ni% $%ep f&nc%ion in %he manip&la%ed 'ariable a% %ime )ero. he model de'eloped %o %hi$ poin% i$ a model of %he open(loop $y$%em. *% $ho&ld loo1 $imilar %o %he model belo#.
t Clock To Workspace 0.3 15s+1 D Disturbance TF Transport Delay 1 Sum Y T o Workspace 1 2 50s2 +15s+1 U Process TF T ransport Delay1

H.

I.

*igure 1, 4pen(!oop "loc1 :iagram J. ,o# #e are ready %o $im&la%e %he open(loop re$pon$e of %he $y$%em. o $elec% %he in%egra%ion %echniD&e and parame%er$ %o be &$ed d&ring $im&la%ion$, p&ll do#n %he Simulation men& and choo$e )arameters. A dialog bo/ i$ opened $ho#ing all %he $im&la%ion parame%er$ %ha% can be modified. Se% %he S%op ime %o 90 and %he
4

Ma/ S%ep Si)e %o 7. "eca&$e %he $y$%em i$ ea$y %o n&merically in%egra%e, S*M+!*,- can and #ill %a1e in%egra%ion $%ep $i)e$ eD&al %o %he defa&l% 'al&e of 70. *f %hi$ occ&r$, %he appearance of %he re$pon$e #ill no% be $moo%h. "y $e%%ing Ma/ S%ep Si)e %o 7, Y #ill be o&%p&% %o %he #or1$pace each %ime in%er'al and %he $im&la%ed re$pon$e #ill be $moo%her. S%ar% %he $im&la%ion by $elec%ing Start from Simulation men&. he re$&l%ing Y and t 'ariable$ in %he #or1$pace #ill be for %he open(loop &ni% $e%(poin% re$pon$e. 70. 4nce a $im&la%ion ha$ been comple%ed, %he re$&l%ing da%a can be manip&la%ed and analy)ed &$ing MA !A". Selec% %he MA !A" command #indo# and %ype plot(t,Y) %o 'ie# %he re$pon$e. he plot command open$ a MA !A" 6ig&re #indo# and genera%e$ a plo% in$ide %he #indo#. o add / and y a/i$ label$ and a %i%le %ype xlabel(Time) ylabel(Y)

*igure 2, +ni% $%ep re$pon$e of open(loop $y$%em 6ig&re 9 $ho#$ %he re$&l%ing plo%. 8o& can add %i%le or a/e$ label$ $imply by inp&%%ing charac%er$ on%o %he fig&re #indo#. o do %hi$ yo& need %o fir$% clic1 %he 2A3 b&%%on on %op of %he #indo#, %hen do&ble(clic1 on %he place #here yo& #an% %o p&% yo&r #ord$. A fla$hing c&r$or #ill $oon appear %elling yo& %ha% yo& can %ype no#. 77. ,o# $im&la%e %he open(loop &ni% di$%&rbance re$pon$e. :o&ble(clic1 on + and $e% 6inal 'al&e %o 0. hi$ elimina%e$ %he &ni% $%ep in %he manip&la%ed 'ariable. :o&ble(clic1 on : and $e% S%ep %ime %o 0 and 6inal 'al&e %o 7. hi$ crea%e$ a &ni% load $%ep. Again, $elec% Start from %he Simulation %o begin %he $im&la%ion. ype
9

plot(t,Y)%o 'ie# %he re$pon$e. 8o& can $ee %ha% %he old t and Y #ere replaced. he old /(a/i$ label can be D&ic1ly added hi%%ing %he &p arro# 1ey %o %oggle %hro&gh all pa$% command$ &n%il xlabel(Time) i$ di$played. Ki% re%&rn %o e/ec&%e %hi$ command. Repea% %hi$ %echniD&e for %he ylabel. 6rom %he MA !A" promp%, command$ can only be edi%ed &$ing %he arro# 1ey$L &$ing %he mo&$e #ill no% #or1. 6ig&re G $ho#$ %he re$&l%ing plo%.

*igure 6. +ni% di$%&rbance re$pon$e of open(loop $y$%em 72. *f yo& are no% con%in&ing %o %he ne/% $ec%ion, $a'e %he file examplesim $o %ha% yo& can &$e i% in con$%r&c%ing a clo$ed(loop bloc1 diagram. Construction of Close#.%oop &loc/ Diagram 0Chapters ++ an# + 4 7. 2. 4pen %he file examplesim if i% i$ no% already open. 0lic1 on %he connec%ion be%#een %he + bloc1 and .roce$$ 6 bloc1 and dele%e i%. Rename %he + bloc1 %o 28$p3. hi$ bloc1 #ill be &$ed %o prod&ce a $%ep change in %he $e%(poin%. .lace a copy of %he S&m bloc1 %o %he righ% of 8 $p. :o&ble clic1 abo'e %he $&m bloc1 icon and label %he bloc1 2S&m73. 4pen i%$ dialog bo/ and change %he CC $eD&ence %o C(. *n$%an%ly, %he bloc1F$ icon #ill reflec% %hi$ change. he %op inp&% #ill ha'e a C loca%ed %o %he righ% of i% #hile %he bo%%om inp&% #ill ha'e a M loca%ed abo'e i%. herefore, %he o&%p&% of S&m7 #ill be %he %op inp&% min&$ %he bo%%om inp&%. 0onnec% %he o&%p&% of 8$p %o %he %op inp&% of S&m7. Al$o, connec% %he o&%p&% from S&m %o %he bo%%om inp&% of S&m7. hi$ can be done by clic1ing on %he bo%%om inp&% of S&m7 and dragging %he arro# %o %he o&%p&% of S&m. he

;.

o&%p&% of S&m7 i$ %he error be%#een %he $e%(poin%, 8$p, and %he con%rolled 'ariable, Y. 8o&r model $ho&ld loo1 li1e 6ig&re H:

t Clock To Workspace 2 50s2 +15s+1 D Disturbance T F Transport Delay 1 Sum Y To Workspace 1 2 50s2 +15s+1 Ysp Process T F Transport Delay1

Sum 1

*igure 3. .ar%ially 0omple%ed 0lo$ed !oop :iagram 4. ,o# clo$e %he 2Sim&lin13 bloc1 men& and open %he 2Sim&lin1 E/%ra$3 bloc1 by righ% clic1ing on %he bloc1 labeled 2Sim&lin1 E/%ra$3. 0lic1 on %he 2Addi%ional !inear3 bloc1, %hen $elec% %he 2.*: 0on%roller3 and drag i% %o %he righ% of %he ne#e$% $&m bloc1. 0onnec% %he o&%p&% of %he S&m7 %o %he inp&% of .*: con%roller and %he o&%p&% of .*: con%roller %o %he inp&% of .roce$$ 6. :o&ble(clic1 on %he .*: con%roller and en%er %he * AE (load) con%roller $e%%ing$ gi'en in able 72.; in Seborg e% al. .lea$e no%e %ha% S*M+!*,- .*: con%roller $e%%ing$ are P, I, and D #here P ? -c, I ? -cBNi, and D ? -cON:, $o n&merical 'al&e$ of ., *, and : $ho&ld reflec% %he$e defini%ion$. he model yo& ha'e de'eloped repre$en%$ %he clo$ed( loop $y$%em. 8o&r model $ho&ld no# loo1 $imilar %o 6ig&re I:
t Clock To Workspace 2 50s2 +15s+1 D Disturbance TF Transport Delay 1

X1 Sum Y To Workspace 1

Sum 1

E PID

2 50s2 +15s+1 Process TF Transport Delay1 X2

Ysp

PID Controller

*igure 6, 0lo$ed(!oop :iagram

,o%e %ha% $ome %e/% ha$ been added %o %he bloc1 diagram $ho#n on %he pre'io&$ page. Simply by do&ble(clic1ing on a poin% in examplesim and %yping, %e/% i$ added %o %he diagram a% %he poin% #here yo& clic1ed. he E, ., P7, P2 %e/% in %he bloc1 diagram ha'e no effec% on i%$ opera%ion. 9. ,o# #e are ready %o $im&la%e %he clo$ed(loop re$pon$e of %he $y$%em. We #ill $%ar% #i%h %he $e%(poin% re$pon$e. 0lic1 on bloc1 : and $e% %he 6inal 'al&e %o 0 $o %ha% no $%ep in %he di$%&rbance #ill occ&r. 0rea%e a $%ep in %he $e%(poin% by clic1ing on 8$p and $e%%ing %he 6inal <al&e %o 7. S%ar% %he $im&la%ion by $elec%ing Start from Simulation men&. he re$&l%ing Y and t 'ariable$ in %he #or1$pace #ill be for %he &ni% $e%(poin% re$pon$e, beca&$e : (di$%&rbance) ha$ been di$abled. Selec% %he MA !A" command #indo# and %ype %he follo#ing command$ %o ob%ain a labeled plo% of %he re$pon$e. plot(t,Y) xlabel(Time) ylabel(Y) 6ig&re J $ho#$ %he re$&l%ing plo%. 4nce a ne# $im&la%ion i$ performed, S*M+!*,- #ill #ri%e ne# 'al&e$ %o t and Y. o a'oid lo$ing %he old 'al&e$, %ype t1=t; Y1=Y; %o define %he ne# 'ariable$ t1 and Y1.

G.

*igure !. +ni% $e%(poin% re$pon$e for * AE (di$%&rbance) $e%%ing$. H. ,o# $im&la%e %he &ni% di$%&rbance re$pon$e. :o&ble(clic1 on 8 $p and $e% 6inal 'al&e %o 0. :o&ble(clic1 on : and $e% 6inal 'al&e %o 7. Again, $elec% Start from %he Simulation %o begin %he $im&la%ion. ype plot(t,Y)%o 'ie# %he re$pon$e. 6ig&re 70 $ho#$ %he re$&l%ing plo%.

*igure +0, +ni% di$%&rbance re$pon$e for * AE (di$%&rbance) "efore $%ar%ing ano%her $im&la%ion, %ype t2=t; Y2=Y; I. ,o# $im&la%e %he &ni% di$%&rbance re$pon$e for * AE ($e%(poin%) by en%ering %he $e%(poin% con%roller $e%%ing$ in%o %he .*: con%roller bloc1 and $im&la%ing. ype t3 = t; Y3 = Y; af%er %he $im&la%ion ha$ ended. ,e/% $im&la%e %he &ni% $e%(poin% re$pon$e for * AE ($e%(poin%) by $e%%ing 6inal 'al&e %o 0 in : and 6inal 'al&e %o 7 in 8$p and $im&la%ing. o reprod&ce 6ig&re 0.9 of %he %e/%boo1, en%er %he follo#ing $e% of command$ a% %he MA !A" promp%: subplot(211) plot(t1, Y1,-, t, Y, --) xlabel(Time) ylabel(Y) subplot(212) plot(t2, Y2, -, t3, Y3, --) xlabel(Time) ylabel(Y) he subplot(mnp) command brea1$ %he 6ig&re #indo# in%o an m(by(n ma%ri/ of $mall rec%ang&lar pane$ and ma1e$ %he p(%h pane ac%i'e. he plot command follo#ing subplot #ill place %he plo% in %he ac%i'e pane. o learn more, %ype help subplot. he plot(x1, y1, linetype1, x2, y2, linetype2, ...) command plo%$ x1 '$. y1 #i%h linetype1, x2 '$. y2 #i%h linetype2 and, $o on, on %he $ame plo%. o learn more, %ype help

J. 70.

plot. 6or %he $e% of command$ li$%ed abo'e, 6ig&re 77 $ho#$ %he re$&l%ing MA !A" 6ig&re #indo#.

*igure ++, 0ompari$on of .*: con%roller$ #i%h * AE $e%%ing$ for S4. : model. Solid line M * AE (di$%&rbance)L :a$hed line M * AE ($e%(poin%) Adding %he legend for each c&r'e can be %edio&$. #o command$, #hich can be &$ed %o genera%e a legend, are %e/% and g%e/%. *f yo& are mo%i'a%ed, %ype help text and help gtext %o learn ho#.

70

S-ar putea să vă placă și