Вы находитесь на странице: 1из 7

| Ma tl a b | | Co n tr o l S ys te m s Ap p l i ca ti o n s | | S ym b o l i c Ca l cu l a ti o n | | S i d e No te s | | Ab o u t th i s s i te |

Int roduct ion

Sim ulink (Sim ulatio n and Link ) is an extensio n o f MATLAB by Mathwo rks Inc. It wo rks with MATLAB to o ffer mo deling, simulatio n, and analysis o f dynamical systems under a graphical user interface (GUI) enviro nment. The co nstructio n o f a mo del is simplified with click-and-drag mo use o peratio ns. Simulink includes a co mprehensive blo ck library o f to o lbo xes fo r bo th linear and no nlinear analyses. Mo dels are hierarchical, which allo w using bo th to p-do wn and bo tto m-up appro aches. As Simulink is an integral part o f MATLAB, it is easy to switch back and fo rth during the analysis pro cess and thus, the user may take full advantage o f features o ffered in bo th enviro nments. This tuto rial presents the basic features o f Simulink and is fo cused o n co ntro l systems as it has been written fo r students in my co ntro l systems co urse. This tuto rial has been written fo r Simulink v.5 and v.6 .
Ge t t ing St art e d

> M E N U >

To start a Simulink sessio n, yo u'd need to bring up Matlab pro gram first. Fro m Matlab co mmand windo w, enter: >> sim ulink Alternately, yo u may click o n the Simulink ico n lo cated o n the to o lbar as sho wn:

Simulink's library bro wser windo w like o ne sho wn belo w will po p up presenting the blo ck set fo r mo del co nstructio n.

PDFmyURL.com

To see the co ntent o f the blo ckset, click o n the "+" sign at the beginning o f each to o lbo x. To start a mo del click o n the NEW FILE ICON as sho wn in the screensho t abo ve. Alternately, yo u may use keystro kes CT RL+N. A new windo w will appear o n the screen. Yo u will be co nstructing yo ur mo del in this windo w. Also in this windo w the co nstructed mo del is simulated. A screensho t o f a typical wo rking (mo del) windo w is sho wn belo w:

PDFmyURL.com

To beco me familiarized with the structure and the enviro nment o f Simulink, yo u are enco uraged to explo re the to o lbo xes and scan their co ntents. Yo u may no t kno w what they are all abo ut at first, but perhaps yo u co uld catch o n the o rganisatio n o f these to o lbo xes acco rding to their catego ries. Fo r instance, yo u may see that the Co ntro l System to o lbo x co nsists o f the Linear Time Invariant (LTI) system library and the MATLAB functio ns can be fo und under Functio n and Tables o f the Simulink main to o lbo x. A go o d way to learn Simulink (o r any co mputer pro gram in general) is to practice and explo re. Making mistakes is part o f the learning curve. So , fear no t yo u sho uld be! A simple mo del is used here to intro duce so me basic features o f Simulink. Please fo llo w the steps belo w to co nstruct a simple mo del. STEP 1: CREATING BLOCKS. Fro m BLOCK SET CATEGORIES sectio n o f the SIMULINK LIBRARY BROWSER windo w, click o n the "+" sign next to the Sim ulink gro up to expand the tree and select (click o n) So urce s.

PDFmyURL.com

A set o f blo cks will appear in the BLOCKSET gro up. Click o n the Sine Wave blo ck and drag it to the wo rkspace windo w (also kno wn as mo del windo w).

No w yo u have established a so urce o f yo ur mo del. NOTE: It is advisable that yo u save yo ur mo del at so me po int early o n so that if yo ur PC crashes yo u wo uldn't lo o se to o much time reco nstructing yo ur mo del. This is amo ng the reaso ns why I prefer Linux o r Unix! I am go ing to save this mo del under the filename: "simexample1". To save a mo del, yo u may click o n the flo ppy diskette ico n . or fro m FILE menu, select Save o r using keystro kes CTRL+S. All Simulink mo del file will have an extensio n ". m dl". Simulink reco gnises file with .mdl extensio n as a simulatio n mo del (similar to ho w MATLAB reco gnises files with the extensio n .m as an MFile).
PDFmyURL.com

Co ntinue to build yo ur mo del by adding mo re co mpo nents (o r blo cks) to yo ur mo del windo w. We'll co ntinue to add a Sco pe fro m Sinks library, an Int e grat o r blo ck fro m Co nt inuo us library, and a Mux blo ck fro m Signal Ro ut ing library. NOTE: If yo u wish to lo cate a blo ck kno wing its name, yo u may enter the name in the SEARCH WINDOW (at Find pro mpt) and Simulink will bring up the specified blo ck. To mo ve the blo cks aro und, simply click o n it and drag it to a desired lo catio n. Once yo u've dragged o ver all necessary blo cks, the wo rkspace windo w sho uld co nsist o f the fo llo wing co mpo nents:

Yo u may remo ve (delete) a blo ck by simply clicking o n it o nce to turn o n the "select mo de" (with fo ur co rner bo xes) and use the DEL key o r keys co mbinatio n CTRL-X. STEP 2: MAKING CONNECTIONS To establish co nnectio ns between the blo cks, mo ve the curso r to the o utput po rt represented by ">" sign o n the blo ck. Once placed at a po rt, the curso r will turn into a cro ss "+" enabling yo u to make co nnectio n between blo cks. To make a co nnectio n: left-click while ho lding do wn the co ntro l key (o n yo ur keybo ard) and drag fro m so urce po rt to a destinatio n po rt. The co nnected mo del is sho wn belo w.

PDFmyURL.com

A sine signal is generated by the Sine Wave blo ck (a so urce) and is displayed by the sco pe. The integrated sine signal is sent to sco pe fo r display alo ng with the o riginal signal fro m the so urce via the Mux, who se functio n is to mutiplex signals in fo rm o f scalar, vecto r, o r matrix into a bus. STEP 3: RUNNING SIMULATION Yo u no w may run the simulatio n o f the simple system abo ve by clicking o n the play butto n CTRL+T, o r cho o se Start submenu (under Simulatio n menu). Do uble click o n the Sco pe blo ck to display o f the sco pe. . Alternately, yo u may use keystro kes

To view/edit the parameters, simply do uble click o n the blo ck o f interest. Handling o f Blo cks and Line s The table belo w describes the actio ns and the co rrespo nding keystro kes o r mo use o peratio ns (Windo ws versio ns). Actio ns Co pying a blo ck fro m a library Keysto kes o r Mo use Actio ns Drag the blo ck to the mo del windo w with the left butto n o n the mo use OR use select the COPY and PASTE fro m EDIT menu.

Duplicating blo cks in a mo del Ho ld do wn the CTRL key and select the blo ck with the left mo use drag the blo ck to a new lo catio n. Display blo ck's parameters Flip a blo ck Ro tate a blo ck (clo ckwise 9 0
PDFmyURL.com

Do uble click o n the blo ck CTRL-F

Ro tate a blo ck (clo ckwise 9 0 deg @ each keystro ke) Changing blo cks' names Disco nnecting a blo ck Drawing a diago nal line Dividing a line

CTRL-R Click o n blo ck's label and po sitio n the curso r to desired place. ho ld do wn the SHIFT key and drag the blo ck to a new lo catio n ho ld do wn the SHIFT key while dragging the mo use with the left butto n mo ve the curso r to the line to where yo u want to create the vertex and use the left butto n o n the mo use to drag the line while ho lding do wn the SHIFT key

Anno t at io ns To add an anno tatio n to yo ur mo del, place the curso r at an uno ccupied area in yo ur mo del windo w and do uble click (left butto n). A small rectangular area will appear with a curso r pro mpting fo r yo ur input. To delete an anno tatio n, ho ld do wn the SHIFT key while selecting the anno tatio n, then press the DELETE o r BACKSPACE key. Yo u may also change fo nt type and co lo ur fro m FORMAT menu. Make sure that the blo ck is selected befo re making the change.

______________________________________________________

T. Ng uye n MMIII, MMIV, MMV. All rig hts re s e rve d . Us e rs may no t d o wnlo ad and p rint e xtrac ts o f c o nte nt fro m this we b s ite witho ut writte n p e rmis s io n fro m the autho r. Re p ub lic atio n o r re d is trib utio n o f the c o nte nt in this s ite , inc lud ing b y framing o r s imilar me ans , is e xp re s s ly p ro hib ite d witho ut the p rio r writte n c o ns e nt o f the autho r.

PDFmyURL.com

Вам также может понравиться