Sei sulla pagina 1di 184
INTRODUCTION TO PHYSICAL MODELING THE KLUWER INTERNATIONAL SERIES IN ENGINEERING AND COMPUTER SCIENCE Oe EERE rome %* awit fr Nh Cet nd Sh Amer ‘ene Gu wae Brom atic aut ome sae BG ce capes brary o Congres Ctaeging im Paitin Ds ‘ier, Mit. mdi yl ming wih dee Mc Th site ingame 1 01925-7367. pape) Scene mt Compt) Tl, (ar69.c6s 7352001 ousssistaal opyig © 200 by Kier Andie Pb Seon Ping 2004 ya stare Cyan AB ‘Sila aod Ter svar aes OMe Mier Seta re apf a ie ro aid Leet or wns pms ps Nee Primed on te pp, Prine ae itd Seo Ameren Contents Lista gues sto bles Prete Acknowiedgemens aa tt 2 3 i is M6 The Modes Language INTRODUCTION White Mol? ‘What can Models te wed for ‘Modeling formate Moses Str ary ase voila ‘Sema, 2 DIFFERENTIAL EQUATIONS u 2a 2B 2 25 26 3 3a 33 1 35 36 Concepts Dir eqations Pyle pee Documeting mics Langage fdas Probie BUILDING AND CONNECTING COMPONENTS ‘Cones Conese ‘renting connect Sd components Defi bck ising rutin components Language funerals SREESES SELESSS GSSSaun 20 Summary [ENABLING REUSE 41. Concepis 42. Bapletiagcomionity 43. Resale bulla Boks ‘G4 Allowing repacenle components 43. Other reacts ener $6 Lining Restay {7 Other enone ‘LS Langue andes 49 Probleme FUNCTIONS SConcepte 52. nrodtion tine 53 Anlerplao fanton 54 Multiple tam vee 53. Pasing records apa 56 Using era ebro: 557 Language fndamenals 38 Problems USING ARRAYS ‘a1 Conor 162. Planetary motion: Aaye of onpaits 63. Simple ID hea ander Anas farbles 4 Using nays wih chemical systems 65 Languae funerals 66 Probleme vBRID MODELS Concept 12 Mosel gia! i 13, Bouncing ba 1 Sener modeling 75. Language undastale 25 Problems EXPLORING NONLINEAR BEHAVIOR 81 Cones 82 nies! de 83. Backlat 84. Thermal properties Ho 1 12 155 135 te 166 8 186 199 9 199 19 ms 1S Hodge Haley nerve cell adele 6 Language tindimenals 7 Problems 9 MISCELLANEOUS 92 Atmotaions Put ffecsive Madetcn 1OMULT-DOMAIN MODELING 1 Concept 102 Comeyer ssc 103 sien etn ste 104 Astomotve iary 106 Probes 11 BLOCK DIAGRAMS VS, ACAUSAL MODELING HL Objective 112 Block aga 13 Acasa appro 14 Summary 115 Problems 12 BUILDING LIBRARIES 121 Objective 123 Chsenicn 123 Stare 125 Documentation 125 Maximiing es 126 Moximiin robnest 127 Storage of Madea source cade 128 Celene 13 INITIAL CONDITIONS 133 Using atts 14 Sco lation 135 Inalioton bed on asia pe 136 Canlesoe 41 Objective 20 0s 210 218. 2 2B Bs 233 a 5 28 Fr 2S 266 m m 7 m9 ca 25 20 26 vil INraobUCTION To PHSICAL MODSLNG WrTH MODELICA 142 Us equons 163 Avoid umecesny vets 18 Time eles 145 Proving oan for fonctions 14.6 Choosing te proper inegration oto: 147 Telenoes 149 Concasion Appendices 2A Hatory of Modetin [Ad Contos othe Modes angaage ‘$2. Conus othe Mods Str Library - Modeia Syne (C- Model Standort Ltary: Connectors Cx Elec Calg) (C2 Block diagrams C3 Trndatioa matic C4 Ratton maton _D- Moselic Stnad Liar: Common Unis Du Timeand pace 2. Rete phenomenos D3 Meshanie ag Thermodynamics DS Hleareiy Dé Physcalchemisey - Modeien Standard Libary Coste F. Mle Standard Library: Math Fnctions 2. lnvene geomet functions 2. Hyperbole geomet fnctions Et Exponenalfancons esr References Index ho am. ats ats 36 3 is = a ey x1 List of Figures 2 3 a 0 3 a5 26 2 3 ha 36 2 3 si “Tibia ok a wats uater be ood ooking inside the eine Sexton rena rma sole Pr cone LC cet echo, ‘simple penta Sotton fr @() gen E22) = 0. a (0) = 0. near and toner soon for (ven Z=2, (0) = 2 anda) =O, otage espn of adel ie ‘Twohaie unk file with iu Solon with nil condone 200 and? ‘Avice ody diagram” ofa Resteeoe Schema fr Rc mode Example 38 Pomel wt plan Contoleytem mode sng component rim Mode. Asigle postin 5) ‘Aseria ems ‘hedagam view af Prconerotlex Picontrat ier malin : Prconteolderananotor nadeL Sie ty ie compan of contol. Schema fr Example 410. ‘Outer snug Test Piccewie fr 1 sean- 2 ie » a a 6 ° 6 n a a 36 33 é 62 ea & 6 6s 69 610 a 7a a 15 1 9 am a a a 8s ko w s9 ‘Simulion res fer Tost Completa. ‘Simulon results fr Tost conplentave2 Seren oes nly arate by grin oes Sinaaing the mse fhe Ea nd the Moon for ‘gposinatly yen "Heat vanterins one-dimensional | Sohemat for Conduct snd madelin Exanpl 8 Solon fr Hobe! mse ia Example 61, Schemalctor Conduct inghodiiehconvest ion, shown Example 7 Saon ret fr Ht cn2 mol sown in Eaanple 8. : [Comparison sey stat oon to tProben. ‘Vismlizatie of be Oresontor ection. Ono response from the Oregoater cn Diagram for toguccaeuse model in Example 4, (up silsfom Logsecireus® mol sown in Baample 74. Diogamferiogices rout uibagimalchows intsample 76 Gere tenttnaiovecccititane | pu sigs rom togiecirouseNsentag.e = Behav ade Bouncingben 12 (ur seor bent sysem, Pefoanc fo (10) anhigh ht) gla om tele with ea sense. Compares of SampLeti deen wih el ase (Comarca of Quant sedsenvcr with eal ene, (Conpurson af Perodsensor wie cae [Comparison af Count snasenaor wth ia ee, ‘Geto mode! inet day. ‘Cameras charter til de (Camere characteris of el de pled panera ‘Schematic ofa» ACIDC power pl. Volpe sponse of ACIDC power spy Force dopcement characteris fos aca, Becks schematic With wo ei. ‘Baekin schemate with de ie, [Comparison af he wo bach me fo th eased shown i aes 8. and 87. Plot atu) fom Eqanon (29) 100 9 rt 6 Ps 90 Br be se tet ‘61 i 6 i m3 5 vs 19 a 92 196 196 1% 10 a an 8 92 93 oa ox 03 04 tos 107 ros 10 io 112 tous tous ro16 tos 13 ma te Fes ‘Temperate deibetons in S015 tying foe ie an one property moses Nerve cll sepnent them Dynami respons ofthe eve al. ‘Creag carers ofa il Zee dds ‘Simple page era ‘hace fp ia Example. Schema for penis sto DDymnla tending of HTML documetaic for the ‘PeoTaniee mde shown i Exaile 9:5 Sehemate forthe omveyor st em Schema fr te eae rate Schemas forthe someyo otal Schema fr face, Comparison odes sant bhai Motor voage required ‘Setematie forth ouee od Sehemat forthe Paenace mode ‘Schemite fo the Hochantcai thermostat mods ‘Schema for he Digital Thermostat mode, ‘Schemas forthe Mermostat System motel, Indoor nd Outbor epee Packager est inside te inp Lea sk CCompenens of he Be page ooking inside sn nv eno der ooking imide 4 eter enn. j ‘simplistic ve ped etemion Content te Chnaeiepckage ‘reaing eile mods “Top ievel mode fer dynamin ing Gourde planetary ger wi one ace Plantar gear riven by th un sar Block gram of planetary gear system Piney gear ith tional moan Poste feanddresor arcu forth ansecy package. : Compare ieineen na-i o)ai btom) Comparison of inion ne ud sf ‘ema ger ans En 25 ais ay Po m Es au as 2s 29 List of Tables 1 SI 61 62 ‘Trough and sre ashes fro aris domain. sample ants ype Madea pes + Cpe, Modeica yes #8 FORTRAN? yes Buln feon fo arya Mota. Soir system daa. Dice bhava ai, 5 108 108 15 155 List of Examples Mode of simp endl, Mose of penui athou ie singin. Mode fora RLC crete yaa syten a tw ais model foray ccc esie ‘Rmodel fora etal expt: ‘itl fora cal ndctor 35, Atmel fra ata 3G. A made for lect pon 25 Antero uc RUC cca in ige 3. La REcocur wing MSL 39 single coud syste, : No Gort eas sien 5.12 A Blok lh ams wo semis. 313 An get block, 2314 tor ante din 215 A ote boc 36 compen ated coal jt nde fot Souinhgwest ns 2317 Commoerand mechani 2318 Onesdimesonl atonal coaneiae 1419 Rrcatona! podatn meet 320 A eel beang 321 A Spe pedal ea| 32 Aopen ih mail na 41" Bednng a common ste mas! for ooe pot exis 42 Modeerseaiacar ig odors 43 Sours code rib conser mode in Fig LL coat conrating smote 5 A gene contr ne Z 45 2 Beoperionl gin coal 15 Aisa proportions iret i cai nueeesuaaaaetessuEs 8 48 A gtem coining come and to, $5, Assman conc ng rdetoe ‘Ho Aneampe of how seca eval compooens Rope ma 1 A foto tings rane aay fee | 22 £2 eobte deine tanto ‘pecs einer ucton, $4, Evaluation ofa oar td is dine 55) Catena he Sum of see ne wanes 56 5M wrapper incon fora € soon 3y Rice cg Fon Ra sh fray preiena: 62 Bete commodo a ip by pens (sing vectors 63, Mode frat fy ine ineasiad pas ‘Minion to eset provisional oc. ee A grant merce mode Eneipstatng the rasta fos acta (Geng ary sysem ‘peg A, St gaa of aise tle Egan Conscr fr hea utes ‘Trea confucon Beal. ke type Soy ii, ‘red wih conc hes ‘Hearse in condcing rod wh Woy eos. ‘Atel of hems! omen jin spe ert tater problem ovis cocina eso ‘Acondcing rd wing he Thema iy ose of on anda Mode afr pte 73. Mode ofa gat 14 Made ofa cleus tet Ain or atic. 75 Mosetnglag in iia sa : 16 Ima ag orgs 12 RNontetent tonne 18 ee” boaning ba 19, ater “ite boeing ball “Ho Sete cl esrb yi ZL Metswement wl tation TE Ine enoting meassemen {E14 era cotng approach HY fa nee : ace sing baci sl 53 Cottle elk ode seseseeser Lin Exper ‘A general ermal propery mol ines, ‘Specie hema oper mots ‘sie lcs ‘Avod changing tom si tw ‘sing fancton o deosibes vi eld Sees er erherer sacteanta snort {ing acttons for docamenton a wing this book my goats to deena ho easy sf an fn the rodelng of phys eyes can ePrints snag Bt compat ‘ates for hat irmor iret han snag he tar of se ‘ystems Thee "seal sytem” fr fo te behave of ysis sed ‘ols found arse may dcpies (eg, elect engineering mechanical ‘inerng, emis. phys). Sich systems can be ented by et we ‘Steamenaon proces (eg, nt bw of armodsmamis and eonsetrain| ‘tia Tis book wil dsb how the Mal modeling Isevge eas be ed to dese the ehion of py syteme Models ca bs wsed Tot ‘sige rae of spation fom snl stm with cal few depres of feed ate wy up o comple tema of lage networks resale ‘component, “Theft pat of he book i focused on rsicing header tothe Mos ice mode language. Te net nience ou be some with an ners of ti pyses an ales, an Ie noting 2nd m0 noulogeof Molen ‘Theft ita cover al he sof engage ‘ng simple examples and eae he ede bein sing mcd aM ich later fn he ips of the bok sats wth an overview ofthe lngoant conceit ner ladies. Whenever ane termis inode {tl sper alsd an sino fr wil be ned inthe sian. ‘The overow i thn flowed by a srs of exanpies mea 10 raually ince Moles fanconity el a xamples fan importa par the leaning proces. Thave ied 0 aad sing comsved examples. a ft, ‘any ofthe eames come from rea werd problems have ensured. The “Stiony with examples that hy o ot inde mute ha ste ay, bat ater owing” way- Fortean, ay chaps ince {Language Fendanemal seston which temps forma a ft ‘INTRODUCTION PHYSICAL MODELING Wir MODELICA ooceps itedsca by te examples. Reales may el fe 1 skip ove te nec inthe fandanetals secon it et confab wih he etre resented nth chapter, An mpotan oe bo te sate his Bok ot eeh example introduces new concept ner wr, Jo tase that Besse you unenoo he et example fn ptr ll te remain ‘examples ot woth tyig “The second pur ofthe Bok demonstrates how © mos ete we the poet fess of th Media Iangnge. Tis pt is itnded fer pope ‘to at lead nar wih he ts the Modes lngegefcudng ‘isting tse of Modela ad bears wha have comple th fist pa “Thisbook coves wal al ofthe ears ofthe Mosel languge: Hox cet much of the mtr oly rege In aancd spinon The “or mate equ o begin doing meaning! modeling ea be fund in Capers 1,23 and 7, Redes may wish o few the ateton on those ‘hapten it andten coos cher caper ah beome more prof ‘Reais hat ol pone to sntodas eer nanos ofthe Modes at uae tough examples. Once you ave covered the merlin is ook. ‘oa wil egies nite reference. The ukimate source of infra ‘out Mosel the angape pecieaion el. Forth avon Mode fe lagange peciaton nde onthe oation CD-ROM. We at Soper vig gs papa ee oe 1 surmy too ices material that wil have bro ppl a ssl serve oth egaers and experienced ues ying ge te mast ot of ‘ysl stem modem Acknowledgements 1 would ket tty thanking my pres who hase lays encore mycin. Tc tas mtd me tcughou ny een sen {underneath ening ad modeling Ina {wuld so ike ‘oahank my wife, Deepa Ramarao ber Supt ag ths poet ‘The mati inthis book bs beneGted grea} fom he poatFeatng and ‘ec sighs of ing Eimgei, Sven Bik Matson, Hane Otten Dec Ramaswamy, Mica! R Tile, Maria Oue, Deg Brick and Pa This Baki ult on he foundations of the Malin Inguage tl. As sack the mens x Mote Associaton signers te Mali an see sr Append A) dese the cet fo fouling ch a leg od foveal modting language T wool! so lie to tank Hing li, ‘Sven En Matson, Hans Olson and Dag Brick for tier work on he Dela Software sed ding he weg of istok nd forcntating sn evation py of Dye for incon with hs book ‘eaning isnot posible wit people wing toteach, won ie ota tte people have moked wih an ese fom over the yas for al ae lend om hm, hope atte mtr nhs bo inp he rear ‘ou inthe same wa ht th follovng peopl avec mine: Miche A Tiler Eunice Tiler Raimond Wal: Rote Fle, Aron Le Kin bal Anthony Varghese, Pr tema Kim Stelon, Nicholas Zar, Jon Danzig, Daniel Teroel, Jonshid Oastous, Thomas Kethoven, Chace [Tucker Raph Johnsen, Rober MeDava,Chack Newnan, Googe Davis, Willa Tbe, ting Eigen Marin Oter haved th opportuni. ove tes few ear 1 Werk with several very eight and vegetal on Mote related projet, Cleon Davis helped develo he nal Modeica models weds Flrd Meter Compa sien, 1 would Hk t thnk Huber Tomes othe any fon scusions wehave had on preacher thermodynamic modeling i Mods fe, Finaly, Pal Bowles wasmy costo on sever! apes tat were moa, he a gaprs to demoncnt he cli of he Molen sppoach HS enuf neal poet at Foe and subsequent abate o hat Sede een een othe ses. oul tcl by ping tal ofthe open sure Thave wed in ‘ne preortion ef iabook wuld eo siow my apresanen the there of Grace ag as, XEaaes, CVS, TKCVS, WiNCVS, Kai, Chote, ‘Ghosrpt TEX. IMEX, AvcTEX MIKTEX Lis, KDE an Gores ‘potted uf tl the sore ce ining of Modsica moss in is book ‘ete de wit te BX List ge package by Caten Hel. 1 THE MODELICA LANGUAGE Chapter 1 INTRODUCTION 11 WHAT IS MODELICA? Bef inthe eis of modsting wing Modi, et me provide a tee dseiion of what Medics i wy sta developed and what tase ‘Since the ime ofthe compute, madliag an simlton have ben 1m impoctat prt of comping. Intl, dees were brdened With com ‘ering ir tse no syne of onary dfs eae (ODE) {nd then wig code o inept those dlc equations in ore orn ‘inulin testa. a wide ange of negates were developed sind odes sofa uns nd modelers were sl fo fous on the fonmuaion of ‘Serial quo and we “fsbo shel instr for slo. Tis tea of allowing mses fos ore onthe Detar expos oh Folens ane onthe soon mete has cote eer ce the last tee decodes, numero ols have been developed 0 ass, odes in performing siuauons..Some ofthese wer gow perp sinlaion as sch ACSL!, xy, SystemBuild nd Simi Other {oo were developed fr sealaton io specie egowering dose sh lea cul (eg, Spe) malted systems (eg, ADAMS") oe ‘eral processes eg ASPEN Ph), Each ype of ol ais advantages 4 remopuctiw 70 PuSICAL MODELING Wirt MODELICA or example, general pupse tel do ae ret mses 10 apace onsis tat hey may roi the mor to spend sme time formulas ‘memes frat prio, Likewi, tone developed fora specie “ginsringdonin ve mumercal methods snd pl wer ince ‘hich are optima fr that pari domain ute ett th ayo te Unodlerto crete mined domain model In 197, Hig Est pioneer, as par of his PD. thesis, 2 new ppouh to odeting piel syems by designing and implementing te Dymola meting langunge (Elmgvst, 1978. The tse ea tind he Dy ‘moa modeling lngbage sto we general eqations, bts and connections {allow mode! developers fok at meting fom a pil perspective Instead ofa mateatieal ne For the Dyes mpementton, rap ‘ec ad seb alge were ered otal he del a8 prep form for meal savers An importa lesion ine eel ‘opment oF tis apoach caren 1988 wth he developmen of the Pals algorti or DAF index refocton (Panties, 1988), rolloning Dy, Immerou ae ot (eg. Ome, e Maton al, 1983) wee deep ‘ofarier explore thi sew approach to madeline 'Amajr problem whl Sula ols has been ht ods developed ing tne tbl col nt Be wed y anther In 1995, sng Els Ine an eo o ly the spiked lanseape of modeling nguages by ining the developmen ofthe Modelen modeling Tanna. Simla Itai ve teen uneralen by vais her groupe (ee Heal eta, 2300 and Fak and Miler, 109) ta thse elfen ve Ben Foes ‘rimary onthe eecteldoaaia, whe Modeicasvesf be completely “The tsi ies behind Malcn wt 1 rate a moseing ngage a oul express the behavior of mods rom a wide ange of elnino ‘mains wou mig thse mal toa pric commera to Tn ther ‘ord, Modeica beth modeing language a a mode exchange spec ‘eaten. To acempin is pol. he devsopers of prow jee eed ‘modeling languages ke Alm Dyiols, ME Object, Onel, SIDOPS* tnd She wee tought together wth expers om many engiering dois "ocr he spetontion forthe Model language sed oe thei wie ange sf eaperenes| Modes can wed to sue awry of poems tat can be expressed in ems of dfeeatalgeba eqoons (DAES describing the behavior of cstinaousvarales. Theat to formulae problems as DAES rahe than ODEs redo the buden on he moe developer beste fon atcion 5 ‘olen oroulating outs. In aitionohaingcominacas arable, Mosel inde ene for desing the Behave of dst vaitbles (eg ipl signal) Ofte, comeriet rete ec osm both ‘Saute nl cre teivor athe seine, Mode allows uth fom ft behavior to be desc wiin the sme system mavel or even the se ‘omponent oie Models rn popretay modeling guage ane mae a wade anak ofthe Modsics Acsociton wich i rapes fr pulstion of the Malis langage spect preset, Mela f ota 150, |ANSI o IEE sand This ans hat Mol reset "moving tage” in mach the same way at C+ as for aout ede Ia the ab (Ce viding he uo andare id mot pee peopl fo akg ie a be lnguge and limtly fd to « och tte language. Hope {aly Modeiea wl llow asia pth. If a ned ean be dense fo fucinaty not sreaty presen i the Modes Inns, ws cn ‘rst wth he Modsica Asan 6 fatctonlty gap The coment Mossi speciation canbe found atte Medea Aspen wa se heep://new.ode) tea, og Venn of he Mosshenmeieton ‘inesded onthe companion CD-ROM If you hv ever een involved in ge ale modeling poets you prob iy songz hat ede eelopeat i many ways sr re ele ‘oftware deeopmen. ist ike» programing Iangge the parse of 8 ‘Roding lng to escrb the avin of eal ces auger 9 tem A odeling langage sould encourage ese opens wrk ad hep ‘manage the complecy fst asthe became ge Ht sale ous fences eae of components hasbeen crete work a an isi) Tr lvl ce geting sty from ming unto a he component ve fc wring mare onthe ssely ofa complex sytem). Umar his [Esdetoth ty ld ystems ung op down” approche hn atone" apc ‘All snlton sls presented i thi book wore gerd using Dymo (Dyeumic Modeing Latotoy)” An evaluation copy of Dynal is po ‘ded by Dynan Elst tl, 200) onthe companion CD-ROM stat, ‘ears may pain haem expercace wih ing te Nodes gage. > “ucrtnd bow to stuse Modes mode sig Dy, ls red the Srcumentaton ed "Geng Stated with Dynal” which since i ‘he Dymo sofa, Dymo ca ao eed ogee moda can {poe no Sain enema 1.2. WHAT CAN MODELICA BE USED FOR? Modetia can te wed for many has, ining simlaton of eect cuits (Claus eta, 200), store powers (tera. 200, per “stem sable Lasen, 200), vlc yma (Tiler et 200) an jac stems (Beater, 200), Hower, ho et wat nda at Modes ante sed forts traph anexampe, Whe mot he chess ‘he book se reel sgl amples tosh pci langage ers, ‘te ill tt by ging hp of the ig pte” ne setion we wl show Bi ad peso # asta ary of Modeia modes fr snag stone performance. The Kary Was seveloped fr this bak to demons how eaonaly comple sem an te modeled. While he Kt cna lage numberof mls mst the model are quite simple. Beane these mde are lately spe ty wil give us oly a ough esate of how pra’ stone desis Wl Fecorm, The Models olf rcton ae provided ont sompaion {CD-ROM od cscsedin great eal e Caper 0. sports_car Powe 11, Abin peer, Imagine we with pedi the eelenton performance fer a pric sons en desig. nero judge the perforce, we wil mess he ine ‘Maks the velo acletefrom aero o one hued loses er ou pure LI shows our perfermance et which osaes soca se ‘Do otto fotedinothinking the model we ae simulting st eile ‘ec te pcre ok spe, Ts ja peel ew ofthe robe, gue 12 shows what wo fii if we ok side or spo cr ode, Behind the sey, he soca mel nce moss the chs neon | fd engio 5 well a sig ser ht dees when fo ange ge Behind lof tes images we bt mae (Le, the nage homes ‘et ed tel ie what he mel epee). As we sale ev {hs view of te spat car gies deeply mp imreson, “The engie mode fr carson carson of many component ia Figure 12. Use openap the eine mel we can cach the or nil eying (stownis gue 3). Agsn themager fengine cylinder me pape aed tothe odes so hey ca bey ete a engine cinders. Beh ech tf thee pistes ete scat of the open wed Y ode 8 Indndal npn tinder ewe ope up neo tee etn, efi the nner eel com poet mel shown a Figure 4. By moming io each the aio "del shown sof, we hate goe fom the complete vice lve (shows In Figure 1 al he way dow o mel of nda omponet oh | ‘signe ves (own in Figure). The abity contract ach erachiee is cna fee of Modes. Instn, be ity To alae ral representations fre modes ac we have sean hes gues, aso ate Pode by Modsiea. acho the gapis shown Figure [represen 8 component nove ‘ne fnetion of an indivi egine cinder We cant "Zoon no tee weg ene riod case they represent te smal pices inthe eye I some, ey are he “ons ef our system tis portant overstate peer ae not magical primitives ht jas happen come wits sftare Fackape we tid ob thi ode Io fc a hs component level {at we tm eu atetoe evay fom all te gaps toward tee sbjst sf is book the Mocca modeling lnguags. Previn, we have seen hw the Modeca meeting language cn be ed desi ices of mene. lthe nomic", ean so be sed cece he eve each ofthese conpnens. The reine ofthe book wll rove al he rece) inform obi sich componet ani an enormous ait of tthe componente engineering Soma Bulg models is fa, tu itl we wanto se ress fom uch mod. els When we rm oar selon we fn tat te spr a del peers inthis section can go fom zo to 100 knees er hori 688 sens gure 1 shows seer diferent peer of information recorded dng he {St Notee how he rarsmiason gar changes a diferent eel speed. We an lose ho the engine spe ineases up ul he tasision sit ‘then rope aun. Tes aretha finale een et fo tr snulston. Oe asl ce of infomation value ide mild Pressure rapped mas in the etn, actin fre onthe ies, eansison hte esses Studying such sformation can provide importa nih ‘ng edn proces ‘Once ne havea mse! ha ies good esl, he neal tp 10 sak ous "wha I The pos ein oe ace ol inca mers Pie eka nia enn desig etal, Fo example, we an ey spi he engite sews valve ‘mig, itched thie weigh ie adi ands on. Banging these Vals we en detemine he pac enh of these parame has on veal ‘sem performance Remener, Model ie & domo-tral mdeing langage ws for eating noel fom nety any eagineting domain. ‘The render of he ‘rok shore how mole rom min ter enpnerng Soran cane eed ‘tng the Madan modeling ngage, 10 wrmopucrow 70 unsicAL MODELING wr MoDELICA i is = lhe Fone Saori tons gr 13 MODELING FORMALISMS Before we sam dicusing ho to ase Modelo develop meses, les take a moment ro alk about modcting in genera. Thee re many foals ‘sed for modeling continous systems An excell overview of fee ermal resented Ast tl, 188, Mate sport of te emmon spencer 0 mel In engnering "The Si cal lok Stnprm oieing sn he ber scale cca ting In bisection tne wil disease Hock grams an ctl formate 0 ee andersand the diterences between hem 134 Block diagrams ‘Using lek dagrams, system is deed ie terms of gute: at se Enon and qe: at are unknown. A block dagram const of ‘Simposents call Bock, which bet kon guns compe the ‘known quan. block sara of Proportional cotaler iSshown in Figure L es et meg ect elf ig (n te Ie side of Figure 1.6 are he known gues he deed speed atl (Be act motor speed ad he eed ese). One ah sie of Fig, the exque aod fo contol he sya scone inbetween athe ois whieh dsr thecomputins Ding eto In this example, the difeece bck taketh Scie wed sad sped ‘nip neopets at an op th iercce (ete er. Ove 3 ‘lock then kp the apt iference y thea, Ky The eld spd ifreoce pasted trogh anther pin Bek scl Wy an inegr We compat be enrol ogo by sig thee ie gin rhs “This arose modeling ir oten wd when desing cnt! tyes Fer example, too cha SiuliakanéSytemBulé wets apne. A boc agra sa stra way fexesung cota system dian Home, ‘uch lags ave te mitons we sl deena Caper 1 132 Acausal modeling Desciing stem or compose! beanie tr of conser awe is mfered to abacus! mang With aval orl the Ie 20 ‘lc specication of soem np sl caput. Ite the nae ‘waton of components (2g. O's a Tra resister) a combined ‘onteroio equations to deemine te ove yet feats tobe {clved.Forexampe, when malng eecrical sytem ie he cu shows InFigure 17.one an use Kia care le (a conse nw), | Sts ht the sum fhe eareat fo acl ade tien, Bo ‘} mt te 26. Toe applica of comer lame eit er. 3 12 merRopucTON To pinsicaL MODELING We MODELICA systems of eentaalgebee eguatons (DAES. Dymola and Saber re ‘wo examples of tos tat low scr! ormlsions A : | rc owe Uc dete 1m oder to ferme acts! del, is wel © ent te vow vorlbies wo the acm vals fr ibe component Being tole In ener the arnt trl represent the diving foci the 5st ahd ‘Re rough varie repens he Now of Some cased unity. For an ‘otal th velge he actos sasiahe andthe carent the eg Savin Note hat he prot fhe hough vache ad th ats arable "ypeally has he unis of power ce, Wats Sa), Table 1 suds Seve examples of tough and acess varies for diferent engineering ‘min Ts a Hae par | ote ana ie ne domi 1.33. Farther remarks on formalisms ‘A we shal demons in Chapter, blk diagrams ae comenlet for ‘oto stm modtng ed acu maltose coment for pgs Tannen vodaion 13 sem modeling (ey plant moving). Na oly dos Modeca supper bth hse import type of dling, bt allows Both of bem Be aed Tope 14 MODELICA STANDARD LIBRARY in adton to defining the speciation for the Modelica Ingugs, the Mods Asvaciton so publishes sandal May of Modes model. ‘This slo the Medea Sand Library or MSL) i arabe ie ochre The MSL. was dvlopd so tht wie of the Medel language weald hve to ceat tern bse models for common modeing domains. ‘Throughout ook, we stato ty deelping Modes del ro sch ‘o demonstrate te finden of te language. Then, ep ou sar ‘mole hh lend exit wn the MSL ni wa, cn cover ngage ‘inden ad dels sre he MSL "Kopi that the MS ot alto of lack bor mel which re tured nota. Instead, he Nats representation o al te mel (Site viewed to bop ods xa what bari modeled, Thee ‘modes ar no ire than ay er Males models shoal be aud the wtle ie models coined the MSL-ae wef you ae not eed se them ‘Whe ding it bok, eco he lok fr ue of be MSL. Tes an ‘cay sngnzedty nding formes tt besin with "Moda icn”- All ‘ichetlestelong the MSL. Forex be pil ype fede} ica Srunite,Yoleaget dined ia the MSL, You sho inept is mae trean “Voltage iste dtd nthe STunsee package read inside the ‘Model ca porags" The package saci of Medel vais ining {he MSL) erica may contin umeros ested packages. DO te suite occ mach longer ames ie 1S BASIC VOCABULARY "The Modeclangagespcieon sari estuary fo descbing te elect the Mode linguage. Whe being igs cesar ina formal section, int alee god in earsing marl, Fr his ease ‘ebook wera simpli veal Tn tbeemalnng chaps be following tee 6 vmmopucrion 70 pinsicaL MopEuNG Wt MODEL rndel Aodel ia tehwvioral deen. Fr example, med ofa esto ts dst ty Ohara, The mde sa dept of esse bario, ihe esto ise. note weds, tis importnt separ thee of ‘eis mol he, V = Te Ry fom the rsitontances component ih ‘ier values of eine) you re falar WI oj ened opening 8 model analogous 10 cls component A ciapoaet is an sae of 4 model So, fr seen motel Te arevtr moe, eae nance fe. theese) ol be subcomponent A sabcomponet i wed over component which ae enti within eer component, ec example, eit mig beau ersponent of ater component ike an etic: Patbemore tb ‘lea crit euldteasatcompenet af as pane. Sibecmponens ‘ewe wor becca ode, ‘ystom model syste model sa mode hich completely sl coi nee word ites ot hve exer ean di cnas the sie punter of een aun. any Agu fet to hse ens which havea ae (ey the Teisince of ess). In Model al values are ether sal ge ‘Sing or ocean. Frere «any nigh be a sear or an ay enon ‘The descrsin ofl vals, pramees and euton soc sed with ml cle the oe! defaiton. ectaraton Woena component ramet, varibleoeconsot sista “ihe in spt moe ede aber compen), ht sealed ‘ele, ackage A pacage refer to a clacton of Modes mal which are ‘meat bese ageter: Foresman let package weld key Inclode ditions fess capactor and into ae, eyword A keyed es won, sch at mode, at ha specie meaning Ta Modeice. Arsen, keyword re srved words ad can be wed 'Smamesin declan (ee uals) Inthe examples, he keywords wl apes int ‘Use the explanations ofthese term a fren o Dl derstand the oe compe explains ind ook Te osary, which stron Pe 52 inl hs lems abd many move taeda bonk omission 15 1.6 SUMMARY 1 summay the Modelca language 4 om groper, dma-neia modeling lngusge at suport several eet mong formalisms Mod ‘es can teed fo model bth cotiauns ad dace ter and fxeaste mu domain Ray of odes kaon a the Mobs Sadi Lior is aval reeof charge at heep/ wwe ea. 079. Chapter 2 DIFFERENTIAL EQUATIONS 21 CONCEPTS Moca s+ powefllanguage fr descing the Behar of dyamic systems Atte bet fay dl re mathemati equations. We bein xr cum of Molen by thong bom simple sytem of diferent eae tisconbcexpresed using Modsica. The expression fiesta equations isin ct banc example of Model's ches, Sbseques chaps will te tcesingy soles mls wo demons ow me vanced ates tetp mode deed psc yt manage ste compe ed Pome in he chapter, we wil demonsnte how to waite some simple models ‘hic ce rameter contour viable nd eutens. These expt Should prove enough infermation to alow eae f begin creating bei ‘oe simple made Remember that each of the examples ntreduces em “oncept. The fil sion of i choper eve scompebense review of ‘helangage fetes cree ints chee 22. DIFFERENTIAL EQUATIONS 22.1 Equations of mation Let conser the mai ped ike he ne sow in Fg 2. roan ler cod ln we know th the om of he logos abut a xed Poin mst be eq oro. Thae are vo qs api atthe pot poi in Pigue 2: my = mgt sn) en n= mi 2) ZZ Pe 2. Ase pao vere 0 the angular poston late to gv, Zee lng of the eodulun es he mas fhe ena, 9 the acleton deo Eah | Davie xg dst ryan sheet true, Using be tha te sum oe trae bout the pl po, nt Be re, He ge ° ey tyr. mal if) “whch we cn ur edse 0 fe) =~ sino) eo inal ene sipliog assumption we can make, o he tie being sume that # sama wie enn can proximate sn) a. ‘hse on diferent equation comes mpi = —Z0e 2 {Lerusranforn Eqpaton (25) int sytem et-ne cia cerena (2)-(4) = herewith angular velstyof the pend. Given int ses ors and Seine eae negra hn ee of ean Dirt Eeaions 19 ap Moet asnge pdt 222 Modelien model "ample 2.1 shows hw’ can fe Mott eres he eho the endo in igre 21, Westby sing the yer! followed | ‘tehame of ow model, StzplePendulum Nek, we dee he parte ‘eons tha characte cur ode a ella he ales whi pest |noareqsions. The prance se qunr nich rein conta ng Silo tat may have feet vals fe one snus ate (es, 1) The ashes na roem eto quiies wich are auton ane (eg, 0 md) Las, constans se tose quant, ke the scleton 'ogoviy which rule to change. To comple the mv an equat on ‘eeon sree which ples the equtns sown a Egon 2.9 "Nott he prametr quant in Expo 2. have the paraneter ‘eywor in fon of tea. Likewise, coetans ae eid by the oe of ‘Geecenstantkaywor. Sins the delatons of omega std thot te ot ‘gulf by parameter or consent, hey ae asap ot varies AL ‘he quantes we he dscbed ar of ype Roa shih mens ie re ea ‘ters oppoced toiteges for expe) Exanineg the equation moe sony, we ase hat Mods neues 8 bain opertr called ax wich i wed to epee the ine det ffs varible Example 21 desnbes a complete set of frond ednary ‘afeatialequions wih wo oqaon and wo unknowns, Figare22 sow tbe silted salutes of Example 2. "Now le scone he ation hat # ~ sin(@). I we apt seeing» wide range of motion fer ur pedal, we wos ete fllowng Tener sytem of diferent quo (2) =(-sinw ) ‘ape 2:2 shows tat ont asl changes ose Malis md ‘Apr from changing te toda name the oly oer ching ef oe the en 20 aTRODUCTIOW TO PHYSICAL MODELING WH MoDELICA ge 22 Soot he 22.40) = 4) = Hode1 ica. sath infu, we weet plot hier nd none ods fo sal dspace (ch shown in Fig 22,00 woul nt xpos o beable to sc teiferece. Howerey Figue 23 demos ‘ht forge dsplcesents here ia igaiieat dlleence tween hese ‘ow? Moda pain wou ar mn ‘This snle example provide a good famewerk to demonstrate the basic ‘eater of Moca. ge 2 enon nse) Lt 0)» 2.) 23. PHYSICAL TYPES isi modeling inoles specifying enti Retween vais gat tier sch a vge, pres mas, Model ices eres which low so sper sal ype (eg, vlge pesos, mas) and ase ‘hem wih ques none model. To demonste how ths done, wil ails model of a RLC eles cei An RLC cuit oni eso, ‘pwc and indir ad ents nin bien eps 0 ole 22 INTRODUCTION TO PHYSICAL MODELING Wr MODELICA 23.1 Constitutive equations gue 24 shows the schematic of a8 RLC cit. Before we we oar Modein model of i stm, meat Sa ite de Ee equations for tach the compooen’ ne ssem. Une ie pevios example ee lesan of he fueanetlexitons. Ps leu astune tha he volage our, Vamps fom 0 Volto 1 Wok afer ene scond of sialon We et ten wie an exp expaion fr The olga node flows 0: oster 1:43 Now, me conser the intact model The equation forte caret hgh tention rom ode ao me ae a Liew using Ohm's whe cuentthough he sso rm ode bo ode ean be expressed % ww) Rin WoM nly. became trough apc ving age ca eng grand canbe expesed a= a, ten ot ‘By ung Kies caret le, We Anow fa the of the cae gong tec node mat be 0 Thi pew w-u =o ew tain 29) ae a0) tig tsa gute we ve the following enkowas ica the lloning tions % ew ier! Eaton 23 oo aug Ht en Rie ey te ew iy ey tmin 219) inmic am [Nowe it we cult ave smpied thse eanton farther. For expe, ‘om Equnins (215}(217) weno a be curet heap al th op ‘nes mst be equal iy. This woul have elite he ne sl foe Seto ani slopes Forts example, we weal seven eqns a a Se unos to dementia prior! manipulation of he eto ‘ocrcesay. nse he ifrmation gen inte mode suet or su ‘mnipulation ob ford stamina by he sinalator 232 Modelica model ipo? Mod rma ao “TheModslea escpionofthe RLC deli shown in Exsnle 23a te reels smug hic can be son Fgue 2, The mode shown Vea Pere25. eng nmn omet xanple 23 coves eer ne topic sen athe previous example. The fs tferac isthe perce of psc pes Le, Voleage, Sean Resistance, Capacieance a Inductance). At we salle aes, "hee pyc types provide inert iforsation snot he guise ae scl wih (eg uie is and deans). These psi yes are ened in «package called Nadel ea. sunt, Thist why te ysl ‘opeall conan Node lon, stunk intima Tm the equation ston, we see he tue of te Sf heyword. The se of intact called anseexpeion” orbs etample when ee Isles han 1 Ve = O and nce ine see thn I, Vg = 1. The variable me is se epreseat simulation 24 DOCUMENTING MODELS 1 hie sein, we crete a model of» hyatie system and show bow to include documentos i tds, Such doamematon wot ely Begs ‘he mol develope tember bow the mode! fencing he Diora Eautons 25 veloped any ne aber of the molto wndntand exacly what ech of ‘be componces and uamies preset Figure 2.6 shou the schematic fora hyde sytem composed of 180 tanks connected by nea pipe, Foes example, me asume that te ‘aint nk incompressible andes tank ascot ernest 24.1 Constitutive equations ‘The fist sep in compatng the ow, Q dvoug he pp soko he rei he bottom of ech tank. To determine he press we ee folowing equation: Peal whee is the presse, 6 the Bight ofthe fl in the nk, 9 te Seceleton eo Bvity ad te deny ofthe id. Using tis ‘sont, he pene a eto tanks we deter teflon quan P= patty a1 Pe = pals a1) Now hat we now he peste, we ned compte he ole ow e ,tough he pipe, Fer mina ow though» ideale, We ca (Sethe Hager-Poseieelasonsip ame Opla, 97 ani - dt where Phe pres in he nk on tee, Pte pes ean ‘om tbe igh D isthe ameter fhe pipe onset th two aks isthe 26 IvtRoUCTION To PHYSICAL MODELING WH MODELICA yumi iscsi an ithe lng of ep. Noth the sin comneaton forQ ist a postive lve iets Now rm ha el th ak ner Lely, need an equation wich eles the ome fom te tah the pps wih change nl eight in enc nk. Sine the fd Romine exer ean scones te vue of fd owing ough he Fige must ete tame a volume of ld ecnged with ees Te ebevior an be exprased byte ollowing unions -@ zy aio a2 thew Ai the comecionl aes of he tno he eft Ae the Crosse ae of he ase ih ani owe 27 Sen oe combi Ya et 242 Modeliea model ‘ample 2¢ shows the Modes mode ht contipnds te hydrate system shown ia Figure 26. Figure 27 shows th ston ro fo tha igri! Euaons 2 i av fee Sr ant » | etter stunies,oyanisvinccaity rin2e-3) ‘Parmttar Stunite RinenaticiLecontty Ge ip"¥) 7 Ha8*mie —_____J Cmpie?4 Hye pum fon ms sem assuning the et tank staat height of meter sd te acd tank Sans wha height ef2 ter Tasted of ying oat te Hod ca, STunit quis befre each py ‘eltypeas ne din Example 23, meinen chore cet an stevia ST, ang the peckage keyword. Using is approche re ue fe far ower charts for exh yi iype same. Tha of hi 8 a seat aases when woking fh og pockage names. In Example 2c, we en asthe of dense txt (conan Between ching ube goto mak) ssid with he mod and parameter main his example cludes comments which provide aan doc 28 _IvTmoDUCTIOWToPursICAL MODELING WITH MODELICA eae, Whence tcc /" ap ode ee ‘Sette nis contre comer “Theron en beter cane th pres examen turchogri toh py etn The St caeon tne cota sommes eons le ‘itm net mde eso toon en, onneante’ gn epesning ‘ection Ears py ad vesetsen-Conscanter pe Us SF pyc! sna in GL eve ee rns Rs ea perenne omental oe cst Sc it tae re hat he coma pes compe onl pen fete comptes won. stan sre pe est OR shvamica ney. 25 LANGUAGE FUNDAMENTALS ‘The purpose f his etn i to provide & mre compehensie dain fe langoge fundamen dense Wy te examples i this hate ‘This section ncloed for completeness but not ee. Reade my fee fet sip hi section eel they coe wih he mit reseed sf 25.1 Models Modes have bebivor ested by algebra nr iret egutons Recall ure of he nodal eyatd i samples 21,23 and 24. The eyword model in Models ir wed ine the sta el eon “As we hive sea lao examples, the end Keyword (flied agai y the Imoel ames oe he end ote nel? ‘AS seen in Example 2 the defnon of model may nce designe ‘exo provid adios fomaton boat he model, Te etl descrpon ‘ofamode mst e contained wan matching donb quan ast pear dct ater th mol rane, ‘The texal deen for constant rameters, ables er any component declan mus pee er 9 the" whichstsedo inate te endofiedectarton, Whecomment re {efor tex with opr sociation oan pro he Modeea sore ‘eral desriponare ey anole wt speci deiton. Ts nk ‘specif delaron alms tex dexrpon tbe wed in rap er Ines or stomatal generated doeamesation, Inti chapter, we hve Seen mode which comin constants, parameter, ables std eqetons While tte ae ober igs & mel con, Seamer ea py maa nce Dien! Earns 29 ‘tee rth base clement aed shoul be scent for developing simple poses 252 Variables, parameters and constants 2521 Declaratlone Asso my hve ed rm the examples in ica he delaton tery quit ey varie, parameters td eonstan) eqes © Ye (eg, Real or henge) followed bys mane. Purhernoe, cach dele tay inctde ua quan for fugu (eq, "=32") anor esate te {Setcitd wth te quanti. The nd of the deciaraon i Inde by 2 ecolon 2522 Types 1m ours example, we wed the bul-n type Res 0 represent Ati soit ven Models provier hee atonal bln (pes: Tnceger, Bootean ané Seng Teaton te bal ayes, spose create dered ype. Deed ype ae specaletions of th ttn types. For example, he Gere type {ange sown ie Example defied in he MSL lows Derived per provide more specie nfrmation about fe ua. This information is etal for dcameation proses (what pi nis fe soci ih given pamete, lt coneson aod in tome css ven some smc aaj eg un checking in expression). The mos Soman ae sie types inthe MS ae comped in Appendix 2523. Vari ‘Any declared quai in Moi has a pee vray, By deal, aul decied gunna sued 6 ange a function of Sun tine. However ae aii qulifers wich an be red onal ere lee of aii. Ini per we ae ntroaced vo such aie, Constant and paraneeer Boh of tse gues preva he ve of Sua om changing daring salto. Despite fat ht both ae ‘ett inthe way thee ae two impor diferences between constants Salpeter Fis once eine within sods const ote to techangod.Fcthiseon, the apical brite fo some ols at Slow jst o const (een dips them) In price, his means thecal way constant canbe changed isto modify te soa cae of amodeL ‘The eter derencehetween constants and praca sha he dels ‘fa paameter may clade an xpeston or he a ofthat paneer at 50. IRTRODUCTION TO PSICAL MODELING WITH MODELICA he detain of conta mat pclae an eprom for he alte of a costa fo esple gin Examples a2). "Ter ares varilty quails bt we wl css thos inthe coment of sabexquent examples 283° Expressions Fr the mos pr, expresions in Model loo sia to express in cater computer lnpuges. Ins wtion, we wil cover the base (fs ‘preston wedi our example oa 2531 Bale expressions In Exarople 2, wes ou fet we ofan expression. We compute te secvive of onan t= (g/t) ste. In this oe expreson Me we ‘he muliphiton, vision a uation oper. Moc set the tnd / operator to verse! sito, sabato, mligcaon ad ivision, respec. Furbermore, th” peratr owed to ees og am exresion «pow, Fo example, he expeson (xe) repesens the sum of and rated othe oer of =. Use ofthe” open an be Seen Example 24 in determing he © parameter ‘The prnedence of te erates" /, ad tps ef pretest se Sn ste "As we sl sxin Chute 6 the +, md /oprtr cn be pli toaray (eg, ves an matics). The + and ~ oper can te wed oa ‘crit to sry ofthese shape. The * an / peas can Be edt ‘liply oc vie a say by a cla Ftermors he» operate opens ‘he inte product oprtor when sed Betwacn vo sas he apo shape 2532 Conditional xpresions Condon exesions ae expressions which eau 0 cer teue of {eslae. Sach expressions eh elon oper” “and ">=" 10 epee ently. equa ss a ess an o ea ‘oper han and ret than o ful wo elon, espectively ust 12 With basic expressions, cononlepesions In Mote se smi ‘dkoglexesns inher computer angages). NL ta he" eo" operators contr te plied to Res sable, In Example 23, we sa bow the “>=” opera was wd 1 dteeige wen he imation in deren I Sco. Condon expesions ex ‘be combined usig the or and and logis operate. I on, te not ‘perfor ca be sede egate he vale of conional expression, Fal, ‘enses en be are tex control he precedence he oper Dien ations 31 2533 Function call ‘The odol ica. ath package inte MSL ince ny sf ection (cot Append force a). Forintane esa bw ther fcson ‘winded in Example In ase wherefore orth on {eguent th ages ant be prt by commas. Chapter Sess, Intl, bow to wean ake fasts 2534 sng erpresiont In Example 2.3, we sw bw a sop vole cul be dened wing an whew cond.exps sa codonl expression eating 10 cer tae | false. Inthe cae where the contol expresion evans fo t208 te ‘expression eats to trwe-exps Ifthe condonalexeson eats to false, he eexpesonevats to Eazae.expr- Among ober gs, (hss comenint way of epesoing simple fonctions and dicots, Sich expression ante we apjwbers oral expression canbe ied ad ‘mayen be etd on side mae For ange ep col be expres (hing expo fom: 254 Equations Eich ofthe ods in th chaper cota an equation. Ht iimportat 2 recognise tat te =" oper n Modes der not repre assignment Tnsten, be "~” operon Sees rato tetween several aes ad does ot neces tobe the oe Inte, n ution exes ety been to expressions and has the “Tis is important esate mean th moe! developer ont eqie © ‘nape equates gt Ber lf igen frm (a ak which an be ‘een et once comples systems eifrenta agers equations ive) Infact, he oquaon sped in he axiom a be ay embinton of alsa and feel eunons. For crampl, conic he Tellovng set fenton: 32 INTRODUCTION TO PHYSICAL MODELING WITH MODELICA where time ithe got slation ine, Wf Modelcs were «procedural [Enguge like € o FORTRAN, the item! would sig a abet tthe second atement wld verte value wih ae vale. Ts {rbeenine nthe languages he = operates ied 0 repeat aspen. Te Madeca, the = ose equal elaoship and te == repens the operation of signet” Asignment ae nat alowed mn equation. Tnen tay ste node naigorsenasecon (sesedin Chaps BY ‘ni posite ta he quo righ be earangsby sao ino he following st of asgnments: ws, Note he ua of te: epee, The rarangeen of tens inhi way Caled mle mmiplton. When you pide eqns in Mole fimlator i fe to perfr sch manipulations. Renee, Moda is ‘deine lngge whch ners tht te model developers cal espasble {or providing the egos, ot sling them ‘Nec that equtos ean appt caide he aqution. Specialy an ‘guaoncan aso appear arto deers, Te owing code agent {monte : noel contin wo vrables and vo eqns a ‘hough cly ce the eqations ppesrin the sae. The ter guaton| ‘Srp in oe declron of ambient. The aly to ieade eqns inthe way can be coven tt also colasig since Soh tation a not ly sped when gacing athe mode, Dien! Egeaions 33 of varal nit action we wl scythe do penta sabe Soy ‘pentoe 2551 The derivative opertor inthe exrssion der (x) the do pein i dt epee he ime lative a teva One ingot etc thal the de eperator fan only be sed on varie, not on exesios. Furemioe, e der ‘pent cna be re ecrstly, Inher word he following gal ‘ty torent te second dere Inrtero reese the scan dei of sible, the it derive mas easigndto a vaihie Ferexample phe 1 SCS; 77 Secon dorivesve ‘The simple pentlam model, presenti Example? shows how hi dane thn aoa 2552 The delay operator ‘The delay peatorcane ike wih eter of tee pune. The fist agua of te delay operate vas an expression, Theva of the dol oper the ale o te exression delayed by sme snort of time Toeamcaat of tine dey eseco spunea peo. only two uguments ae preset the th second agen mt Be a rameter esresin which nos kant futon tine, The long ‘San cxample of ing the day peso ith ed ey ‘The reaps f= would beg z(tine~ dt) +ytime — a) Tus possible as the de ay pera to expres arable dey a wel 1a hid arguments pee reeset te maxim tine deo allowed 2d he scan argument an ten be a inearying expression If present, the ed apuent mut be pratensis the vale be soon | avTRODUCTION To ParsICAL MODELING Win WoDELICA arumeot mus alays be eater has oan es than te ve of he hid 256 Attributes sch dale guatiy (ag, a paranetor or constant) has st of ret. Tse site an be oid et with he ype of he goat rte speci instanceof te quay. Foreampi= In bes semen the sear, quant ty and unt atts we aso ted with be ype Lange. Any dedanton of ye Lenge automatically Inher the aes of Leng. In the second ease he decaraton of ‘reise vale of te stare att iherted fom ype Lenge. An) ‘Sh ajnmen theater p a eclaraon ada macro. Mee (eas cm aise can be fond in Chapter 3. We cone hs Section| ‘sth ri st of oma tes 2561 These tribute ‘When delig avaible he stax ves wet prove a easonube Inia goss Ge he expen of the eed ate for a Inpora| ‘xcepfon. This cn be useful in pele whic inate notin ems ‘equations. n sch systems mop soluions ae possible athe at a ttt cn te eed oben slain i ound ch of he bln pes has a art ale. The defi value for ihe seater, Noe tht he vale of the st as srt for | ype anor when deciingw consan of ht ype Because ech constant Slaraton must rovide ava. Forexample, 2562 Theta” tribute ‘The Etned atitat canbe sed in conjunction withthe art tba, to spect he nil vate for a aie athe st fa wane sation. When the fed ati eC, which eth dean va, he wet tia merely indicts an inital ess or wiles eg when sing mo linear equaons However bene fed aie erue the et art ‘tne the ae th val met hve tthe fe lo. ‘Amore compete asus of how th ed st dca Found HnChaper 1, Din Egos 35 2563 The min and “nae” atu ‘Themis and acai define he nina nd macnn visor ‘sven mumeetype. Tes atts awd to ent whe aay has “ease vile. For example temedyeme tempers we meas ‘emi o abslie ao,so mega ae re om pyia.T net hs ‘namodel the min atte would beste, oth Real an Zeer ‘gpeshe hein and max atts. "These atts ae siya in del development to pee the wer famode fom enteing mow phic ves fr preter a retin Simultor know when ites ound an wren loa 2564 The “quantity” atebute The quant ty atte i charcersring wich dreres he maar of type: In mont eres, he sing cots oe ye mane, For ene In ce eases inelving deed types, be quant ty abate ofthe bate ‘ype (Bvenay nth se ined i Abbi pes ive the quan sty te 2868 The “unt” and “plant tate ‘The unit abt serves aint adie for ape. Asignng ‘aseingto he une tte weet sot pe, wee povied Tora prulr type, is importa th al alae gc or uti of at ‘ype tein thos steal equations ite adel wren with ht ‘Sfumpton ta values we povided inte specie uns th Rea and Integer ypestave he unitate “The MSL. povies ae callecton of pes wih he rope is defed (ee Appendix frat of he mest commonly was ye. The Mode ‘ea spect, which cn be found on the companion CD-ROM, contain es aout te format fr sigs represses ans "m= Fer motes pr second "for ots)? ‘When emerng dao paying res, th aes fo en pe ae orally provided in the pial emir apd wih te unit att overs is possible se leet units en een dats o ayn Chapter 3 BUILDING AND CONNECTING COMPONENTS 34 CONCEPTS ‘Wie eqns area ese pt of model development, i qucky ‘comes eons te tal te equations forthe compan ina pte Thar chapter we show haw on coe ution ke Obs aw ‘Stomatialy genertecomrvion ogee or qsniee ke ery ant mas In doing, spb oy bid page moses ner ‘amponet.Onee aga example wildemoasae ios gue eae. ‘Shih section the cd chop wl acs these fenue deta 32 CONNECTORS ‘The focus ofthis caper wl be ring reuabeconpovet mel and ten connecting toner of thee models outer o frm comple eee. Imrie todas the connection af compo, we mast des 2 new ype of don cle ennector "Tetest pial aalgy ofa comnactor ran ll plug. The nian tag of eles pls fat when you plug, for example, television ino leit elet, you canbe sre tha each eI the pg wl comet | the apropte miein he val A connactor in Mode sees te sme apse matching he ppopie ares om cometrson deren fomponee ‘A connector sion cons vibes which escribe the itracton teiweea components. The allowing is sample comector defnton: 536 _1erg0DUCTION TO PHYSICAL MODELING Wir MODELICA ‘ess by setiag he atopLayUnte ate w te desis physic! unit ‘Only the oat type isthe dtaplayOnie ate ITatoel as nt comerson caption osc ai comes held ‘te sones. Foret agu potion deed inte MSL 5 lows “This became few pope tik antes ine of ans, For eneing da rasplaying rests oat people would prea se dees insta eran (Gereoltons pruned fr pe second The dbeplaynit ‘reindeer he pled unt for pre rcering Sd post proces ‘Tee dhepaytnit only hv aml he ol you se wig eipores0 comer, Insny abe nt atte wlabays inte wh seed inside te mel 25.7 Physical types ‘Secon 2522 decried how ne, mote spied yp can be created ‘rom te bala types Theghou as ehapter we have wed a vit of pigleal ypes (eg. outage, Velocity andAngularAcceleration) "Te main advrage of tee specail types ha thy ae Beer te seshing he ate ofa ive qurity tha epee ype Rea. Incomes ‘models it maybe eifeut fire ou te ps epe of sme uate {ie rl teed rs shold be As we hve seni tate examples, {puamecer sane Light ine a guy of eng o ndctane BY {sng predefined physi types fe iended usage of parameter aril {mich charer. Porters clover naj may chek ese uosteny ofthe units ile in expesions, Tae we of ys ypes i {his way cua improve the aati of ecole a el 26 PROBLEMS PROBLEM 2.1 Rewrite the made sown i Example?! oat physica per an provide descriptive et for he model, ails and parame Pnosumé 2.2 Whe physica pe defaion forego able mper ‘tre and mass ron What he ut forest? Do they hve oper ‘anor over bunds? PRosLen 2.3 There are mary comeraonprinipes we may employ ‘he fc tha el orgs arcund wp maser conser Tov? 1720 explain war bing contre. Dire! uations 31 PROBLEM 2.4 Rute model shown in Examples 21 and 22 fra vere of tal poston and velocities, In each cu, ln omega at futon {Gf theta and compar th ear and norlner ejector. Wht are the ering harcore recone? Prontsat 2.5 Write @ model foro “predatory” tem sng the Lata ler tem futons: 4 = any- pr = why wher reps the predator option and ype the pre popu Yin Suggested ols for model coeiens a= 01. = 7 = Sand 5204 Bude Modeten mode fr th tom ond experiment wit diferent Inia popaation ee” he sli by ploing prey popaaon ‘ers predator ppudation Ponts 2.6 Crue model, snilr tthe on shown in Example 24, conan efor mor) tks coated by pipes. ‘PnonLei 2.7 Wriew Made erresion jor Van Buample2.3 sch har: {i rete) 29 0: 28te % Pnonuen 2 The longitdial dynamic of on ref cm be approximated bythe following eins Yound Brogan. 191) 220 225) 226) here 8g and ar varices representing pitch pitch elec and ange fac whl wand Soe fight dames parameters and 8 sa np "mpesering the eeaor ale Using hse equations, ete modes which Drei the behvin of the bef ding ferent mance (ce tne feryng eletor pasion). Sample vas for. wand 8 ae 025,25 and Tresor 40 perRopucTON 0 prnsicaL MODELING WITH MODELICA 33. CREATING CONNECTORS AND COMPONENTS Let uit by considering fear example. Figure 31 shows alight ariton on te ote eeu shown i Figure 24 Because ew esr ‘ras aed in gue 3, te teh eqns ae sight fees tan 33,1 Equation based approach we meeto write a Models model forthe ptm a Figue3.1 he sane say we did oe Figure 24 the ruling mde mh lak someting Ie he ‘one shown in Exaile 3 ‘One pole wih he Modis oe! n Example tht ti geting 2 il fc ose! wha model ft y king a be auc ode. Inher were, yon wold at ocarefly stu the dein in ample to male represent he sbi gue Auer rblem we ate tring owe equatas mip ime. fi aw for exarpe, oper vice in Example 3.1. Whe wring Obs Taw vice my nose ike mich of Daren, writing 25 ines for 3 complex cet rte andthe proces weal bor poe. FUTENDE Ia mitabe made mast be comecte a2 pls. Lie aking se the conservation equations ae wten cect can lobe a eiousand ene prone ack. Fortes reson, Ie peered way fo model the stmt REE S51 sto se component sed pooch, Tipre detsca.stuste Tope fer RL oe 332. Component based approach ‘With compancot asd approach, we ces asingle adel foreach fhe cemponcats we rite (Le. YoLtagesource, Resistor, Capacitor Sed nauceos) Once thse modes xs we can comet nines te ‘epetr in vay combinations. "Te ey tomodling sing component bed approach ist ik about tbe {re ds agra fora component aby gat (broning er ‘om methane jaa) 2 gram wei dees al Sate infermaice| ‘Suid with acompones an iene posible eternal nBuenen. For ‘ample conser the esr sow in igre 2. We cane tha he esto tas tovolages asc with one each coaecton poi. In atc, ‘hee are caret fling tough ach of hese connection pins. Ey 12 A tetod dag ea asin. 3321 BlctrcalPin Before we can tpin wing ode forthe clei components, we must feet appropri coneactr fortes component. Lets de oe ‘This connec etes the wo guts soca with asingl conection pin inthe resbody agra shonin Fight 3.2. FortbeElect 32a Psm eaecog repent th volage at comecton pit a pests Ite canet flowing io theese "An inert big tote shot hi comet the fw quien foot ofthe cornea. The flow quale ienes qanities at rst smo ‘erm, ata cranestn pot, siyng he pope flow vars lors {mls to impcy generate he comaraton equations ike those ft ‘cl’ cuet a shown Eunos (215217) Ths the et sep Inking sytem noel case told and Denon pose. Typical, Be iow gies apple one deer of comers quan Le: Coren the me derive of charge, hich eomsered qn). 'Now tht we hive deed the conse pe. we can mote on 0 He component models 8322 Restor ‘Ona i dessbes he behavior oa ese Le, vain ep ample 3.2 sows how a Modsin mol could be writen for the = site sbown in Fgue 32._The".”_in ques fe pv sa ay of| ‘eesing te lta elements ofa componeat Sine p son instance of an ‘Biecer‘cal Pin comin varable for volage called vIn this ye ‘quaiy pv represen the vllag esecined wit in ‘Ws important when developing component models owe content sgn oon foe the #loy qm The somal sign cometon for Moo ca componens i fled such at pstie Bow Is no te component ‘Theclr inde he Roa at ox motel te vale of pele e cure ‘ong it he resister fom pn pan he aie fot te cue ‘dng ont Coming Components 43 waa a | ‘eowyie 2 Aa rar aie owing fat he resistor rom pin n, Foes Example 3.2 we cm ce | Fostvevleferp. {wae hen vis rserhann Tis consist With the normal Sig comenion Like, a poste male form eke When spear an pv ‘i Example 42th caret pedo repent cent in Oba law This bce betwen sng pt and naira, However if ‘bean aed in he equation, wold aed woe wen es ine tsi the sg conection for How varies (Le 2 pov ve repent fw inothe compet) Fly. nt at» ela fale of 3000 | ise forthe estas oe reir 3323 Capactr ‘The consiie equation fe te Bevo of nel apc o! a2) ‘a ‘Once we hve writen the model fr the Rea tor, ti ay to imagine bow a model for acaparior woul be ten, Example 33 tho jt sch ‘del Note ha We mst cone fo re these ign ooenton. Losing the mol in Example 3, on might wonder it would pnb we the eqnion er pa fl As we pitt in Sesion 2.551, ts iota besa he da opesor ‘ano: be apie fo an expeson. inthe case of he Capacivor adel ve le his by odcing hv varablowhich epee he vg dierece ‘ros the cnpctr The dah eapacance fr tiscapactor dele 17, 446 erropucrion 70 pinsicaL MODELING WITH MODELICA [pithy tiie crwesann cee reapcteneey ‘Baie Aetel renee paoe nad Inductor The costae equation fr an itor a 2 6 Towle Ai ree mae sample 34 sows a Modelca model for nner Again we tke cae rouse th cae igacomention, Can you seth similar othe Rapistor tnd Capacitor mol? We wil take sana ofthe snares in ter ‘samples The dfs indcance lve 10" 225 Step voltage source ‘We now nena mode fr the og source sown in Figure 3.1. Example 2.Sshov how sich mel cold be writen. Te Voleagesouzee medel ons fo algebraic anton. The st tates what eva dpi ‘Shou the Voteagesource fm omecton point pox The er etn “dase hat he eet Coming In oe side of the compooent mst exacts ing Comectig Camgons 45 tulance te cuneat oing ct he thrid. Unie our revi exams, the Yoltagesource madkl does nt conan an exp egaion for te trent owing though he dvioe a fncoa te Vlge op ares Instead. nex eqaion is proved forte volge acs he ec nd the simulate wil be spun for tering wht arc fearon recess de vlage equation: "Noe tat thsi an dealied volage source mol ad the dicosnous voltage drop might case uo a ome crete or example, ts vllge ‘our were cones pai o capac the fatter | voltage (de ote sep) sould igae a ini cute pe hough te ipa Fer moe ri rate os mig neces ane voltage sore. BY defi the vliage source hasan inal vtage dopo 20 ols sd amps to oage dopo Wa aie I sco B26 Grou [int oround “ermal ‘Empl Ano i ‘Tae st comport model we requ salah ca shown in Figure 31 Ground! The Ground mad e iferet from alle ober slots imodlspseted so far because only ha ine Elect ica l2Sn con ‘ctr In ton. hr ao prunes asd wha Grund model 446. tvraopucriON To PinSICAL MODELING WH MODELICA ‘The only uo equi fo the Gzound model io mt the voltage a te ‘conection ozs. The Ground component model cate senin Bea [8256 Thecrosndand voleagesouoe are gle stne The ference [stht he Gourd adel conan te svlte ape os omen pit ‘whereas the VoeageSource model costa te elatie Yolage betwee "we consecon pints Both mofle il ue te aero nly she forthe caren rough te device. 3327 Civuit model “Ramp? mir mt rR cn 3 Now hat we have writen our componst mols, we an bing hem all toptherto ul sce et ne shown nigue 2 Example 3.7 shows tat he Modeia code for ur cic mol loos Hk. No in Exar 517 ta estore RL and R2 hve diferent wales forts Restotance araneer: We en ee is bea th delat ofthese rears ona | Imodieton (Le th semen conned win parents) change te Vale of he parameter of ach component. Because he elation ofthe ‘age source Cmponet 0, oes Specials os parame (Le thee ae no modieston the desler defied ine the congener ‘ode wl be wed Inordeto fll undestand Example 37 sme explanation mst be poe forthe coasect command. Bese he dl fh onnne conan a ‘covered in Sesion 36, we oly preset x uy explanation ee “The connect command gett estos bated othe conten of he connectors being once. Equations te ener by cons tC eins and Comecing Components $1 Poness ofeach conecior with matig names, Nomi, the connect amma generates an equation which et te mahngcomponens ea ‘achther However facompenen hah fo aii, hr atheough ‘arial thn a exuton eerste ch suns te mating compo teas. SoforourHuect ea) Pin comectordefnton he volar sete tal oer vag he constion pis ante sam al cae ‘nations he connect ot stot ‘sings es, we fl th he connect teen a xanple 3.7 wuld seer the following equstons eee nay (Sips 2 E80 cqaica | Es = Aloe Susie} ths = Rebs an Sar") mine = dpe wie, [7025 F pets Fins = Simms common 9 capi tpt Goes {2 = Ents Minas Raps o9 St tow ont foe ow 5 Staind Cnt ggromd ‘The ons ofthe amet othe connect command it igor, As le oul o 333 Standard electrical components ‘evento reat deo able cee dftons forte cantor and esl components (eg, Resistor, Capacitor, te) ints set, opefly his was isc ia soning how old wp rch components ower, sms ou taal of thi has already een done form This wate the MSL has itary f ele components ik he orponens ‘e cree in hisses and any moe) “To demons the wseflses of he MSL, we wil eimplemene Beane 2.7 wing compeoens fom the MSL. As Example 8 shore, eying We ted is aaale win he MSL. The Moi langage eats te sy 48 vropUCTIONO PHYSICAL MODELING WH MODELICA to include gaphi infomation about component (oe more denis sost [mph nlomto, see Seton 9.2). Became the MSL provides ach [raphe informatie stot each component, sebeais hetht ne svn in pure 13 can be ely eed dec fom he Mosel sure coe* “mp Medet ice. Hlectrical.Aoaloy: mms: Fawiei Rie eiconmae or Sm 11 ot ne we gt Dt a cle i ing an Coming Canponets 9 ote ow it woe wa roid oui the RLC lc his sine Boome ‘wed no need owe an component male. The MSL. cots «xr nme of rede sed etic composes 34 DEFINING A BLOCK we caer Aecl our dicston of he block gram approsh exci in Section LL, Let conser hw suc sytem cold be const n Modi ‘Teck diagram we metered a modsing shown In Figure 3. Tis ‘rem preset the con of retinal (plan) by PL onl “he Pl snore oped sesso dtcrmin he angular velst of the ‘em aad ancl nora sctte The sigal represents the desired gular seaciy which, for example bappens tobe ane wave. These (Serepesens he sped senor eadig nthe sha The conto of he ‘ln ocks a oleate ee a forge signal, wich s aplied oth ‘an model. The respon of the plat model gen bya ase fin, then provides the feedback gn ow 34,1 Equation based approach we reat a model ofthe cont syste sho in igure 3.4 by sip Ting sth eaten, the evuting Modeca mode! would Yok someting Texan 39, Wivhlsaprosch, weld ousevesrewrtng eqns ‘ove and over asin. We can avid hr roblem by wing 3 cmpenent based approach 342 Component based approach ‘nce api, cu gual 10 cere esble component, Thi time we will develop mada which cn be ed ot the stem shown in Figure 34 50. IvrRoDUCTION To PHYSICAL MODELING Wir MODELICA | remotes peal rp.t, 160.0) | fence srnute-aentactetectty 3c0-3" farce Siunite bapangeoeeiciene 0.22 Eel Aspect wll at ny nabs of eter ose consratons Fr hs example, We ‘mst inuedate he conc of» Block. A block special Lind of wool ‘ther exch connector Is cota) exp) marhed es either an Input {xr ovtput. It espected ht each component wil reve eens fis ‘uptewriten inure opt 3421 Connector definitions ‘Bowed Camorra In rer create ou component models, we must knw what information ‘ral rom fe connectors In theca, the frat shred teers ese models is slap doating pie value Foe hs reason. we dele ca ‘omector as sbown in Example 3.10. tng ond ComecngConponens SL 3422 Cretiga sina sgnal generator “Te natal lice ost wth th eed nga velo onl Asin@Q'), The model fr is devng ial shown Exaeple 3.1, persion xen “ompeSAsimei lp 3423. Sammation block ‘Te model fora Suma on Hock shown in Example’. 12 Neha thi ‘sol ncaa o sale atric allow the pt tele indepen (eat Le utput = eae imp + sean imp) whic ese te ‘rosa afte mode. For sxunpl, we cass hs trout Summation ck imo lilnceBlsk by eng one of he sel corso 1 Toole 2A kc os M24 megrator block Our Integrator model canbe seen in Example 3.15. Ther iso bin Ieraton oper. Instea,negals are epson is ems oes thing the der oper In i ne he negation expe Soutput = input 66 ‘92 NRODUCTION TO PHSICAL MODELING WITH MODELICA ig nd Comet Components 53 (an pe sian oats Teich Anise “Tenia up vale fort inet gven by he Sava parameter ‘hichis weds the aarti om Seton 251 forth uf sia. 3425 Transfer funtion ‘ample. sb zepresento offs ner mfr ection ode “The ants funtion charred he following maternal eee: ule) © wh u() pes he inp igen and (represents he pt ema ‘Nowe bt he canton cnn wo carci paramere 3 an 2 [dt etnecenctan ‘ie A toe atin M26 Galnbec “The hiro ain bok represented bythe olin mtn: output = Eo input on “The Gada bck noel apperin Example 3.15, Can youspothe sina the Gan block hos wie model in Example 313 and 3187 isa good ‘ea et inte hab opting sch sims or easons we will exp inte oe caper, ‘ape Airc 3427 Complete contra stem ‘Aisi, we ar able put all hse models ost ito n compete syste Example shows the del itenin ters of component models Fete sem sown in Figure 3. Whe Example 3.16 looks more compl ‘tod than Example 3.9, component hed odes areas o build Bem fey canbe cone grape. me Acoma ba cam nd fr ae ows gee 343 Standard block diagram components ‘Once again webae gone fo rea del of ole oimplement scallion of pdt sea erst inte MSL Remo, the papas a is chapter ‘Etoshow ou how tite models wen hey se nots ‘4 IermoDUCTIONTo PuYsicAL MODELING WITH MoD-LICA 331 Connectors ‘Our sgnal comector isc define sag wo dent comnactor “entins in ocea ica Locke, This bec thee roe eonne tor teeing aad ate fo oa (each with te ability Yo Bale am ry of ‘aa The connor aie allows “These cones deiions canbe fund in he ode ica. Blocks. Interfaces poctage hich coinsalltheconoettfortheNodel sca. ~ locks pct. lastead of wig: fap signa in og can now we the folowing MSL components especie: Using the MSL components seems ke It would eure» gent de mee ‘apg. Howeves a gral! ol woul pally be weed 9 conic sch "Speman ying mole rele sper “dag nd” operons. Farber. we hie aeady see examples wher the spore keyword has ‘bee se oiimize the stout of png nee. “There tome important ferences tween the coat deed in te NL andthe one We Seed ever in Example 310. The ist that ‘he snp gulferis inh ise the ein of he Eno comer ‘ster hana quiron ech Signal cometoe The presence of the ‘put qualifier testa e TaPort comoctercan aly be comeced © ‘tng comet Asa et of having the Anput quer isi, we lint epost of cidenallyforgeting once he gar vile ‘nile mel "Thee dilerence tha the gna cared by the MSL connectors i ‘am aray whereas our van was a scl. By dealt these ofthe eign] try 1 dewey the parameter. The fet hat ga isn ray ee ate tt ein ung ond Cmecing Componas55 ‘swf boat it allows sever signals oe mulled no the same econ Think of ike an ecwosc cable with lie ies nie (eg. anon cable). Mor formation on ing rays Mesehencan be fear Caper 6 543.2 Other cesary Blocks ‘Now ta webave covered become. stu car ateton othe ote ‘oc reed obi oor contalee The commanded enna! velo sas previo represent wing the Stnusoidalsignat Heck. The ral ‘pots Hack in he MSL. Hodel sca. Blocke .Sourcea. Sine which hs parameters for ampli, quency sndsigal fet, The ode ica. ~ Blocke sources package comais a aunber of ober wef ig eer “he Gain block can be replace bythe Nodal ca Backs .Math.~ ‘Gein mode fom he MSL, The Wade icn. Blacks. Math postage oo tans blocks which ae user te algebra map fsignal nf, there are ro models which could serve a repherents for Summation The {is, Nadel Sen. block Nath Feedback ited in fet oop (ie he one we hive in our example) ~The tee mel, Nadel ce. Blocks Nath Addis more Ik o ila Sumnat ion ose bea Allows trary une to be asciedwith exch fh pt sa nly we rege bck which expres lone slang he de ‘dvs of sigmls. These can be fund isthe Nadel Sve Blocke-~ ‘Continuous package On sf ock fom this package istode ica. - Blocks .Continuous.antegrator hich can see at 8 repacomen fer oo previous mel abo call Invegrator') Another wu Black fromthe tame nested package se Model sca. Blocks Cont uous. ‘Teanafertuncesontioc whichis expres ule) dag as) hae) co) SAA3- Complete dagram [Nowe fe lhe pees we oad otal ou contr sytem ng ‘ompovent dened in Nadel cn. Biocka. The alt shorn ise 135. Tecomplte Modan cade orth agra howe Figure 3 Sesh {nBsamie 317. sree ine repr mat ne sroinertteploie Sates imental ‘5% INTRODUCTION TO PHYSICALMODELING WITH WODELICA ‘Novis nechsatn Fonintttg) ood nash onan Townes PN tmelivedee( SI, feegtee 3 we Gia ci 38 EXISTING ROTATIONAL COMPONENTS Let uv tr snple peda model ia Seaton 22 and we it © intodoce the ade} Soa echaniaa- Rotational package inthe MSL. rag andComecing Components ST 35.1 Connectors ‘The connector wie ia he Node. Machanios.Rotat Sonal Ik tea ical ange" Thee ae atl to ern ange connectors Ine MSL. These wo commer te clled Flange a ahd Flange. ‘With tbeexcepton of tel prapbialrepeseatatios, tse Wo eoanecr ate denial. The Models deft for Page. sown a Example 18. Tehaten tnicnagie set ‘Bay 8 Ooi a moe 352 Special models ‘urcrigl model of ape was escribody combinaoa of ty sod igri, We sil epset hse behav y he mode Rotational ~ endui show in Example 3.19. The Feictsonuesedoine motel, ‘Shown in Geample 3.20 wl be ed to onset he peli oa fae of ‘fens. S21 Artatinal pendulum made Recl rom Example 22 ft hero the pendulum due to gait and = mg: sn) + mb*9 9) ‘anpe 3.19 shows he Malia cove frou Ret at Lona Pendutun ‘model, We we the connector deiiton fom Example 3.18 song wih the ‘ravi equations shown a Equation 3.9) ‘Unie or previa pend exam. his model we eed conser tte" ty diagram fore pentlum, Inher wor, weed conser ‘te pony tat ome exe ere eto elas) might ‘Sb cont to he on of he pendun,So, e mut ume a he fm of htt both pio poi seq 7,47 Pe Wt Fe ‘beam ofall extemal tors. “Thera era ffeences between fe Rot ae onal Pend unmadel andthe sine mel we cated Cape 3 The rt ference tha te 8 IxrRODUCTION 70 PHYSICAL MODELING WH MODELICA ‘otedeatcn nach ota. pat) signa =p. ta ange-s connector dts he gus postion othe pen 8 pt ot previwly we fad sed theta torepesen he ane hg "The pet ference Is a te pelos example the ped mas, wasnt sigan Besa me cul aes itt ech term the sem ‘tegutos.That wa poe because we ha te compe set of bebo ‘ypaion. Ths tine though, we cao be sre what ter tems may be Inte (vate acon) we amt cancel he mass et inal recl at the Modlcacomeatin is th the #1 quis on ‘a comectr ae asumed tobe pote wen they win the compone| ‘he blog tT sweat hen trues weld rae te ‘momentum. Soin the acne f gaia pea gree than 2 oud imply an ph peer tan so. We en te hice ely tha we ate ‘wed the comet sign fer each erm. 353 A fHetionless pin modet Prev, eit comer wha lions our pend id with ‘nssurounaingsTheimplstssampin va hat be peodaun was come {0 same fed pie bya fons Bening. Example 3.20 shows a mods Uwhich cape! te evr af ch 2 oT eee, he jt ana ‘ofr earls of he eae nga lacy e poston between the endl ns sroings Pun ond Cmecing Components 39 ‘Ear A ag pend Pin Foun 16 Asepniian sen 354 A simple rotational system “The Mosein code in Example 3.21 secretes cu example fom Chapter? In aldion, Figure 3.5 shows the schema for spl tm ‘muy Asimpe penton | ‘The Node] tea. techanice Rott ional. Fixed mods i snalo- ‘gous othe Ground model in Example 36 (Le, provi a ed reference Fee oter compen. 6 wrmopvcTOW 70 PuystesL MODELING WH MODELICA 35S Building more complex systems are ake - a - = 777 fixed=0 owe Anemone pene ‘Ope ofthe grea things stot having irre of components i the vat ‘mute of combinations hae possible: Sofa me he only Been conrad ‘wi 2 single pends, bt wat we wad Yo cost aya ah ‘up spenders an penumsFigue 37 sms st such 2 stem. The sen, damper ad ed point mods al come fon he MSL. ‘The code ors systems sow a Example 322 feseicn fachanon fatten! ver Ste 3 pavers mie 522 Ane ahi po Note ht te rodeos to pendula pia Exagle 122 ae net. ‘mote weds, modieadon op! may nla mfr ocmponets ung a Comecg Cmpenens 6 Imsde pa (eg, ph. Soh eanve modifeations allow modems be ‘pled component win = rey 36 LANGUAGE FUNDAMENTALS ‘Thi chapersisrofuced many new eas. Lets explore ll hes consti te mre dep 36.1 Connections ‘connector defines information hic toe shared between compo- nts Toee rn Bi on the momber of aases ch can Be dele Innis connector I's ven pone locate a connector Which cons ay of brary bat edie ike te Tart and OutPOre comes Nodeiica blocks, “The comnoct keyword is sd within an uation sto 10 ik” cow seclr icc ‘The cont command ays spear in he equa ico ‘sn beaun cach conbecton ete nat f eqns being peter sch coorectr mst he ex te se ner of omens witha ‘he same names, Furthermore, components wi dese ne mast enpatile ae Section 2522) a low guns can ely be ome ‘her oe quotes, ‘Acomnectsaemeat inde wo agoments. Iter worl connect stamens be of the geera fae wheres 8 are connects (bjt the constants mentioned earn ‘here he conostors sno igi ote sno deen between the previo cones sate! ad Norm, heft of wing cone tht quton ate nen which aunt: qn in one comer with counterpart tease a) Inthe oercooecoe Thescepton when quiver taethe fo qulle ‘plied to hem, Stace flow gute ve early he ne desaies of fensered quis, ommeing hem gee genes on egion which sali iow guts omg Rio rcoret ns). Queen connection iveles le components eg cometion poi in Figure 5.1) Tethers ess the umf te Foe sis ool comets ist culo ame Bally fa eanactor i ever comet ayting hen ‘low quotes int connector are imple set to 20° (62 _rwoDUCTION To PHNSICAL MODELING WITH MODELICA A ton previo, coon can ve parameters ssc with them Suchparamstersaesevlyusel onde beste fone omar ‘umes within connector, Spel consrato sen for uml ide comer Ifsparuter spear ie a connector. he comect ‘tment vers that the conespeding ameter in thet wo comets have "he same wae tt egos pemerte, In tet wor he elwing per : In sunny te connect keyword als tt gue. sy (e, without ‘hepsi of man eo aad atonal generat eqns ppp 362 Qualifiers “The ipa ulfer denis quis whic oe imende io beings to ral. The isp uit nfl fro ifeent ease. is eps {hein vo anybody viewing the soe oe motel Le esp snes thatthe Sper quantity shoal angina onan output sonnei nthe ‘em, More porta conectng wo np oper tte same el of Tehri sno alone. ln sway. the tmpat qualifier eset fres the quit to be comput yan extemal mde. Noe ha igre 3 sens tooo sno at 0 nt canoo be comet oer because "pea tha eg ofthe two pin lek re ennai Howe ne "hm he mplementaons in Epis 3.16 ap 31 how hat i at eh of | the gun oc opt connect 1 he cut of eoter lock a tates inet ‘Therese aos wrinklein he emanic ofthe Sapa qi Is ote o cane! two tu connector tga hey ao i ame [eel ofthe techy Thi i eecsay in cre allo inp igas ote ropazated ito haces ce Secon 43 for m example exh ug) ‘Rea eT aor tien athe a ‘utr and Coming Components 63 ‘The output quire counter tte input que: The output oar inden tha given quanti computed bythe model in which Seti Agathe prose of ds quae to exes the inet of te ‘nol developer nto preven certain kids of eomnetons Le isnt est ‘Scone iopeber vo guns hic oh ave the our gue. “he Flow gai Is efi systems where conser Pencils ae oped (eg. sles e mechan systems). Any quan Heated as 2 Fhow is stinmed at each coeection pot. The foe qi sgeowally fepledo componct with aphycl pele. Curren Powe) hatte {me dra of eons quis eq. charge, energy) By comento, pus vale fora Flo na connector resents a fow nt the ol Which eats the comectoe Nett we flor hi coment inal exanpe. ‘Asa gee le gut spied osconnestor ae eeively ropgaed ino every menber ofthe const, When evloping scone you ed ‘ase wheter ou was the quali o be apie y the dfn: rahe ie of elation: In bat ass, he components a. and ay are consid ina The fuer caer wefl when 3 mnie et oe i be ao ipa ‘or oueput conto Te Inter nei el to foc he contr oe 2 pee decoy eter tape or utp” Pally, ster eng fer placing th qari the ciate woul tet cee aig” ‘omecis wih complementary tpt and outpat quis aera (64 NrRoDUCTION To PHYSICAL MODELING WITH MODELICA 363 Modifications ‘Wen a model i writes, eal wales fr preter are fen provided by the mod Hull "Ar ve have sho ip Example 3.7. we can vere ‘hese ara defaliswhen the component deed. Changes oats, lieth stat, min and unit ates dscssed in Section 23.6 a 0 ‘seins modifeatons Moifestons en be applied components thoaghot x cmponet Ne archy, For esmiplconsder the following example In his case, from he Appliance lve, weve ape a olfition ta esr and capaci inte Chou componert- As canbe seen by this ‘ample moficaoes on need components mace wth ested pais of premises we il atemped to most cps cD fom te ApsLiance lvl ‘ne weal hve overdo th modieton neal ite Cece mode. [Ars geerl, modcatens ina decinaton vay verde meets Tbvet down inthe Merch Hower tere ae may eases wo covered by thre The precise about he precedence of moisten an be fund Inthe Modes ngugespecfeton nated on he companion CD-ROM ‘Anite expe of ere modieaton canbe een in Exanple 32, Instead of rameter, au fhe ps are ssecied wih he Bp nthe ovat Lonel endulun were modified. un and ComecngComponns 65 364 Defining a block ‘As mesons in or cont! seem ena, bLoek isa pei cae soto) wheel connectors (or theca of the coer) a aed at ‘ihr sept rote. Desgrating anmeting ae ocx haste pet “pli ml posing cet spond an improve he aly of daproste meses 365 Finding and using component models Sof, when we hve requ psalms (ag, VolEage), we have lachedineline “Inport Hodelios, Stunt a," estat of a not th Tht allows wtoae Stunt te oan ali ote fl ray path where tte pia nt nfermaon stds, We have neti pth Roca Modelos wl at automata seach the tbe iene of model, ‘ops, ee 0S someting they ae ot fair ih. Here ec ngs con doo make eat an ose he in yO wih "Use the fall mame: You can ase the fll ame (eg Node ica, Cconstanite.pi or Hodelica stunita.Precoure) tele ma ety yo regi withn ode Do ot wom forthe meat whee ‘hese nls aero be acs rn Chater) Define anal: For example we wish 0 acces the 1p coined in dei. Stunt. package, we inlet ie saps Nosed within cur models whch cre the Srunst aa ' Place models in he same directory: One way tomate sre our mod! ‘inte found sto soe the inthe etry ou oe woking If ‘Sou plae lode inte sre etry ten he sl eo ety Inning them. While we an do thie for or snp exam, bore re Teter ways of sorng mek which il e disused ner iC 12 ‘Theis simpli version of the lookup ale. Fors complete wdestandig ftom rch oops done consult Chapter 9 ere langage mein Incladed onthe companion CD-ROM. Flo ar examples we sce tte ter component nee we have sien aren te sme dicey a he modes which we them. In his 2, Siecan ube component model ike ReaSarar or TeaneferFunct ion ‘vou having to pode a quliedMerrchal name (eg, Rodel Sea. Srunite.Preeeure) 37 SUMMARY Component bed approche hie the folloingaantges (6 rRODUCTION To PHYSICAL MODELING WH MODELICA 1. The conte egunton fora component ned oly be wien one, iia he erponet de). 2 Hierareis of components posly many lees dep ca be cet and soc ier re mch aie © ued compre oa "ates ‘presentation where parte, aa and egos oe pee 0 gle mode 5. By using the comnactSzywor, we can ntonatially generate mute suas fora slg conaetr Tn aon, tis nt mer pone a ‘tng th equations by bd 4. Recon ca be poet agit concen which do mt make ene (eg, conning to Sepa quasi ein fo ales with mom ‘ow vibe) sammy these aetheesoos why component asd pyrene evelopment ae rparior equton aed approche fr ge Pobens 38 PROBLEMS Pom.eat 2.1. Us the lca! components dpe i thi bape 1 guider develop analogous components In ter domains. Fr example 2 ‘rmdaional tem ese olla P= has 2.10) any en) to epreset the behavior of pring danger andnias where Prepress force ranted by an semen bi the sprig aie, the damping open and ms he mse Tora gio anclgou dona roe the arial anole wih the connector i ht domain and whch epost domain corepond {oie reson capac and inductor component he eel dma? Rosie 3.2 Deepa model forthe cra howe ix Beam 3.7 ng te block ogo componen nodes from te Eales Section Assn ‘har he inp othe tem the lage a pin Fare! ond the out ‘no nested ins the vege pc. You mht start by wring down {the contin and cnsereton equations and ying formate han ‘auch a wy thr sack equation can be presented by ask he Bock un ond Comecing Components 67 Paone 3.3 Browse th MSL and loka the connactor deft fr lifer domes reer ay common heme? PROBLEM 8.4 Implement nonteor aonlspring wih he lowing cosine eatin Tale) talhe =A en) ear represents torus, represen nga posion and hss “nd epreset coneton” Once implemented ute he pring tha contains component fo the MSL. Ponts 3.5 The power eupe of «restr canbe found by taking the roduc ofthe cen ough he retort vole aera he ree 1 Care a model of restorwhate soe ation of temper Tassos Ram+sr-7) where the mfoence temperature Re the nomial reise ot the Infrnce tempore Ti te tomperare ofthe reso and St tf area) entity ofthe einance with espe t tamper Compa e temperate ofthe rear singe flog eery bees mogh = iv MP— Tons) where mis he mast af he resin yi the specif hat capacity of the ‘ess she comectve heat ransfr coe! and Ta he cen empentire. Ean how hs tor perform in ome of our REC example ‘res ith diferent parame vue, dees the rata gwen of he vio change? Her ae some spi ale By = R(the norma setae) Tang = 600 % = 30 m= 001 @ = k= oa Ss = 00 Chapter 4 ENABLING REUSE, 41 CONCEPTS acing ow al components ily thes pin an fcnt adel developmen process. In ro masini he fle of hese component itis neering to aden how fo make them easable The Model Sd Libya good example oa eusbl cllecton of omgenen Many af he fern Malis prmae ese The ajo are of Models wes special ntodusd opr be ease capbiies| [Fangupss Hk Ada aod. While nt rosary, big faliar h sch Tingnges the ecg ws o poms ruse a ose bps wl ap in unestaning sila ares node ‘These ar several sects to making models esl in Moi, For x sgl, renga tof component mls hat Wor ogee tee ‘STeomnon connector defons in oer orem to shar lafomation ith ‘ach oer, le Chup 3 we showed hat conzector defini or seve ‘fnain avesleay tee deine int MSL By sng the MSL connect ‘tions, me can crete ew modes thea compe wth ibe colee- Mon of exiting ls Reus ilo achive by etenting exiting mses. As we wll how inthis chpty, hs txhige allows common sets of equnions, parameter, ‘Sgeritins, ett e share between model While ths hapter intes fantom nthe Modi guage to promote reve, the wefles fi ind of easabty may aly come cls afer ou tae ened o cee ‘Sov collec of movele Aa ze Bein wid several examples Sedincloe summary ote etre which promote rea in te st eon otis cope 70 _ivrRoDUCHOW TO PHYSICAL MODELING WFTH MODELICA An important aspect of psa sytem modeing eo espcitthe esi ind by wing asl mofling frmutons. In pve sets mls (eater bn block gras are eal tres Decae ech component nel ‘nb ormalae independently witht Inala fh eure asa ‘ay ssumpons sed in ce pss ofthe tem. Th ean nese the ‘ua fr ysis compovea models changes depending the cmt ‘ic he mode ued Whe we dono dca theta in ths cape, Ths aspect of eb ican in pret dein Chapt Oo fis apet oft wonh meting tae ised ‘ytheqaliyefmaeldocunesiaion. Thebeterte dunes the easet (Gere mre ely) wil be fo tbers to eae your mol, 42° EXPLOFTING COMMONALITY Inger ving the sume cade ragmen apes ape ties in ferent lecstons usally leds o rblems. Thirst nln gage such at Cr and FORTRAN as well asin Mola, Ts eanancy nd boats aes ainenance cfteuk. or example i bu found none copy of sack a ove gine ict to wack dow al places whee sue ode have een repeated In Models ch redone ih nde repeated ‘unos. repeated prance or repeated cometr defo, Init section ‘we will dace hw to soa such edn) 42.1 ldentifying commonality Let us evi he mal preset n Saion 33, Loking ot Exages 32°35, em yous: he sndaies ttt hae mol? to ‘ese nls hve may ngs in cnon Ne he el ms sce we evn pos he nd Cet ow oh ‘er anti equine tey be ops be ‘enanes pani. Inter wos ter ghd pence ‘those models. eos 'm ort lp avoid his reption, the Nodelos, BLectrical.~ ‘analog package defines (iis betel Interfaces package) a pact Imoelcaledone?ort. AGnePort component ion whschhar exactly mo erie pins associated ht sn therefore oe cet pth th anole 4. shows te OnePore mode which repress th one et bween the Resitor, capacitor, Inductor and Yoleagesousce ‘adel An imporant hing to ste shut the Gnebort malta I ae With te area pes slong the I of he components of anode. ‘Subtype relosis ae na ned to model Sch lone spy (oc al eins in Movelen(e. comector ein). 484 Creating partial definitions InBsampe 1th modo defntonwasprecededy th part $a yor ‘Taepart int keyword ines whl thirmndel canbe extended, anna te sania. Ih ober Words, he mde a fandaton on which bel ew models tits ot a popet mode sal (aly because ss misng some coninuve etn). The partied keyword, Hke man fetes i ‘Mosel, ot nl enforcer saan toto coment the ites ‘th erin ote develope In ber wands if yousee partial ode 58 wrmoDUCTION 70 PHYSICAL MODELING WITH MODELICA you kn idly tht this ot somthing 08 would ene at ater ‘Smeg tested fom. 48.5 Making elements of a model replaceable 4851 Replaceable sabeomponents Exanpe 4. shoved how we cin dese a coepant to te replaceable. ‘Tere ae two diferencs between 4 normal dolaton and + replaces ‘Once then ate Hen lead, te oupt a be uncon, 1 computed y sly inrpoling betwen the vues yg which cespond ‘trocar da pos 532 Using for loops Ate inereing hing aot is example i hm cots 3 for oop. ‘The exreon dine? i acaly show Band ors complete aay which Incadr cmon [1,---ye-2) Avan gma 0 £0 i ponds the ‘ng of vals the varie should ple at ht varie Wi aa tthe fo hop. The wean tht rented at he tat he {or hops dippers afer the "end or" sttoment esc. Fe this 533 Named arguments nModeica, these wo wat nee functions. Thess to pas he xquents in tore they ae declared inh funtion Seti. This ‘whtwe din sample 52. Letur tthe Puecowsee function slag Slemate way of imbing a enti hs ase, we have provide an exp eqution fr ech pa anumet ‘then ising the fanceson noting fonction hs Wa) eal “Mode so ong aan equation s provided foreach argues. Figste 5.1 Shows the vals ory genemed by his ade en 196 IvrRoDUCTION TO PHYSICAL MODELING WrTH MODELICA ewe. ap serine ene racevtv nt 54 MULTIPLE RETURN VALUES or car nest example we considers fiction whieh at morethan one en vale mapine we nod wo elute a polycnialinand he dete of ‘tat polyoma with spect oe Ciena ara) coming the coeticiens ‘ofthe polynomial Example 5. stows afuecton which ses a ng lop ‘impo he value of he polyol and its deceive. “Once aa ne eo ze) fenton determine ete of he ays being pssd in, Ug this se format, for loop cn te enacted to ‘Salt the polyoma ads dae The flowing ml cas be used tovalde be cleulion ofthe dete: ete teat Fyre een ath cote = (2.6, 3.9, 2.6 sant Bay, moe Weide = mayen simu ‘We ca vt the oy faction ty comping Ean dy. Pencions 97 ‘age Branca pain 55 PASSING RECORDS AS ARGUMENTS or compe finctons, sing in ge mamber of ramets can become cmbersome nese ae, tue den a ecer dpe wich canbe ‘Se gp several ily lato ramen ogee? Unngie we wish {Werente fonction which var th sum see ine wae, YT Asin esse) on re ach wave sits mm ample, gen), fs and phase si Exanpe 35 shows hve weight wre ch fenton, ‘Note tia Exanpe 5S uaude lod record Sefton. Loca definons are mf bate they ele aston with aspelic model or fenton (es. Conguextave). There no hace tht hs Data record could te conned with ance sacar slo named Data tees the dfaon Bese wine Spite fection abd hrf a qaiid mae (Gos complenave at ms be edn ny Goon ofthe Dat ‘record oid the Conpestave faction 55.1 Building record ‘Thefollming oe agmen get sn eabow ibe Compete nton ‘n Bxampe 5 could be ued 98 INTRODUCTION To PHYSICAL MODELING Wir WODELICA Pains 99 ne | BAUSCH ali Se A, i Soe ad Peel ca cnatanee. isd med phat)? ee = opie S Cong ame ert a Seren in, Ee: biaes(e, woiion cont “Ee conte ene tas on Remember bene Datta within function Compleave, erefrencetatrecorddefniton singe ulifed name Comp Lexa. Bata. We ten provide the pecs dis foreach of the aves and ‘ke the inten tn wy, we hve reed the mb of gues | {ConpLevotave oa outa two. The dt proved in thc sl exe ine conplesstavefncton eval te flwing een ¥(e) = 1Ssbe(tae) +22en(Ore +x) +68sin( Ors) (52) gue 5.2 shows the esl of snug he Tat Compete ode 552 Variables within a record ‘Arecorddsesnthivetoteaparanetor stsinthe Test Complete smal some aes, maybe ul ode a record whch cons “ime varying quantities. Te following co rgnt sms ow hc be sccomplied Waker = (2.2, 3.3, Ssnodetécn. thse (846 wneee 2 (22333, 39) Stepan oy hile. comene a, or For this example, we sr sng ese the mame dt at we id in te Testconpleroiave mode cet we ali te ast em odin wih time Mathaba his shoud ead othe evaluon of the following expres: (2) =15tin(éee) + 22sin(6ee +) 4 886° an(léne) (3) 100 myrRoDuCTION To PHYSICAL MODELING WinH MODELICA “The ess of smug the Toa CompLestave2 model ae shown ia Figure 5. Therenlssloincade craton fe folowing two eons Als) = L8sin(irz)+22sn(Ge0 4) +58sin(l4e=) 6) Bia) = 1Bsintins)422sn(6r2 +5) 69 [As we wou eng, th res sow hat he vale of he sna aie {aly fellows te fancton A) te grdinly moves close 0 B(s) = te nbn thet em imiibes DPencions 101 nd teenie, Inagine we hve en exiting erat C subroutine named Cooputecentialpy tht aks presoe snd lemperatie as an inp ond Computes the ety of or working ld san erp Rather th rere Sachse ara Modsizafanet ea, lt Took at how we an al te ‘mal one del from a Mea mel mordertouse axing exes, we mst int writ wapper” ‘unctionln Mode fore wean cali ext sobouine. Example 6 hows hw we would wits wrapper uacton forthe compute.en86)Ey ‘stron er Sidon i Tecate. 56 _ USING EXTERNAL SUBROUTINES ‘We bine denntd How a vary of fncton xa be implemented in Mods, While it reso wre Models funn, sometimes one ‘eno alla abn writen nC oe FORTRANTT In hs ection me wll Show sn cumple a aw hs dove 56.1 External subroutines ‘A common requirement fr thrmafyeanic adel is compute prop- nis (eg ebay) fa ering Mud (eg, water fora gen peste (ono. evehater (98.81 i] ‘eanpt BA Mn wp fsn rs Crti “Toe uote computeenthalpy wet in Example 3.6 shoud hae Cefn pope tos someting ie “Ted fo the Cfncton pooper a deine willbe covered shay in Secon S78 562 Language specification nay i ot te oni ropenty we Wout nd, In fic, my simile properties ae fen ete Papers of wring is a oi ‘Salted war ae calle stan able” Example 87 shows how we old ‘rte function hich cll an sxearaslswouoe tat wets seve opti at onc. nhs example, we hee assumed he saci sri EFORTRANTY. * The FORTRAN? cae fore ea2eprops sabre ‘om Example 7 wood be similar Dideernncat etree gsm pipe lo SRST ATSC ROMTENTE ae ede ve [Bowpe 7A Node wee bo rs FORTRANT mane 5.63 Invoking external subroutines xtra sorties eink just ke any the Modelicafunct4on In deri vate he facto, he sino ol ets ase the tie, Typely. oly mpd verson of th sbrotne weld be reed td mote source cde How the stot is acesed (comple & linked saa pecs mot covers by the langue spesicatn, 57 LANGUAGE FUNDAMENTALS S71 Arguments ‘Ac we have sen inh hap the angen fnton ae defines by the inp compooen ne publ section of he fet. eiton. Ay ‘mponen! preceded bye inp quale pees quay eg pss intothe unetion. Likewise, any empoen preceded by the output quale repens a qty being erm byte fonction All emponetn he ‘public secon mtb ced input output, ‘At we win Ezample 35, when the numberof argument sas sting loge ts seat pus tomaton is unctonses record. Thredacet the munber of agen (and conus shel wen eri) 83 2 Local variables “Any gusies wich ae cacalated tom the Saput vals, bt ae nt ‘utp vale, cle Tol tables, Ar we sm ip Example 3, ‘eh arable mut be decared nthe protected section ofthe fonctScn einton singe keepin athe ass of exe ocala ‘se nu sored between function ioc Inter Wor, you Sign ‘rl toa varie dre one meetin of the unceson, ou canna expe ‘ost have tha ale she pest even, cto 108 573 Algorithmic semantics ‘The main prose ofa funct soni to perform algeitnie clans ‘Tra cleiaon nine looping and conor semen el apr win slgorsetm section The mow ipo hig wo remeber hou an agorsthm econ tht ini ponile o mien the ae varie pees. I ech ease, te tw signet wil ple the ae fom any previews igen To ‘ndstan he sgicance os conser the lowing code age Incase, col he st esigamen = import. Thi in comes lemeguattonteson ver nus equliyacntpeesen npc ‘spats, Bot of hes equations re signet nl ed othe imple z= y = 2 “There artwo wa ol he dierene between asgnment anion st signe moles the += operon we equine he = epratoe ‘Second, a sige mst appar Wibia an algorttan Seton ood | ‘ston mst pee Wiha an uation section. This els ea a ‘fin abou weer een ia agent ran equi scents all meas al fncton ie Models behaves slmst xa he suteoue in or FORTRANTY whee vals can be ‘signed and essigned vals. S74 Branching ample 51 and ST conan i semen An een cen lio lncade tree cle ts wel esse eed cance. Fi xa 104 AvTRoDUCTION To puYsiCAL MODELING Win WoDELICA 875 Looping algorithms oping is ido inplemen algae tt regi sadn (the y sauder vale tot ty he Poyval fenton in Example Sa). There {teow Kinde of lope, A whe nop iso whte operations ae performed Tepetly hie me coon raise. Cone awh oop it [recdedby sone azn oatnents.The#incame model in Example [Taos how awh oop canbe wed. Abie seres the zoel forme 7 so eoeening Aft ay inalntion siemens he statements ide te hie loop ae ‘alstedepesely whieh oneanexpeson ome Condition esis "Te for teen in Moen x comenin for oopng over he contents veces aslo the "rec construct i anuage sch Pe nd Tel Te general ofthe for stant Tienes inno “Bae te sateen is op i soma eaescay st ech ae cna! wit e Yeo Tomevectos Asap poate ite poie log oer ‘cre, on nr rae). Tn Bnple 33, epson 2m est eter fl integers tetween nn in sae 5 ti ewes 9-21 eats 2 ‘cor sring wigan ouing dow oy tra of. Tid ‘recor shri eco nn Sena 632 5116 Invoking function I 4 tance Son ivked by providing each argument inte form of ae ‘epition os we tm in Toe Paecenon) the ponents appear in any Shier If a suton eve fr oe aramet te a extaton must Be freefall aunts On tetera the nctin invocation Ses ot Fncage eunon forthe rumen bt simply a coleson of mls then ie trier fhe components inthe Function dion determi he equied rer fb argument von, Pevcions 105 Now lt ws examine how oe the tin ae ofthe fonction. If «func fon has a single etn vale (Le sug output variable i is “enon on Example 5.) he tay be we in expen eh ‘phere ves a in Example 3. te {faectdoninveraton col bese nan estonia dit st fer the complete ight and ie. Pheer, he elt han side hold be oma seared it of vrs cclned in paenbses. The owing i legal esampl of inckinga¢ance Son wih mull etre aves (On he ern, hs sot lel ict: bec only vcals (em expresions) may pps the lef hand side 37.7 Built-in funetions Mode roids acalacton of itn ants. Ins seton, me will, Soc on OF te bitin ctons sa he eine i Be sce ik ‘Caper tec thy ole aay option ITA Analyt ype ‘The analyaeype() fino red to give the model a cance 0 somite is boar to ier types of ales, Te snayei=TP= 0 fet ting ona the ype analyse corey being pore. Te rile eum vale my nla, bat re ot Ed 1, he ees sown ‘ies ‘aysanich Beata east SRE! mages seen SESS Uta etn gay ae, ‘Rie. meat ‘Sapam TTA dein esse 106. mrrRopucriow To punsicAL MODELING Wr MoDELICA 57272 Abwste rae ‘The abe) fenton kes sing argument, nd comptes the abeoate alu of The amen type can beciterReal oe ntoger sre ern ‘ypeis the same ath goment ps, Matalin S dened oe) {EE ESS ry een S773 Sign ‘The eign) fntion kes asnge argent, x, and es an incon whether negate oe pose. Thetpealscanbeciber Renter integer atthe eum alvaysan Tateger. The eight) fenctin dined als eco ° 6 1:30 sont) S774 Square vot ‘The aqet () function tks singe agumen. x snd reams he sue soot of The ype ofr canbe ih Real oe Lue bt thee tle ‘hogze() Sewage a Rani. Toe ale of mst be peter ian ore (> S778 —Celngand too function ‘The col () function ke asnle eget, and rum he sales imeper notes than 2. Likewise, he for () fac tks «single ag ‘tet 2 anders he ret integer eter than a porn is {oretze abou thee ents tat wl be etn ale en grin ht ‘theta sens, ts tan Tneeger ine Medel see sed, he {sgument and eta ypeforboh cei () and Elcor () isReal, Examples wing tee fncton nce: eil32) + 40 sicag) 3 to oo fot-32) 3 “40 5776 Troneation The Snteger') faction jt ie the £100%) faction kes asap spunea retars the ester not rete ton 2 The ecce Pacers 107 is thr wile Flooe() res a Read, integer) reums an zntger Examples of wing te sneer () fenton cae: letgee(8.2) > 3 6 Ineger-22) 3 4 S727 Divison ‘Thea () faction esto arguments andy, anders algebraic quiet of 2/y wth ay factional prt scared Le texon wa 2) ‘Theargumeats may be of ype Real et Integer eer of fe agen anette renlisaReslahereie he natin Inceger. Euampls fusing he A) fonction ice ava) 420 aw-33.12) 5-20 (33-12) 5 “20 aiv(-33,-12) 320 (7,2) a a9 aivict2) 3-3 avi.-2) 3 re S798 Remainder ‘The ron) fnesonakstwo aguneats, any. andres theremin lacardd ty he dv) funtion The canbe egred mathemati a rem(ayy) = 2 — dite) +9 ay “Te arguments may be of ype Real ce Entages ite of the agent isaReal thereat Roa herve he eslisan Tntogey. Examples wing he com) ition ne rem(22.12) +08 rom(-32.12) 5-08 rom(s,-12) 5 08 rem-22,-12) 4-08 oan) 5779 Module ‘The mod) futon tks two arse, ad yan retake od of sandy, smodtesy) =~ loose) ey 619) ‘Theargument may bof type Real or eeges Melero he spent ‘tanec the reukisaRe abervie he nits Incoger. Beales 108 mv7RopUCTIONTo PisICAL MODELING WITH MODELICA of ing the no) feo ne sod(3.2,12) + os 24 uw “a 578 External subroutines ‘As scussedin ection 5.6 fen deine tae existing sobrotines writen in Cor FORTRANTT. Let wee te desis tt werent cone ytheexample S781 Typematching "Tile 5.2 shows he Modecn bit inpesand tle conesponting Cpe “Tis why he anton prtype for Braple 6 as | Example 5:7 wee writen in, ction prot woul be Pactons 108 feeser bit) ‘ould carp othe following C sete definition: secu toca ( ‘dame a) f Ne that Modi des not apport the sng fers contig vase Sie ays If san sue, ner to pss he rc a i an to the C language, the ModecaInguae pein ao roids forthe posit that he extemal rtroutne ite In FOR [FRAN Tate £3 shows th ping between Mon bik pes a FORTRANT? types! Ths mapping ma bd to crete he sobre header Shown a Seton 58.2 When ooking 2Clngage abot, it posible pst ecard the extern tte, Whe using ocd inporan wo kep sve tng in mind. ns when 2 Modeca record is ped ind language ‘hbtetine appends rsapeiertoasice These {ston shld cade he same component Mele ecerine ‘Sine rsd ung th type mapping sbown in Table 32. So he olin recordin S782 Custom mbroatine nection 1m or examples, we hive seen on way tht extra subroutines can be lnvoked In all ewes be Inngage an the eer of agueats wa specie ‘iy. es recommended ha extemal subroutines be ved inthis Way ‘stencer possible ved ay potatlconfsion ower in some cemsages my be neces o cso the an ing oo vale. Tis eae comes tout pmsl) when Csrowioe 10. pvmopucrOW 70 pHnsICAL MODELING WITH MODELICA sendy ests that retusa (be C sense) her tan assigning 0 ‘arable which ma pase by reference. For example, tus inwgie a the compute-cnthalpy subrine dacased in Seton 56 and eed a tample 5.6 ada pte which eked ke ‘he eta ae fhe bone wa the etal. Tow ti sbrotine recy, we could soa the external declrtin n Example 6 wih the fellowing desta S783 Compile options ‘Simply saying the exter subroutine ste wits inC ot FORTRANT? oes ays provide enough fort, For example, FORTRANT? and ‘Coomplessometines spend or pepend a” chatr' srotne nanes| inte comple obj ade I ihe respon a he salto ol ove yo ea thc adoring tem pees S784 Sideutets anions shal mothe side gets hey st anys etn he sae put fora gien sof pt). The i pricy porate i ming ‘hn wring extemal ubetine eae sexy 10 aes tds Such ef These ie efees may come fom eadig fo of wing tl vals orm tae of hr panty tari wtih tems ae “he way tai effets i to ke ett fncti's opts ae \ependet oly cae pat. Ir wor, 20 ea om ori ony risen da (eg. lol Yabls oi), In sme ete pratt to avd lacing perso data tt el pose wo wed se tect, For example it ssf, when opiizng te performance of an extra strut, tedice sme Kindo eset cache Sach aproase are fine 20 longa hy conti to st the estton ha fo given st of inp values, the our aes ae sayeth sae Le, te each ingen evfrmanc ut dees ot fet he rea) 58 PROBLEMS PROBLEM 5.1 Write intone perform enc inepolation x adi ‘othe arganet wed forthe PLecew ae sin fom Example 3 eddan ional amen tha provides he slope of he ation (ea each {rid po. Assn he ole of x i defined uch that =p 2 Sy he -a( (16 i 1 ain ri () eum dem 19 we) = aff bP toe +d (5:20) where ihe ae fhe incon ae pid pont ond (18) te slope fe fst tthe rd poi PaoBLen 6.2 Read Seton 145 and then cet « Malton tar computes the Ici for te inepoainfrton Probl 31. Toke ‘hing pe, eoune De gr yard and gr vas are ‘leona (Hin Yu ely only eed diferente Equation (520 bat remember tht €(2), PRonuu 6.3 Write oftion tht ako vector (Le an army of el ruber} cx argent nd ers the maids he econ PROBLEM 6. Write aft 1 take he mer pat of ro wets. Be ‘ae io inde assertion tha ns the vcr ore he sme se PRoRLEn 6.5 Write afncton ht kes the postion and maser of fe Bods and cleats he grvitina fore betwee thom. The groin force shoud be rend a vet The age of he roitona force Us gen the equation: (2 (s22) (523) Chapter 6 USING ARRAYS 61 CONCEPTS ‘Athough we ive covered enagh materi bal wp complex stems hei al ute a fiona onconatyIeft tcoer. ie chaps, tne focus on aay an the contd socio (ef, for and whe) wed 0 peat on tem ie feces on te decaon of ays. Model allows wt dectae serge of clas (egy ry of fosing os bers) aswell a ays ‘components (eg, an amy of Reni oeor tsaees oa ey of recor insets) Ary of cle fl fo repsetng materiel nis Te ecto and mates,’ Ptemore, Moda nce festees spor trig vectocand matin enon er ignness. ray of cmponats ae ‘st etl whens are orale pmb of open ate eee "Aton a You sa sing aay, you que ecogaize the eed fr contol site lie for and wht. When weeking wth ays fea, coal tres ate vel for oping over lemons ofan aay. Forays ff componente sme cto tae san Besse 0 ep comme! ‘ponents witin an aay ober modes 62 PLANETARY MOTION: ARRAYS OF COMPONENTS In is secon we okt sila the motion of evel tds eerting agitation een th oer. Pig. sows asamp configuration of 114 wymrooucrion 70 PHYSICAL MODELING Wr MODELICA 621 Connector =a sEcpoateion es vs a // ‘Prevents using vector equations oo pe 1. Paty ge cnr aon ibd nom In der wo proceed, we must fst dace what or connector dfnion shou Tok ke. Each fhe objets ino simlaton hs aes oon tnd etal fre asec Wid One pole connector dein for thse dies isshown in ample. Homer, wing equtos ery hd = Stes sac the sae equine. Newt's aw) spp 0 cach of them. Fe tat eso, we are eters o peste psn sao on nape 62. erase the oes on each boy mt uo 2 in each mension he ‘Force component fhe consesr ar bees dae fo ale, ig Arye sat bsyactackont apie ema ti i gy eg rmter Shunes,Weseey dase via = (0,00) rower Shun Position Seite} = (008) ‘wie Mat ent ia ie 622 Bodies in three dimensional space ‘Tomodel he behavior ofa body fang inthe meron space abject ‘ocntea forse use Newt's nv Bana op where Fist fre exeed on the ody, mt mas ofthe bss ad i “be celeron ofthe Dey. Using Newto’s La creing# ode fer ach 8 th gute ingle a shown sap 63. Netshow compte eqns of mato ca be wot othe bos is, Eqosioliey = dex (be wevecorequons. Inter wre enmpnen ot exit othe drei fhe soespoting compan ok be 116 _pvrRODUCHION To PHYSICAL MODELING WrH MODELICA ‘Thepupoe ofthe protected section inode isto dca ny quanies ‘har atera tothe mode. Sc proeced uas, Ie the Ve oct ‘isc, amet be aces by extemal noes, These rtd composes ‘Se oly be acess bythe motel In which hey pero any mae! wh ‘sends frm ‘Benin he poston and velcty ofeach body ae protect, its nt pose for other ofl to clymedythe stare tits of tee ‘rable. stead hr nl vais are appli by te puke pret nies and init respect Note ow the parame we wed In ‘modifing he ee ax nite Tis one way tallow inte ces, ‘ees for madiyng only he rear an) protectod components 62.3 Gravitational attraction ‘Gravion traction between Wo bodes compte sng te Feong atin F 2) wate F ete gine ofthe aati fore Af i the mas of he i Yon fyi he mas of he ssond body i the eines! pao ‘tos andthe distance tween tbo. Thien eal comgutes themagnitde of he fre ithe ecesary wo mull sfc ye wnit ‘ect spreseting the clave postions o each bay fom heehee TAS Teds tothe allowing 60 eqns Mae Ay = pea) (63) An = re (ay we Fa theft ny yt ean nd the floret en he second bod by he Ts eal ‘mpi bythe function shown a Example 64. Nata the ouaton or Cmibody fe Exanpi aves equon, os ving ncn hat Sts van! Frcs not aici ‘eave vata stron mol hich sess feces the tecis in our stem Once we bie the Galore function in Example 6, we can wou viol tartan mode shown in Example 3. "ioe west apr ner plo ttre devlpmest Whee selpng age tae sem, the Slr of fenton ih sch {pete pups and geen me wollte frowned upon. The tee ar smtbdy ee maybe ten fccton with he sane name fre With det ode Fr eampl mapa me dy we who we ‘nel eloped by senso ct ths mous Mao wera funceionclled tang Aree 117 (ection Gicforce “Galvan Pores & Pour dan to boa” eri ras hy 1 Rea 12+ nity tn fv tboystoay eee "Bae A pv nin Ccateroree. Lets sre tht heir CalcPorce is diferent fom ous (Ge tyrone diferent excuaton nor ws ere maser ofa tren) One o fo hang ikl happen. One pssst sth we wil onze th ey equ functioned Caletosce and thir mode Sillatempt os our function allodCalePorce. Tether psy i ‘ht we elie hl finan oie in wich cab we have two eos ‘amod caloFoxce, which mt alowed? ‘One way toad hf eve stato to declare the function within sheimdel tat wert niche, ur mel woud loo ee ob enn Example 6, Notice tht we ave cade te function ina protected see ono that oer maelemay nama se of is Funct on enc ay Model tin extends fom te GravitationaiAttraction mode, The oer ng ah ey ie 18 nereopucrion 70 pxstcaL MODELING WITH MoDELICA ‘ay topo pin sch polo iso gnc very specie mame 0 there bene poral for enision (eg, CalcGravieationai Force) ‘staaccatenne tr Eo) Tite erre sneuate fre on tb son byt ‘ij Sodehic snunia. ponte Batya) | Shee sedesic States aoe ‘ows Sip pai ac ae ody aruniecsseerae, tate vel, 29.2903, 6) SSieceisies, #. of eettion ” Towle Craigie ample 67 shows how we might weit a mode for aay system (Le, 1 system coming to Bolles). The mode nde soon! dt for the Earth nd he Stn, Example 8 shows Now ey ts or so etd te Binazyayetentoiache he Moon m well Figure 62 shove the pth of ‘he Earth ding a sboulaon f31.881; 10" seconds approximately yes) [As expected is esl noe fi ofthe Ea aro the sn. Tn atc, Ils shows te Moon's path, exaepert ihe gre by ator 02, 81 ‘she earth ing these pero. Pein eon nh Powe 2 Simin eon he ae Mon ple “me ato, ana Intesc[séatatese, 8, a1: cae ‘Eaope 6 Anim nc Sena 120 INTRODUCTION TO PHYSICAL MODELING WITH MODELICA 63 SIMPLE 1D HEAT TRANSFER: ARRAYS OF ‘VARIABLES. ‘en pening simulations, «common ned 1 sole for vibes ‘hich te not onl fnaton tine, br aoa cation, Now we wise = {ne dmensinal eat nse robe densa how ays ca be Us ‘osiminte eh poems 63.1 Governing equations We stat by ising th equations seed wo save this poem. These ‘eqnions wil ben be wasfomed it Medea model. 6311 Conservation of energy For example, consi the follwing paral diferential equation fr beat ‘ondcton (es eg, Fle, 197) A foray = [Jas «s ‘where V se vole of the domain being conse, i th Douay Sauce of Vp she dnsty of he ate cs the pete eat expcty ofthe materi sth temperate at at iver pa inte domain, Je tbe ‘eat a given pot on he Downy snd she Yetor normal the Sure Sats ven pint on he sean ‘Let ws asune we a solving hs ution in rd with a ifr ers sectional area A (ee Figure 63). Integrating te let and side of Bon (63) over secon olen L per ff meer Ate «6 ‘ch ero he ermal apts of ha ston singe con san acive norm npr of yo ip band ae of Egon (65) oldest vay ort at ae mechan Lec ‘eto, comecinn lt) oer sie Be ea Fore None ictus cor nye ee conan oe ters an Sn Fue 63 Using Fore iw =e te contro hese sce: fete ph hd of Busia 65) wale = [Fao an 6 ‘ee te ermal soy ofthe mat nt, te epee int oma othe sri. Assuming se pci ares and motes ing areye 128 % et aa, we can rewrite Eton (6.5) sp Be ae =a z oo 6312 Spal creation "The esp in diving the system of equations to eliminate te spa dete asf) To hy ne as ae oe pia sss ‘out teers, 7b alone odin diet. ‘Ssume at om one dete sect of he oo tae eee ‘seer. If we ke hs emp, Equation 68) con Berwin os 9 Now we have an equation fo the tine deratve of he epee, for the stn ofthe od writen atm of geomet uae (he A and [Dm poperies (Le, p and) and the pra of eghoring secon (Le. Tn aT). 122 wvrropucnow ro pursicaL MODELING WITH MODELICA 6213. Simplistions sit mh eti Eg (9) Aine shop io negation ke 1 Ferner we mip ih 9 ine ht he detain fhe al tnt ire een I hay 2) a Infect is ia oto fom fhe meee. i he ‘mn Bice 8) ne et ea Bw tine eae Scone geo ower no (1 ene iso ‘est ow a el hme The pie it ian 6) ‘longer secon no wrt he it Ean (Ca) etme heen tn noman os ere cay an) a 6 Imapce we wish oa a conve st trier ter orp ea! oss er the sare (ce Figure 53) nh cs, we would seed Equation (612) finde a addon er giving ws 2 _ | Age a on aa FE = dobtt— te) re espe the ambient temper and Ay the are ofc Sp In Figure 63. Note dat he simpitying asumptins ae wo longer posible with hs frm ofthe equation fe, we cant eine A fom each te). Besse his eguton oman inane of est flow te sing ne ad | alwantriss singles ding acheter. Tesame cama sido be Simple een shown a Egan (11) Inthe next seco we wilco ‘be advantage and cedvnage of creing midland on Equation 6.) ‘su Eaten (1) 632 Equation based approach ‘rample 9 shows a mode wich ues Equation (6.1) a ls nla sever boundary cnaitions. The iia epee fey pots 900K. ‘Wesssune tht th pera ofthe rst node une fom 900K 0 2000K Using amaye 23 afer second ad the tempat of the at nde fd ot 200K hte ‘raion are afro bythe lst two eqns in Example 69). For is ‘ample, he sluon eae say state afer sprosimaey 25 seconde of Simation tie (os we wil se lar a gue 68) Example 69 ses he £5110 function hich i dented in gretr dein TBE 6.) terete the ana of al epee Exanple 69 shows an exten based approach solving pl leet tions In his example, te temper varies ae prevented by a ‘Say amd the eqns ae penented wig for lop. Nove at We can ‘ocst how ie the creton ey changin the rae on ndopendet| fe geomet of be probes Le olen). Ar meted previo ‘em writen nti wy ake the Hest dona des of eat ‘ele wthut having fo efit fndament etn, Egon (en. ere hose stant 1) tmgerscure hexay 77 conputed parameters Wi tocy ove interior none “note rane (i = aetna) -nert)er(4e} (a, npc Uig arose Eg 124 yrropucrio ro PHnsCAL MODELING WIT MODELICA 63.3 Component based approach "Chap 3, west howto wanton amesel conaining compete sytem of equation it a calecin of este model We wil nce gala deen Sa how fo efor sch afar at ane wsing models whieh ‘oan par eet equations Using Equation (69) she ass fr car ‘ieponen! sed approach cach em in Eaton 69) wl be preset) ‘fee model and een wile mand suomatcaly when hemes GA Comector dinitons Teast iit Pana ‘ple Comes rhe ent Asusal mesa withthe comectordefiton, Wells connector with ‘empratre wth ovale a et Now ate ste dough abe "ample 610 shows te comector we fr his example 6332 Thermal comtution "Now tht we ave car omer ein, we can bein wing he rine ‘mode eue West wi the bet conduction mode mich represent ‘heist and side trea Eton (69). Exam shows Bow we cn express thermal conduction as 4 model independent of ter modes of est 6333 Therma capacitance ‘Next, ened torepresent he conitsion on thee ta sie of Equation (69). Tht operetta eapctane of herd mil fo len volume. A mol which dsares he behano fs town in Example 6334 Faed temperature boundary cndton ‘The st componit we ned shown in Example 6.13, one to eset aed emperor Dircherbowdary onion, ‘Bawpc Tem mtn. “Terenas prenieyoee coaneceoo mer tse sans apctichancaecty ep ["Notettcnstette tnextacee.raort Tila 2) cee) sot Taatimmeratres ‘smut 15 Ped temper Bad ein GSAS Condactingrod Now bef ging alte components ogee, es ok at example cs how the patil pet he problem can be bonded up within single Srmponen od. We do thi by eeaing a network of imped components 126 pvmRoDUCTION To PHYSICAL MODELING WITH MODELICA 1 we tae in previous scons? Figure 6 ge sap epson fof Soh «ene dimensions concn vod aed Example G4 cna te Mode source code. Note that he cornet aadbinCondsct sng ‘pesnt thermal omection poi rhe od. ‘Aone ihathe Conduct nod motel enforces theo dee inf terol (e igure For expe, the model makes ue the ag Inthe cndton modes stance om cent ene semen a ete oa ‘he icons with length fhe ter capac model ice fom eft arte oi sare) ey bey key sy = = ae oe ea = eee 6336 Sample heat transfer problem "Now we te ll te component we need 1 repeat he Sane stem ss the one shown in Example G9. Tis ine, we have ered oS ttrezobLem, rom sable componees ae tht wing the complete ‘onsren equation fide ingle movel os we did in the Heat Teaneee mel rom Example 69. "The smalaton ress fom oben canbe seein Figur 6. The ‘empatue athe end he simalaos re poten igre 8 ction ‘flog stance log trod. gre 68 mons atthe sendy State temperate ple develops ino a ier Sluton wiih excl the {clton expected forts problem. "The tess from Example 69 i, Hest Tranater) ant Exams 613 (he, HTBeobIona) ae Hence. While he HYPreblens Medel move get and eal, some people prefer the approach ake inthe Hea = ‘Teanafex model because te parle equatn sshown exp. ESS amo ak Saaacae Rermcapacieence capi) ivan tak onthe cmc)? ‘Somnct |) cond, ca 1-3) tomes naa Sa) 22 ayisGie Ao om wlelice mocks sourcen-conetane TGe(aebceli rep inate (ne), jee seme Conduct ingRod Fodlne16,L=10-0,ke1.0,cp+2-0,2hoe1.0); “Bop Heme na srt i bey cdo 28 pvmRooUCTON To msi MODELING WITH MODELICA weae reas or. Sant kereobent mo ian 6337 Conducting ro with convection "Now lett model he tem deserted by Egon (6.18). Iother words, swe wi ai’ ental cooeston em. Example 816 stows a model for ‘epesenting thal const, ag oa ‘- an owe 6 sence Conc noaithconection Moen aa ext, emp. show bow me ca xed the Conduct sngRod motel la Example 4 0 nl thermal comecton by aig ew components ‘n.connestons, Noe the iferenc between he apm or Conduct ing Roaiithnconvact ion shorn is Figue 6 andthe origina gam for ‘Conduct ighod shown prev fn Tape 6 sag Are 129 WF myicas peraetars ‘pen ay : ‘Bowie Ae el coon (sant Soastingaanienconestion Ta mae te i ectbiesngtotnsenconvect ns Fawis67 Nicn ox oars te 6338 Anuthersample heat ranser problem By ating a comecv et rer cotataton orale. 15 we ave ‘the mods howe i Example G18, Figue 67 shows snaltion eu for Example G18 we compare te reals in gues G3 and 67. We ‘So sce tro dnt ets resting from he convection, The iat i tha ‘he tempers chown in igre 67 tt ing immedi case of the ‘ametve best ransfee Ante fe, ue cometon, tht the sey ‘tc temperatre ae not evenly spaced os thy wer in ip 65. “Ate ncresig comparison between Examples 13 ad 6.18 sown tn Figure 68. The fpue connins a comparon Between te sey wate 180 WrRODUCTION 70 PHYSICAL MODELING WITH MODELICA So wrone constant int ae ‘Rosen, sionteeurcee sep teteigete [70:0] oni stteei a anne | Soap oatortoiee yy | Ss Se ‘Eanyir 8 Hen alpen natig contin cn pv bees Pe. ‘empentredstbutions of tee two examples. The sltion noving aly enduction develop ino ner pole which ig aso he aac sole "on The soluen with emtcton and conection cry nese y the mbit temperate o 00K. Par. Con ey ne ign oecbLa 634 Standard heat transfer components ‘Wii the MSL. oes ot cure conn aon to sppot heat tate ‘wong. sary of bea transfer component enone, cal Therm |Sincudd on he compan CD-ROM Furthermore, 2 heal ary wil ently be carpeted int the MSL sit iy sch ity il have tte same basi compose and connector defo ae hoe fund in the ‘Thermal lay. ample 619 sbows how the Conduct ingfod made! fom Example 14 ‘ould ook if we ha asd the omponens inthe Thermal package AS We Stl sein Seton 103, he Tad package conn adie mel, teyood te ones shown in Btample 18, hich prvi conection betwen She heral domain and te mn he the hei ad mean 635 Summary ‘Wie stared by showing how we can quickly expess price pail eet equation in Modica Then we saw how, at Ble more or, we could cea cobsion of ante compose medel. Wil ee ‘eumble component odes we can pose and solve a Wie Yt of Beat ‘eater problems with erent het ane patsy, modes snd bowsiey ‘sedans, 12 pvrnopucriow ro pusicat MODELING Wirt MODELICA “apo shorn wins {Spor Aoaentcactonsee fom ecitiinccity coo ap ei D wold seam to prec gin the, Homeer, ir ot case. To “ndersand hy consider be lwing oat mode a slmaltion ts wih pov ae for then cond wil be true. ‘Along as cond ste, —V/ will te eld. Remember a oor expressions cust mule and effete a hich econ toe expresion changes ve. AS rest he ae of cond sat eased ‘east. Hed, he smut Inks forthe poi t which ps Blo ‘er. Ts cly ene that ptt has tee eid ha he vale of cond ‘hanged fo fae, Inthe oentine, we searching ota po epi “ales of wl be consider! snd wed ip eraing ny express In Sma, he nul exo! Eno forse thats es ha a wt Secs mtv vale fea hn so le Bene i has wed at vale {the aumento age root opeton ‘The remedy fords stun Ho place the noEvent. opr sound ‘te coool exresion Hover, sme conn exes can als tigger vets eg. te bln aba() fnco) oitistest place he eae ‘xpeton within ibe noBvent a fll 184 IvTRODUCTION To PHYSICAL MODELING WITH MODELICA eo operon : “Thenofvent opr supresses vet rm bing panera byte eee on it apd. This mods the pole of keg te sqoare 00 of «| ‘xztve mer becuse simul et th codtonz > Orig ey aloo ofthe ht band ideo the euaton rer than wating 0 Sey ‘then the canon changes, The ahs sth disomy doa, Some muna ero od Re oe eould bent at tee afew erictons ohe we ofthe Event cpetator Ft condtonl exrenton ofa ben cus cao equi Uhite nobvent oper nation, tn nf vent operator camot De wed boolean, Integer or String tons ‘atin ote, thee bave a proposals within te Moet Association © eve the nobvent spear Ar fhe wig of his ook, noe of tee ropes ten aetepd, Forth nearer should comin fction [ebecibedhere. However you run in thats young want ome She the emanate not oan eid 784A Detecting changes “Two more wtf unions ae the edge) and change () fences ‘Tyee functions ae desiane f oleate when vribls cae Biv Ter The edge fenton can ely be wed wih » Boolean vrsle tid te change! fanco con oly te wed on Boolean. Integer and ‘Seeing varias, Each fonction hs an eqaaen coodine expression, ‘The eae () fection sie a neta) = ant nw peels In ter wort, edge) trun athe instant athe aunt, x a jst become tre (ie, is tue and wae nt pei teas). The change fonction Sted: In cer words, change ) i tea the insta as illeent vale shan previo Ho. SAS Generating vets trepuar nterats ‘The sample function ea btn function that aes two aut “Theta isthe tine at which pling eis. Te end agus goals 188 {show frequen sampling occurs once it begins. Both pment ar of ype Node ice stuaite. Tame (oe, secon ‘The aarp function tums eve Fe except athe init wen ampling bi, he Se gunn df eveysmpsing neal (Le the tcond rumen. The ere abe only ese oro stat. 7A Identiying the start and end of analysis “Two more atin fonctions which at be wed for hy models re the sneiai () and verminal()foeine. The Anita () function be ames ere oly fran nan jas simulation sats IF can be weal far eting inal code for bots continous and dace varie (ce {Chg for more dts. Lewis, he terminal (fonction becomes ‘rw foranintant he end of acces sinaation. One example of bow {fe verminal() might be ued woold et call anextenal icton which ‘ries ot fa sinlton eu toa Be, 7847 Termiatinga simulation Fly we come he tazaénate() ince, This factions sed 0 {ndertat tis loge seul coi asinulaton, Theterinate() fencon hes single segment of ype String. Thc arumetepesess ttemeaape th ibe dupayedo expan te emieton of esac “Ine aca aoa fo teat 4 snl is bean the Smulaon has stedy vt what of eres nd othe fe sation woul ‘nt ielJanyting etl Forerampe we wishto sms hema sytem ‘eps pnt he pin where the temperate oh yste sos cM ‘sould tetera ae flows trade (dnt) te-2 eee Ass reste the ete of temperate change ops below 10", the ‘lato wil be emits. ‘he verminace')fancion sly ved ono the end 2 ue esl sulin. I you with emia smlatonbecase something oe one wrong wth simalon fe, he ale of aie ue the ‘dane then ease) fneon sould be se 186. WvrRopucrioN 0 pHsICAL MODELING WiTH MoDELICA SAS Spec considerations for othe fonctions ‘Special cosderaton must be gen for some of he ln fncians n Modlin, Forexampe he following end opment: ould ato be writen aking theta abe), 8 lon Since tereisninglicit condom expression wiih defiion ofa ith te same etl, stoping ts negraton whe y roses 20) a he Centon exrerson i repaces, In ore fo avoid uch sero, the fobvene operator can eed ut is wher egesions ‘TPefincons aba) 0652 ) Lv), f2o0e sateger() ea) xrem() and eign) may cae 'n elerupon in ae ieiepaton oes ‘bet dscetnatie, Te dacnuieroce Beet the om vse tf the fnew (soe of dee) pot commas nih spel 0 ie smmentsFor example he ate ofthe Snteger() fncon Inthe (Geantszedtensor mince! rom Example 7.12 wl Wager a nerapoe| very tie te Level varale anges 15S Well posed problems Imagen cls, fst an thatin rer 0 sve a system of eqns sweat hae etc os many varies vein, The sue ole te fot Modeica mode However fr Motes we need he be of varias ‘eeulte the manber of eunons pls the ums signe. Therese ‘onemporan eestor al eqsins and stents | ‘han cscs cued. Feheroe ll sighea oe sme vacble ‘daa sige eagorsean secon cot as single sine 76 PROBLEMS PROBLEM 7.1 Inpracty,snaaton ar primary edo perform “What 1 anata, Rerun the LogsoctscuteWsesiag mode! for diferent ules he Tag parameter = Look athe eet as nto he fe Shiny i he ce, ba ao on he aca ofthe cup signal These models canbe fu on he companion CD-ROM. Ponies 7.2 Phe lp dics In Scion 7.24 i coed by cpaconce bth wine, delaong the eof he sling" Acs tat 0 sr Yolue ‘orp 5 ls nda Eee vlc corpo Vs, Crete datoute 187 mel sing m2 resistors and a capac ar shown a Fg 713. Compare ‘here ithhone shown niques and 73. Rasa 7 Pore Chatman i Pmonuen 7.9 Ran the benchmarking cates fom Scion 74 baths time Lawerthe nfoece peed onplinde enor oie les, Wha oer hs do ‘he performance ofthe sori conta? PROBLEM 7.4 The diferent kinds of senor model develope secon wereays comedies the mecha sem. Cre ls othe orient pe of sensor modes take he el elo arom ipa ond ‘uu te easy incaed bythe onto. Uig tee ok You ean "iy “han” ects For example, ou cold ed thea veot a a ea “eur ond then jects ion Per fodSenoor bok Then, oucould feed ecto rom he Parsossensor block io @ Quant szedseneor lok wha the overlie veloc sgn, Pron 7.5 Cratea sensor model at odes ely inthe fedbaok lp Pate he Bear ae nd at eo ar dey PRos.en 7.6 Ar we dsused in Scion 7 I into modsing the lon, medelng of enor and acta it nporiant Many of he enor ‘moet preted tha scion con cons te te bere wae To Juror demonste real-world stations, deslop on setae model which ‘satwates a same predetermined lvl (Lex 6 frgue sure tht can only rode specie minima on minum ones pues of he commanded Sole which caver doer hi mga the nals du oma eat evar ond which ces does tale ings wore? 188 AVTRODUCTION TO PHYSICAL MODELING WITH MODELICA moot 1.7 Crt ml of «Mac at mmerily cmt he Uri of ts par Todo iso ma ample he np signal tar incr nd compte fie difownce appa or he ra. de _ wld) ale — 08) a Chapter 8 EXPLORING NONLINEAR BEHAVIOR 81 CONCEPTS “The pita which maelng gets paula imran i when model eo becomes ceasing nner oct tht ls frases simaon ol thang ube, None bbar bard o toi in el wo niodl, The examples thi caper wl nrodace sone ‘he aproaches ued dexebe nat bebvoe 82. ANIDEALDIODE, ‘We gin our examples wih an eal decal de. This example ino aces fl preterit cig in poling pow linear yen. 82.1 Mathematical background Inowderto understand paranteronehrigse, memos est examine ‘ne rblem hat ests tacigu een. Coser he allowing ie ay Incndeto gabe nderanting oo an el ode bebe, conlder ‘he papi presentation of Euston (1) shown in igure 1. The thie line represents pe ates of he ede, What ales sch bebe diel ‘ode caret cat be we oer ofthe vee ao te ole cant be wnt tof cue. In mathemati tems, he ‘Seni st 2 proper anton of te vlae andthe volgen proper ‘mono te cet. 180 mopucrIw To PHYSICAL MODELING WH MODELICA “Thien uso tcigu whic lon to werk aod eae ae ‘ner a, 193, Speiealy; we mt oxpess he tevin praneticaly interme of aoe vr Let weal the permet varie. The ‘aril mst be chosen soc hat he comet a he volage can bath be ‘rien ex in ee of Ta tht way. the sn of he de eco wavs function f+ One way oper hs maping 10 cone © tobe the diance slog the carve thn in Fig ing a ec, “Matematica we can hen wie volage anderen inter slows: o={o iss 62 eft SS a ‘ne api, a grapia representations sometines asi odes Fg ‘ue 2 tows the wliage nd cure pled with respect, 822 Model description Now we must wasne Egon (82) and (8.3) foto Malia cote. It tars ot that by reasing the One Por pata mel om Example 1, an wets ode! new nes ash in Exam "Noe tour IeaDiode model con vo tral aes, «and ‘pen. The 2 vale sour parame varie sed as he independent ‘abi in Figure 82. The varie open represen which art of the cue pling None Behavior 191 we 82 Cares rc it ote pei, we are on a Figure open is rue, thn eset be voltage dep ‘ros te dee arizona ine in Figue 1). One thera ifopen {Eatae thea 6 epresets the caren ow toh be ode (he ete ea Fe), Asa esa achange in open erent fandamenal Dba ‘igen the mol ana deta about tee Kind of eee changes ‘Sn bound atria Svton 8.63, ‘Bow pall ne oth 823 Sample circuit Figur 8.3 shows the sehemaic of an aerating cure (AC) to de ‘amen (DO) pone spp. After the AC lage hia ten sep down ing ‘Staafomer, te oes testo ret he resling AC gal ante ples 192 WymoDUCTION 70 PHYSICAL MODELING WIT MODELICA ‘nt esl oh tcton ae dpe out by a estrone ‘hpi wed 0 comes the lal te power sup. gue 84 shor the re of simulating ths stm for one econ. The op lo shows he ‘pple os, Vy he mile et he voltae 2089 ea Vind Adib botoes lt hows the sate fhe wich omer Supey Load Device os ra ed c= tes eee 2 Stemi DC pe y ip Naina Behavior 188 ite resin Piguet othe sang system of DA when ‘aval index for Seti e Maton od Sev 193). Forti eson, The eal de model nthe MSL tance tt ito eed 83 BACKLASH ‘A conmon ninety ntadocod whenbaiing mechanical mods isthe repent of bts, Baclsh cn ocr in th tional and wan Iona! ystems acan be np fet oe any ype of meshes Inael We wl sete tw aprons to handing te tucks problem nd locas te avuntages ad deavantge fb appoachs 8.3.1 Non-linear spring approach "The int approach 0 conser i cle he "ose spring appre “Ths appnach moles inplemening seas witha oc displace ce lke oe shown a Faure 8. vet L ‘tent ‘One ting oot abou the cei in Figure 83 is the fat hat sal resance ne ws pac sre wh he ide Tis was one Bea Sinvlaon ot anabve dif moehg Weal componsas, Foren, gee 3, Sos phn hci ah “Te abc bind hs approach to implement a ring” tht exe nofece mt ufcet angune plement oc sch ht tee 0 ore "eeklch in th tem. Att ps he pig becomes sil (conesponng tote cision of two Hh oie) an he ro pl bes "bouce™ ava) from each cc, ‘These collson lat be modeled spect ease th etefoesSanping em sully aed as well, ‘The eqn for he 196 pymRoDUCTON To PINSICAL MODELING rH MODELICA {ore between he wo cling odie i lost) 44s a ° ra eles) +45 wr he angular delet eos the Haka compen, ithe ‘inount f tks, he ping constant al is te damping coef ample 82 shows a mail fo sohbet weigh | Fitweeer Beat Sco *Danpiog acettseiont™ [isis euice anpteteoety we (UNE. setpet sats | prwereanyraien |S PLSIS Sopa eetoora eee sit pal Solos oe | ES PSE, ’ sé fee “Eee Rontn gta mi ‘The dewback of hie apresh i tht he system of equations becomes ery” whe cnt made Thi i a eee fr several reasons Fist the sem of eqns ean tacoma and time coming To robe. Secon, polanged conact wil ein pert, hen ‘ronal response. Ulimaey he mse maybe damped out but could ‘Sse rolutnens problem wih he model aly nt aces ea) {olow exc athe ome id Gaping poperies of be cain Taierls we. In howe ce, Boones el comely care De Smamics 83.2 Coefficient of restitution approach ‘The cof of esuton approach, made a Example 83. avis he ‘oblems with est png, Tele behind te Back aBhCOR nodes pling Noaear Btn 198 TER emusocolse recognise he oi which te colin occas, compat ow mach oe ‘uml belt (teine hy he eet of este) and eee the vlc of he two caliing Sedillo (k= Kh)in +h Kor atteo, reas 6 (= KI) ++ Kon outtg = GaKiethotk ag ber epee rotons velo repens tional inn an Ki the cocci o eitaon. This aisen tthe angular veo is done ina sngle sep by using the reins oper (Le, the malo des tot erp to ee te dynamics of he eallson) so the ume! ses ae toed. Prolonged contact of th vo ods cn sl be a rob at hs mb overoome fas we greouly showed with he Bouncing bal model a Example 79, "he roblem wih the cet of resin model tht egies laowalge ofthe effec erin ofeach by ‘This ent someting ‘Single model can sw becuse is posible a adios! ei re sly toned be bckash model, Tes ig connections change effective Ines fhe Bodies and make the tera moment alton income. 196 INTRODUCTION TO PINSICAL MODELING Witt MODELICA en wore ie the cas where maple Inns ce connected by aie {ties tee the eee nea of he ase cng depending 2 {he crertste ofeach, Tox plcer tarde on these fhe mode {o mas sr te conet abe forthe elective lea are ocho provid ‘ruth inteting thing ot sou the BacKLAsTCOR mode i he ‘actin rein operatr can only be apd toa ible which ha id thee epertor apd wit. The varies al anda are dunn vara Inced so thr rest could be applied fo wi and wa! aly. te [Pre opeao os wed ee Seton 7.52 for fuer dels wo eee the rou veloies por he also, 833 Comparison Letus doa qk comparion of bth of hes apposite 6 hows ‘ne schermalic eon esta whet tee ae tones and both ae dey oe one tckath dl, We weer to his ase Wwo ine ce Fovthe nest case anata ieria ed, Tis aw nea lly ‘Soon vu an del on ih gearat f1 Yo oe ofthe pein {Sens We weal hth "ce neta” ease. Te vas ofthe rerio ‘ve jst sot he wo cae Le he two and ie iia case) ae Filly sews In oer wor te effective nia on Doth ses of he (kin te sane in Bote, wet torque —_backlashet.e5 12 ye webu he hi. lrg Nance Bibvor 197 “The poles for our BackLAsiCOR model i at ads 1 koow the atten eri abot ft comson ps, 25th ae of nea ‘Sry coaeced tt Foe the" pera ease, We ae eral hose toned nly the ae ofthe nes diel connected dhe bah nd tote inet conosco the gear Thi meas) estat male Tecate iis nt asesly von omebody alg such a schema ‘atthe fete nei raed oro fo cael Tis Bea at Cskslaon depends nthe gptons cone wiih vias component. Insummary, een though we ate ade is erecta ii the kd fro that mae cas by soe. oe Cs hr bee ; jot | io} Essai Jeol a tek a fp th Compton fin le chem pe ‘The tp plot in Figure 88 shows the angular poston of he second nei 12, for both the "wo ner” and "res ies eases sing both bach Inodels. Arne can se from dill he mdse the coret answer rep fort coeliclen of estiston model sing the iets. This ec ‘tte ht the con of etoton model lee robust a be ee Spring apeoch because oq the wert cally make sre Hate «dn given tothe bcknth motel Le he efestve eta ot bathe of he ‘kl x conse withthe phycal canter osha. Sch Staton ae avays woubsone and shud be wed 198 lvmopUCTIONTo PursICU. MODELING wir MODELICA “Tne oto plot in Figure 8 stows the angular velocity of es nei 13, ing both lsh el in th wo nei esse. This plot dere ster an interesting propery ofthe diferent slaton methods. "The ds line inate the cect of eon mote for the "wo eta” ese [Noe the abrapcnges he sot. Tae ampere esl o sig te roinit operat Let fot onthe cls, Note how bot saan the btn ‘of Figure 88 ae enc! up encl he Sie colin oer. The cece ‘of retitinn mods jompe immediatly 1 2 se ale hen te colision ‘scr The none ring motel nes 2 ite oun of ine 0 ree the colin, "Te dfeete h odls ae fdeteyfor he none ‘pring model. Tis lay scutes teach colin. ‘The sont ofthe deny i ela to he ses of the ing The mens hrf you chose ties ae bly, ou wl pet an ay iy, Tis Mghlighs oe of the devils ofthe non nea png npOAER Syciealy the mod rege yout eat the cling Weds "ery SUP The problem show very sf, Ar we be en, he ae ‘hose fete aes wil wake some ference nh aon shold te chosen crf. Th aber denubac of te specach tt in rer he ser you mate the png, the longer wl ks the smastion 1 | ‘Slt te calisn. 834 Summary and future directions _Asponedoutinourdscuson of all sadly te on csp roach a th fete hi on eat eet areal silts nation may not ery to mee the eolane an ain aes {forthe nurs ved On th te ban, he en appeach VS ‘ton problems tt wil ot werk comet fone of te nein ome 0 {he hackle model i igily cones to nar nei. I si connec ‘> sbatted fori emmectons hen unstable igh equency mes wi appese ‘Aca roi te best approach camel sve for modeling bach it todoe the anna pang apache i genera ene 0 Radel ‘ae and is ott. Homer thes props cen being foul fer an exrson wo the Maslin mnling Ingange which weal inode "he sity to model colons wing puis. This woul prove 2 gee ‘obs ad compautionally ef apooach tO moving bakes ond ‘ever phenomena, ou ate inereed nelle Hk backlash check ‘sth Malis Assoion oid ou when sch imple dings ily {ote eae and wher st will beste ou pling Maca Behavior 198 84 THERMAL PROPERTIES 841 Background a Soto 63, we decibal how a simple het wanfer sytem can be modeled in Mode. In ths sein, we wl show bow to itredie nn Tne herma ropetis ina heat ans novel ‘By aplying comer of energy 4» ooo volume we ave tthe fetowing etn: Efmnere[ ins an where uf) srt te specif intra cory of he miter! win the Volume V- Ife sume a tbe dent and tempered tay ove he ‘olume tea wecan sip Equation (7 0 Bi f J-nas as : ce i ae ee get to 9) No ht Baton 5) dos opel ten a suthsti ne en ns ose ering ofl States oe eps pei ase he owing ‘Snip ves pc logy nd epee sor: ain T < 10m ven ={ sm saith SF SI00 a Sour ssid | 100 7 Sto 200 ivTRoDUCTION TO PHYSICAL MODELING WITH MODELICA Figure 89 shows a pot fw a2 anton oF. Since (7) in ined be {Eee of se eral ene. mh spect 1 eperatise, me Bd thar fr our nowliner mati bse on Equation (89), wou be: wo: mms 7 <1000 est) ={ ooo + 1000s 7 < 1100 0) mo) uM 7 <2000 ‘ne impo hing ot tote mati popes own in Eauatons (Boy oy ar hey ee ote temperate ge 200K © Shenk 842 Creating thermal property model ‘Gresing pope sie involves encpsxing Bain 8.) into 2 Mosse mode Since aie faerie have ferent pei Ltrs NS Staton Sxample shows ow we con define parti mode ‘caper tbe euece of wat prope model consis of fat nae acter oad aneironereosel Taupe A ltl ope i ‘Banpic 6.5 shows ow we ca atarethe speci itera eng reaion shipin Eston (8.9), Note that Example 85 ubesthe ase ( funtion © Seeman popery deli eda aiden Ite simesed ohn TTS to sly te contol expreion Inside te ase () fetion ‘veatn sneer ecco and the meme provide inthe ase (fc ttn imocaton wil be ge as a eaplanaton, The ait to impos ch teicionsand resets mesningmessage when try arated impo {Ein creating rots sro. Tn aon ce ht 2a ves ave ben povided fo Both nd = nBeample 83 This vay ood en when bling nowtnesr modes Remcmbes he stare ie est gues shot what a easonshle vale Iga be le t provides the lira od nial 8) ‘Xai ope of Example a iso repeseied ab a boek I coe me a idee te eperatae an specimens enerty Pept orenpt ef te mel. Tisallows the mode oud ithe SShesptieequaon forest fT or aan impli eqn fr ‘afm of ‘pln ova Betvor 201 ea | ot shertarepnst to: ‘Bowie Agee ra py 843 Modeling non-linear thermal capacitance Example 8 cefns our mail propery evr tet ow we MUS WE ‘twine cnet of nnn epense mel Example 6 shows {nowtnear vernon othe eal cpaance model found inthe Thersa lage Ea. | “Ear R& Aso in teal pc ma “Tas ae seve interes hing poi ou abut the elarion of the rope tod Fir the deciaraton replaceable whch allow 8 086 erat of property adel wah apne model, ‘Secon ae te modenton Ten. har bra appli he Prope comport Tismoieten eet a enon Jo i ea aed the line : 292 INmRoDLCTIN To PHYSICAL MODELING WIT MODELICA tothe equation ton ofthe model. i cofen filo pei egos in ths ay boca the pletion othe equation appt ls 10 the apo test hey molly. The ceatvatage of udng a eqation component ‘elation ha itis easy fe abut sich eu bese de J 0 pear expcly an eqacion sein 844 Simulating stiification ‘Now we wih combine the ptf ater! roertyelsionship defined lnExample 8 wih geneal near erence el own Example Rf. The mater! proper lain defied in Example 83s im teen been te seep regione won 000K a 200K repress the tan fem sod stew hide ‘igor thera suet; JSR cient etarcntioe Sastre ‘awed Aratcmgne fom ga sample isnt the 7PecbLent el om ample 615 wih ‘few import difences. Fist the hema cpsctance model show i ‘ample sual othe segmens of there Inadtog, he mel esti ‘pling Nonna Bekavor 203 del contained ia th thermal package. Fly he ound condtons fori problem hive changed The fet end is now ada Le no bet ‘tm andthe ight nd ha comectve boundary conden acid The ress of rong the sma ae shown in Figae 8.10. The ple shows a srs of tempera caves fasion flonan! istnee| log th for various ies dig te slieon. Te dicot in {te slope of he mperte carve beveen ID0DK and 100K saat of the onli propeny flap The clase reference forts ype of probe is (Stefan, 1891) = Sece=s ewe 810. Tempra sn 56 yeghaear enin ep 8S HODGKIN-HUXLEY NERVE CELL MODELS ‘ne of temo iterestngnontaer models I ave seni te Hin Husky model oe Hodghinané Huse, 182). Ths model ose fo snol ingle acy of rere cel, wate bass fr avaring Hod and inlet Notel Pz in 1953. We wil only pen acu enon ‘ofthe ahora hie model A ore detailed explanation canbe oan ‘Bower and Heenan, 950, 2 INTRODUCTION TO PHYSICAL MODELING WIT! MODELICA 85.1 Background “Thebans model tht leas of so and pots move scion be membrane of pers cel Beets tee molec vi they ly wh ena ect change. Asa esl, he moto of hese moles SSauTinn cecal cent soap be membrane ofthe cell which hen ‘Shscr achmge nthe vlagedifeance acts he nembrae. The motion of fhe sodium an puss an ir goveed by kon chanel in he membrane ‘ta The anton evel of then chanels reece by 2 el mer Tewen 0 (completly com sd 1 (completely open), Rather than having "Ete conde he omdictnce oe fon chants eine by ‘afer eno which depends on volage op aero the membrane hu the cata evel of th lon hae. 85.2 Cireit model we I, Nene cg ene. ‘ig 8.11 shows an ele scemate of ner cel, The purpose of ho adlito pedis he cnnpes in olape cose mena of ne ‘Bilin sponse th injection of peo caret The non-linear evr Sree ine nerve cl non mith th ime sale vaio in he SRS enc ype of ion tae anes Actas Inthe oagE ESS tiecell mnie ‘gre 612 sows the volags, cent and chanel senton evel 8 funslosa defor chemat torn a gue 3.11. Note how te wage nlring Noni ehvor 205 ies exponse ote lected cet andthe eaves fer the cues ‘eka ar oped “h complete mode frie cit show igre 6.11 nde on te compasion CD-ROM. However to pve a sample of the pe of quston ‘So we wl ade some dacs fh soe chanel model. The con ‘dvs. Gof the dum chanel ir eerised byte floving eq: au = ome SH on w= bey oy om = te ny m-- 55) Oy = ee ay T= sooo) A) as sh = 100(¢q(1~m) my) 16 G = mhACns an where m ante iter ativan Keele membrane area and Ge | Ste macimur oduct the sim hae ‘sig these equine we can implement the sodium chaenel model ia Modena flow loro Rodghstntey.A632s¥oeage Vane, Y bei Sei fester nsttacage cue, os: Sedpashnney atasvoieage #21000) ban eenndeuontathcem ths 0/2 SDS astite nadir eng tie San 0001 206 prrRODUCTION To PHYSICAL MODELING WIT NODELICA ‘out ecole of his mode! in pespecte, compe itt th eso ‘neal howe Branple32. Tr i LM Powe 12. Dyan aan fe il 86 LANGUAGE FUNDAMENTALS Nonfnear motels ae fen sequed for pata engineering sna ‘There tis importa to be able o represen sch oer and ve {eh able whch re capable of snuting highly poles pens Let (summarise of the impose apts of te Modeling that ‘Spon the reton of nonsee modes 86.1 Parametric formulation xumple 81 wed a ectniqie tat pramterizs oleae terms ofan neem yrble This cig Is gute weil whes you hve ‘ehtonstie beweontrugh ad coe abs ht apm be expres {ng asinple incon restos. ‘Me ow (egy inthe Zéaaitode model) how anf satereat or Sf expression an be te contrat anton hich compat he Brough nd ‘Slovo iflent eines of evi Its import when ne {ramet formulations oak re tat be tough nd across erable can [tapes conus neon oft ered aah lrg Kiker Bebvior 207 862 Behavioral changes As we have sen (the Tease mel from Example! sd the SinplePropereytode) ioe rom Example 8) the presence of cieran if expeston ora fst can ned bevel change “Thema obvious eet at he adel contining an semen ei apts hs vote nodes of aera a thee 0 Ines provide acondouous deci of behave, For eam th epee Inter eory shown in Example Sia continue fncton oF een oop i contains an Fst Witt ti cootinty fee wood ly ‘eminem ‘The more sae fet, inode ty the presence of conioa expes sions, ithe eon of tent dsr prevoyn Section? 3.4 Let 1s conie the Tdea Dade model in Example Noe hat Bootes Vale wa neces t rope the te ofthe doe This lowed he ‘ofl tobe exessed wih only sgl conde exes, asta, ‘sea writen he model a ‘einer in soe ey. Te reson ht hen ve woud ve ‘wo contol xpresins, We an lying a ae exeson at ‘eye ee. However fr mer aso we came Bare ena il cognate ‘ese ro onion eres ett inked we hn 99 ye sr ate Naa ngs aed ye ol "Speston topen ese nner wo, esl ‘tein ht he connexon rl compte» comes Se Sie befor (ose the codons expesion wed to Compe Tat ‘ul lado ces when solving a prelem. The open vas i the ‘Hdeaabicde adel wa id sate te er nso "cs cv wc eyes te need ‘4: ingle conto exeson However Saye oy oo ‘ie equ condo xen tests ey te maken ‘ran butte pt mse nonencaly equ, Fx ag Chapter 10 /MULTI-DOMAIN MODELING 10.1 CONCEPTS “Ti terpenes mln sytem del. Maka nal re shared ty he fact ha thy hve corponents belong 0 «ty ofcomponents Sch propugaon edt pra ese of component In sone cas, te methods cxrbed in Seton 43-2 we not scent In ‘hs section, we wl deserts how to re dame scoping 6 anomaly ‘ssh connections between ddaed conporeat and hi sanding 912.1 Parlor and feds ‘Tounderstand what dynamic scoping i and why ie et ws coir ‘te cane alt ol pres geval Blah cae each pce meds o Snow the gravtonlacclrtion the parle cues Tocton "The mos coneiet yt expres och nfermaon iby ing | ‘enction, For simsltins ince Gnersonal space, he functioe Sod teasbope ofthe aeavityeeld function shawn a Example ageing tesa wae 218 IvrRODUCTION TO PHYSICAL MODELING WIT! MODELICA mally, import i ony clean fr searing, whch mean i does sot actly eget pote brary f wich appa. Toate his, siete flowing example set pcireie ” In his example, th ws ofthe Amgor stent i cy welt defiitons ‘Staelin the MyElect ion) pekape and des ox eu ne Setnitons being abled foe HyShece een} pocageherchy 913 Limiting searches Sofa, weave descrid how the earch roceds phe package ienchy. [Normally he seu conic 9 to th Yat ofthe lage ewhy. How ‘rer insecure may nt wih allow defn 0 Be ed beyond a ‘run pam int icerchy, ov exampl, we may Wish 0 ea pacage ‘thos tt can been renewed he pckage each. Tovdestand Thc msds he following example “The diay hee ssa he Banu model requires the gros ‘Sst fied in package racy (esember, costs can be ‘eesed rough on apckag erry oan inane hry), Ta oe to beable to move ths ode cui ofthe Test Problens package, We ‘ald needa define g within he Pendulum mode Tn tiscase, ean tose that we wl have problems ety tome the penduttenmolet tnmoreconpes cyte Had ose iia ‘en Fah een, be dela Inguage incl the encopoulat gail Te ecto the oncapaated slr isto sop he serch fom | {ong beyond he boundary ofthe encepeted dentin I we wre ou Pondulum example as flo een Teeth 8 oeson of ‘These fr g willbe esearch cannot go beyond ie encapeutaee sodel By using ite encaprtod uae, we cane a carent a ng refeences an prevent inrecing a i te fe “The ancapeulated key Wor aly prevent the sec fm proceeding up tte pachage Hea. doce not ews of ipo en any ‘i So,to mule cur Pend um model nepenen of he Toot Problems lage, we soul weit fll: Page Testor °A collgction of tees ea gach ee reac, 8.14 Making defistion local aterthan searching up ugh the Mercy a Wee beading, here sce aver ways to me a defini local so we do noc ee seach rough ‘Ge earchy frit A snpleexmple of hs mole ing Preate 216 mRODUCTION TO PHYSICALMODELING Wir NODELICA Using tie ule, us examine sever wap we might go abou reteclag the ort conocer dfniton. Fe ve cold se ane tt las cach ockage hit the or defines is etd lof, ey Ferien. the seach consists of looking forthe Pneumatic package and Tie once at fond, linge oe dein of be Znees Face package and if tat ese nally ssid tht fo the Port defiton. Th ther ore te serch alvays fr the cnet defn. So, we sat {tear cnet faa in th erry (ce witha the Valve mode and earch fort denon for Pauiae . Since cant he found athe ‘ren posto, te mes then lok nthe seat lhe evel of th rch (Gey the una package el, There no dion fr Paeumnat Le ‘ith the Daou package oly we ave tthe ot. Ae oD Ire dt deo for Esunat Se and intr cols the defo Toe SntesEacee and Port tht we ae seeing! In this case, te seach sscsod ‘Now: tw cone anaher ce, We could also wet carol in his Now, we re lookng fo the defn of someting called Interfaces and (recipe find te dfn of something alled Foxe isi ha Sang {tie Valve model, we ind no defatos fer Interfaces. So, we melo the Pneunat ce package wich doe coatan a defn for Interfaces thin tm contin eition fr Boxe. So spi, he search soced ‘Once ine dfn of oe et componen ns compose ses od if «teenage components inthe name carl e loced nse the dino ‘ofthe fa component, he seach fe In er werd the seach wl at Moen 207 cemtnu pte hcarchy to fn et ater nition forthe Ses compones| ‘nthe mune that nigh coatain the near stzompenen dein. For ‘ample Imagine we ae seucing othe deaan of Tnteraceo Port Bang rm we fd ag cl Terence. Swe beck Sesion for fore canbe found inte et the earch als Te ‘euch dos mot cate looking fran alemae defition of Interfaces, fare along he earch. tha does ofan a defiton fr Pore 94.12 Searching ether loeatons “The nal seach pte eo search yp th package Mercy wt the root the pckage icy is each andi he Sinton set oud thea toe seach fe Tere a way fo nee ec oa her packages swell: For thes cae, we te the impor heyword. Recall fiom pious Secon hw We wed spore fo stone he meso yea P68. Teper ntclen tenis ‘As imponantresictonn Saport semen ht theme ofthe dein ‘ing tng must es uly quale mame (ce, te ae fhe iin ‘ee tbe tp the package rch, Futbemore, he defnton being Impede defied wins package Ti he seach comes acres an Spore tet in any af the packages it ‘searching, the imported pkg scared os fon sppested at ‘te lean ofthe tnport statement. Sometime, he me of he pore HE ¢ Fin, west esl he geometry of he House mode, Let ws sane statortioune sen oefloeranth oer seals ghey he oot pine Mamet Modeing 237 panei We asune «dei of 250 square mete In akon, we mas [oe the noth ofthe house. Fri, we ase a fat oF 4 mete (ar lst sampsion i tht the foto he House aque. We cs then compute sure are fhe surnding wl thera ee Aor ‘tet om he gen prance. Iman, we can compute vohime of ‘he hou ae wel fom hse ae pres, ‘Once me have established the tome a house, we ext conse te ‘tema nea of be hose, The ternal nei i fe aminuts the Tener of he ows fo every tof Ret we generate om ue ce Frthiwe ie the Capacitance mods fame Therma) any wbich issmilar thon shown inthe Thermal Capacitance model in ape (12 Thimodsl gure pecs fiformton. The ts the volume of ‘he hots, wich wesley kno from cur geomet paar, Te sera Isthedesiy of he apse be hose, whch weassumeta be 1 km ly, he specif heat capacity af thea asus be 100 J). By wing snl agence o represen the en oa we ae ingly ‘teuning tha ects hus hs asnge nfo epee, "Net, we tm our anton tothe roo ofthe House We assume thatthe primary mode of eat nee forte oo dation We sme nlc Keipratre thc be oat antes to ie envionment Tis eete Temperate changes om diy to igh ad erfore we have wed ial Wok ro generac ts temperature, which thn used Yo establish tea ear conden forthe sky. This baotay conto en athe he hoe ough a ck body ration compose. "We ow tam our ateia wo the for eho, We ase ht some heat set vin confusion hough te foot the rund. Or deft vate fer thermal condctviy ofthe pound 04 Witt). Fuser, we ‘sume hat he pound ampere ers low the sua 250K "aly teeny mode of et wanfr le conection. We assume that tis isthe dominac mode ef het unser agh te walls fe owe, Js "ke wit he eo model, we neo fae an ten ai temperate for he ‘uecton,Wesssun tal he ambient air tempeie peed exer “The dtm vale forte hes antec of te wale wa bomen ob $5370. "suri rs el heal model of Ao batt deers how aft comple model can be contracted wing eng noe tenn pot me ca me an oe agian hl 238 INTRODUCTION TO PHYSICAL MODELING WITH MODELICA 1033 Furnace ovce tat the schematic ofthe House model hovel gure 107 inches ny cvienment fact, tn ober wor, hcl est eaters eo 1 sorouning ital ifloences were elected. In nr ede the Inene of nel fumace, we must ula Furnace moll nd coe {rote bewe, Fpae 108 shors schema o he Furnace wed inthis G) Heating Circuit Rowe 108 Shaft Parcel ‘The rurnace moll cnt 8 hal nee aban det Inert. To theron comet coe ef tebe that teeny peste free nfm eenperate o he hse ‘eon nrc, ihr compel feo eee ls P 208 ‘Pused uu frm ono oP eso tehefureeo oell om om be teem tah we wil be sb He hemo ‘Sc tect y comeing th vo cc pn and he aac Simm on Whew te pw at Senne he fomae il tof. We hone he apy oe face she an of eel owe con oct) pe by hn capscsty pet The msn ear Mats Donn Modan 239 of the Puznace model i th ren hgh ts ad or neti hem nents lage an lel compose ‘The Fumace is composed af wo celts One I the sensor cet which is eamecta oe hemo onde wheter the free oll Be o | od. The ober cit ap power et (Ros es ou Would at ‘Soon othe oper, all mouse vie like hemos). The teidge etwen hese cals sal ly. thigh power cent comais the HeaterElonent model fom he Theemal ary fe wed toh 3 ‘alerts sso of tral oe 103.4 ‘Thermostat As mewtoned carer, when desing the Furnace mode theme inode sequen oe conte te Prnace. Model foro diet ‘apes of hermosa wl be eet. One mode she tata mechanical ‘Seema and he oes modem dl hemos Looking sth pes ‘Simeresing erase we toh re naomi devices th) mix lect tof dams, 103.41 Mechanica thrmestat Figur 109 shows a acematic of 3 mechanical terse. Ton mechanical hemos come by trig dal on the ouside fe "Rem onde th deed temerutnie he owe. Inter wes, (ewer mera is mechan es they somthing) trl temper sesve mechani componente we ands he oie [erature changes, te nel mestonton moves. Tas moveneat is efeted fete epee eding give byte hemos Inourachanicalthernoctat mode the pina which he fumace sos be timed on is given a tener Sti speling, sould te ‘ven he angular posto ofthe heost dl bt hi sinplienton bs fen made oa th ational complet of modeling te conta mec ti. Intnl, ence the dese tompert is provid ia the dea red Frrameter a nal elaionf made Yo detenine the rotonal ge ‘hich oresponds that empath dl eng). ‘Theschematicin Figure 10.9 conains ever nteworthy components. Fist there the epee sent rottnalsrng. Tc be Heated by the fact tht fa bot tana nd tel eaoestoae The tthe lenin ofthe spring changes a uncon of tnperate. Since the nein the mestaism sal test hanes in wnsteched lng esata "heady medi change nthe poston ofthe various composes of he ‘mechan tet compare te ine scl of the them sytem). 160 INTRODUCTIONTO PHYSICAL MODELING WIT MODELICA thermal A damper sista became he coination of the spring a mech nism ner nar igh quency esi te mechaneal Hse. THE Chimera to damp oat hese meses, Ta te inenl mechan nade 2 merry sich, The swith wal tour be fomace co ro When Be swith oie a enue he ‘rer wil mone fm one fo sch ote ter, Anineeting hing {Sse about be swick fic is eset ors aplson na theo) {3a te ich hs hysteressbilft Fr example, sme ta be tmoeay sich tums on hen the temperate goes elo SK. When be ‘Patch tno he mercy moves to oe leo the sich an closes he ‘tanec between wo wes However, when th empties bore SOK te sch des otf. Ita he eperaate ms go ve Sm fe esol eq 908K) before te sith wl tun, Tevet eons ony Sagl tempest deemise he sate of he sw ere ‘old bea gn deal of ter eg igh fen anges in wich ste) Malt Dal Meng 2AL 10342 Dig thermostat In comvast othe mecha ert, We 20 cont bw to mode a gal cemosat Ineresingl cough, even though the domains a ech ogee deed mabe fh sine ae presen bh ue TOl0showsasthomaic of te Digital Thorwostat mole ae coco | ‘Te Digitalthermodt at cms of two compen. The ft ‘temocauple wich tines lenge ferences imo vale, The theme mode! fun inthe Tera ay snes al te Ylage ‘ites compel a pmol ae ors av=Sor on whee AV fs th wage op soe the emocoupe, th ambien fenpearure apd tbe themocoyple end Cis sees of cosets which ‘Se prumees othe temosople model “The athe model wed in the Digital Thermostat moll dl onl cucu Is sumed that be lope of te contol srategy has ‘een enapuled win ts eeu In our ewe, he Digttalcareut 222 IwtRODUCTION To PHYSICAL MODELING WIT MODELICA ol which pesos he git conte has simple sl gorstha seco ‘Thich conti the elisa evi between the frace coat pis. FP el fo tne he velage. dop acres he tamocepl pn, Tp and ‘Tm, In ror th ono jen unto, rms ante the vlage top across the ternal ack lt temperate To 6 Bit ma five sme aneranding the carters (ey the C, enfin) of the temocouple, "This same cece a hfe ved alan wants forthe conoie. 10343 Commonalty ‘Tere are some ineresing pare beeen the dtl and mechani ‘termotate Fr ty bt eq alae, Tae gage oo he ose of the mechanic hemos st be cara asd onthe teal expansion ‘Sartre of he srng ise the theo. Likewise the contol rest ine eg heron mst be peogrammed with he characterises of te Temecoup' respon to tnpertre canes. nisi pilin controls oi some reeset of he lant the pial oye) rxpnse presen ide he cometh ess, the tedlshave been oot in sacha way tl he conraller understanding the phys espns pee” (Le Knows exact what apesig| {nthe pga sytem) Ta gh ny i trea wed fora est tw rls One fear i tht he clans ae ever perfect (eg the ‘refcent ued bythe conta have some emo) The te ek at ‘teste model tthe cole er orepesent be phys te. ‘Shot pert st Staying such rors an what lect tn have when ‘control sytem acta deployed Is an important aspect of modeling ‘seal tems ‘Thectherconmon pect ofthe conta isthereienent forsee sia Te he wechnica stom te hyees genera he pom of ‘te neeury switch Forte dpa tome hysteresis rodced by he ‘si alge 1035 Complete System gue 10.1 shows yom which execs Bath te gia hemos andthe mecha themownt. Fire 10.12 shows the sma temperate inside and outs the howe ‘The devices have tee spin sch a vay "tt tye ental 0 oly one indoor temperature shown. Nowe "ht the foeny with che arac sed eter when the cule ‘emperor bat Doni Moding Fumace 20 244 nernopUcTiN To PHnSICAL MODELING WIM MODELICA 104 AUTOMOTIVE LIBRARY Chaplet motions ery of mates veloped ve ‘while france, Ih etn, we ilesplre ibrary ore deta 10.4.1 SimpleCar package Chassis Engine Examples Interfaces 55 Tests Transmision Types. er) are 018. Pacae se ie Spec is [As we can se in Figure 1013, the Simpler brary conti see nested pchagen, Tes wl be saudi det sony. The eal tare (be facage allows te comments which wl be id tin Caper 12? “The mode cond thi ukage reat single. As ares thet woe capa every Hed However the package provides many ppotuieso ying ou ies Ssgn ns, ar el 8 neering EV Somponen model, 1042 Engine package "The Engine package consis aelseaedto he fusion feel gine Sign purmees repented Wy tes models incl bo, Ts, fale lee ae Ge, 1042.1 Interac Many of he engine component moles we he toa and wasn camacoe fonda Rodel ica Heenan I aldion 0s components ‘face rn par etna, Malden Moding 245 shoutethe One! connector found inSinplacar Interfaces whichis Selned “This connector, wud eres he ste of hs fol mature some ‘str asa becase uke mest of or peviows connector dein, Conte tw srs nd togh vel The aos vara (este els wich Give the yeni he sys) ae presse and tpt fire and whe he trough bls te mate om te, mt, and ea owe. Thaddion the Ga connector define ne several paral mode epresenting ones interes or ens, smn, si eles and ‘Shi These tre sewed in cojnction wit eile modesto al ‘Say replicrmet of model for these sates ah hr moe sng thea erie eqlemens 10422 Basi components igu 10.14 shows wha we find when we open up the SimpLecer. agin -Componnit Hay. "The flowing rata some fe cm vent ul description of te model ed f TimingBelt: The iming tet a vary simple device. The mode fora ‘ming bee sae he model fora gen th zara of Wo, The ming bet do ene he cama teach the sped ofthe ‘rut 1 chanbervolune: Daring the engine co ts mec to clue ‘fe volime ase the combustion amber The Chambe=Vo lume mode ‘sieoponbl forth eclaton. pie aeons lnfooaton spose Jno his model andthe carter sue ian cap. I oreo compu {he vine, te ChanberVolume mit lob conpeed te en ‘tough trl connor in re fo dete te piso poste (Gunn cleiatios of he camer velo. + oranks1ider: The elder mechanism i the engine 6 wed 1 ‘afore anata frente pets atorgu ones 246 IVIRODUCTION 70 PHYSICAL MODELING WITH MODELICA a TT bose Rta dl ma -& Fi é- ei Pe 10.14. Compa of te apne pea 8} <0 Ea || awa lenePLeton: The piston mode ical asolecaPiston te ‘ose we nels he tanto nero he ston ocr analy. The ton model lace the fore so pes inde combustion ‘Shamer wi te fe ppd rm anions comes (esa ‘rondo rn slider mesh, CcontxolVotune: At he cer ofthe themodynamic pres of a0 gin te cote ohne inl the comaion came. In aden tosplyng conrrton of as and evry to the conte of econ ‘elu, hel at i alo ne ara conte equation dese "he rlaonstip between pesre, vets and tempera. The dil ss open model sates pret ge Le, w= ey and = 6). ‘Conbust Lon: The Conbust Son mel sein cur anaes very sim ‘ie Thecombaton poesia alas ecry tse ont [Broun of mast rapped ade th combsion che. The stansneoes ‘at leat, ting conte,egvered by he fling eqn: (40) Mut Donate Moding 247 thet ant rhe star end tines ot combnton proces. These se determined atthe ie that the spk pg es andre ase oh engine Speed and um dure in crank angle depres. Faeroe. Qu it ‘cmine sing te lover heating value of te mre, heal rao ‘te manures the al mse tapped in these ave: The ave model is ed forth na and ext ves The ow though he vale governed the andar eto Horan ‘hip found into (eg, Oa, 97 ‘can: The Cam model computes an destin cam role hat ae on the mana it ofthe vale andthe poston ofthe cant when be "ales intend open and loss ‘throttle The throtle model hi he se desying ow bhava as the engin ae model except that the ttl fw cole ase ‘hot ange ratber han vale ‘Nani fold: Te manifold mode ea siping an-cmpying” mods (Ges no wave dynam). The equations fr the mol col volume tne ihe same the quton aed forthe combustion chamber Reservois: The Resesvot models wed represent the ambient endo (Le amie reer ment spcied peta ad temper). ‘+ bynamoneter: The Dynanometer mode is sed to Bi the sped of| the engine Dynamamete re fen wedi engine testing fo determine the torque ug of he opine The beta ef he Jmammetr est esrb a: "The namometer erates wher ge aise 2 ‘ee the engine ting a specie peed” 10423 Component asembles ‘The Bogtnepacage contin more hn jt comport Kho conti ssemblie of osecomponent The tase poitotitheins ‘Slinger wich composed of he ae component aay deserted. The ‘Ehematic fa ial liner an be sen in igure 1015, isa we sed the components esrb previously build op he mode ofan individ liner shown in Figure 10.15, we an we he nid “liner models o bl up a complete engine” Fo example, a4 yer eine model an be seni Fire 1,6. Each fhe enero sein Figure 10.16 conan the components shown in Figure 1015. 248 WvTRODUCTION TO PHYSICAL MODELING WITH MODELICA we 018. ekg tain em jet SNe we 016 tigi eee 1043 Transmission package rte engine component ol, we bd todevelp quite few new bse components Forte tansnsoe, wan ely mach moran he component found inthe MSL. AS a went, he transaooion phage Is mae wp inal of semis. "Te lve sped tatemision ode addin te Peanwmtveon ack sg ir ey sl, Tepreset the focon aa ve speed ori tan ‘sion in concep! bot assemble inthe sameway asa el atomai ‘anison (eg. he tou comerte as Bsn et ut nd no ini ‘il gsr reas asmaller amber of plana ge). seer of te Ave specd tmsone sho n gu 1017, Using ever ra oae tiny the nde eee the sented pons ofthe anergy ‘syste sed act the cbs. ge 017. Aspnes 10.4.4 Chassis package ‘The Charaia package contin conponcts sed 0 fps he fame snd eapesion ofthe ce A ow very spl cmproent are ude (| ‘Gorm fm Figure 1018). Justa with he tanomsion mde, the chasis 280 INTRODUCTION TO PHYSICAL MODELING WITH MODELICA commonest te the connector defisons and several components fom the Wodeiies. Mechanics package owe 10 Comoe once pce. 1045 Vehicle package Inordeto do veil ee sino (which by a0 meas he ont sof themodel presents eto), we nent binging ase om the oer packager fom complete vee. The pare cnbinaioa wed fer ur aps car example fn Cher shen in Fe 1019. Mat Domain Moen 251 104.6 Applications 10461 Accderitlon aplication In Casper | we described one pose pplication of he dels ested ins secon Special wets the aslo of pot ca roa Bio 100 lense peru. We weed he model son a gre 10.19 95 he ‘eticle inl. One challenge in pting oper soca models staring wt the proper sii eonstone. Chater 13 aces ho To specify the iia tn th cae of aur acelin tte intiiaaton was sapere ‘We stme th te carne it thesis engaged and the eine ‘ning 21500 RPM." Ath moment the simlaton tar, the wonsmision ‘nungs adhe veg to cela, "We weaves clas to deen te ot at which he eile has each 100 omer pr boo. nse the en lee we ae th Cexminace' function top nmin 10462 Dynamameter testing “he vei celeron text sa very nce example tent rene can ‘eit Honea mote coroner nse ik te oes presented in ‘hssetonls eal tess sendy engin performance responses {osimpl rane by connecting he apne to yumometr. Fg 1020 “he psp ofthe et oun he engine aecording some seed pote sac dtemine the torque ote ofthe engine wer hoe eas Sich {est simpliy he elution fh engi ysvdng ease oe oer ‘nbs p, tbe trnsmiion oc) 104.7 Concluding remarks ‘The mode the SimpLeCar package were developed a modeling playground on which pope ein the Modes language cal the "ils. Tere ae ends psn frenkancemet a tiieaton of his Tuy The vehicle modes conn uncon epaceablo components 0 ie incay to makes dosgn modification. or expe a9 teed ade Ile ty balling 26 ender engin to complemen the ede ee ica poised. Ts yin engite cou then Be tnd place of te ‘rating elle engi by rfl the engine component none of he ‘eh models Seto 106 provides several adeng eres rele 0 ‘he modes peed ins sete, 252 inrmopUCTION To PHYSICAL MODELING WPM MODELICA |Z] = ee] ee Pe 1030, oe ee dmnoneei 105 SUMMARY tn mena, we te psn seven exes of tow mined yas cn be fi wing Mdelen in ewe ease most of the models ‘ues weve atalable apn of the MSL. The ait to ba! complex ‘pers ef tet plant aod cntaler adel acs domi powell ‘Thee sed inconunton wih "ystems engine” prose ‘Marae ar) potential plain: or sss ke te oes develop tireapce For cuompe sage ln cde canbe evlpe orth purpose ‘teomt system dope. Ata later stag, he lant models cine reine 0 (fsode nce ere harass eg nna orice) a et {Giey the conte eis the cotext of es lized plan modes “Seah psy woul be fo examine te effet of oie ema and RRSSIe Nein Sesion 14 Fly the obsess of hese te a ‘iad by wy tn pial chance of the pant oe cation ‘Sis nsd in be conte to chek tthe tem performace i extemely mae sigh ato ese pranees Mat Damain Moaing 285 106 PROBLEMS ‘These problems, moreso th he of cided in ter pts. deo tte ay ote rac wa nadia plies ecole {plat modsting, Only afew of te pose comping res ave een ‘eid inion Prone 10.1 Replace te gear models nthe comer Bel wed in he eiemoorcnampevathnon-deal ears hick noc bolash et de To gap bereon the eorteeth). What efec! does his have ont performance (fhe coil ten? PRoRLEA 10.2 Ru the fot contol example and oo at the maxim fotos eu by th coma uring the curt contol design. hen ‘hone te model ofthe vege source 0 athe vole out ofthe cn ers inte some maxima vlog Inia she maxima olge {orth contaler above the msn oe sed and ver that then ‘eradation he performance ete sem, Nex, owl lower he sina Iollage ond obser the change nthe perfomance ofthe cone sem. Sch nwtion ect equ common nade eto ehvior ROBLES 10.3 Evans the ft of ferent crc designs forthe mr. Forcumple wh ihe sfc fading some capctanc othe mor or Ilan peravional ampere oro gn oe ip seal? PRoMLEs 104 Buda 6 elinder engine using the 4 ender eine Pune 10.16 ora pe PROBLEM 10.8 The india lider model carey as ony a ingle lnate and single ext va, Cane am Inde exinder model wih Imre vale oy 0 prove te oveal org op fhe ene. rogue 10.6 Bxomine the fet of he rious dein partes e tote tining ond engine seme) i the clration est The al mode hme fort ectetion wears Sanpe¢as.Sxempies. Race. Chapter 11 BLOCK DIAGRAMS VS. ACAUSAL MODELING 1.1 OBJECTIVE. In thi seson, we wi discs, dtl, the fernces Between he lack Saga and saa apache nrc in Sen 1. “Tere ae seve mls ot sete which exe sen behavior in te tock cians. Aa penton na block agra athe llowing ‘eel foo # = Munn ay y= wee) «ua where epee the opt sig © epee etm sate dy ‘epesenste nyrsignas. Whenconsesedtgether, sshblacksarcapable drepeensing ad smuling lng tem of iret onions (ith he sane gener fom). Bleck digas ewe in dering the mies behavior be tind dynamite. For exemple, the lasban te f and 9 fants ‘a be wed to deine he ols, iro and overal ttf for Tiara stem Tn adn lock gre at paral well ed fo ‘describing contol sytem sac. ower or dscbing ls motel physical yen bhava tack i a fruition ake more wad cate an eae ha ol dels Model en be wed for Both approaches tt nde nding of which ppoac is ore appropri wl edo more ecient model deel pment This chp tempo demons soe the Key difereee n these to approaches “Throughout hs chapter, we il eth mechani ytem shown in Fige 111 owes eal, 2001 6 demonstrate bo lock grams and acta 256 NIRODUCTIONTO PHYSICAL MODELING WITH MODELICA _ () Cartier v = Pe ae él san | = cad ‘atio=100'50 a ge 12, Oma pcr wit et he roaches, We une aed behave fr th components. Force, (fe tehanvofthe nein inPigar is esrb te lowing een: Ja : ay where J the moms of inn the angular veo the shat a + Ft qu applied othe a Partermor the plant ar behaves creed bythe allowing entios $6 # R= $0) aa % aus nent a wre i he oof ing gear et osm pear eth, the aguler Foston ofthe ing the angular poston ofthe ci, the ang Poston o te sus the frque on he ig gear Yi te toque one “aera an ete torque onthe ange. ven hngh we ae horn spl bebvioal eqns, we wil how tha ‘he poem sacl mor comple thn might Es apes. 112 BLOCK DIAGRAMS Tn Section 1.1, fat nrodced hbo lara apyosch and showed stlok gr of spl cone sjtem. The Medel fentres exe 10 Plc gran Asn Moding 257 developlock gram componets wee ten presentain Section 3.4. Fal Egan 11-1) nd (112) sbow te geal forth equation ofboth Inia ook ad complet book gra ‘Thebloc diagram sproch ir an elem way of ersetng thematic ‘echnie beau i mpl and xy fo understant adion ck ‘dag of syste ie god for andersandng the atest ste ‘tthe problem, Mathematical oper sacha los, mulation sn Integration appearerlichy noha. Tesesystems rere intine tog bem eben exp Ssrbed 11.21 Problem statement Tnonderto understands fhe drbsck ofthe Hock lag apo, le onst a mode ofthe sytem shown igre 11, The est ep baifing «Sock dagen model eying wis veal ae Know nd ‘ht anaes eed oe computed. "The fc ha hs pote complted ir senor since we wood keto ee whatever mode we cet forthe mechan shown Fig 1.1 forte ince conte whee oe et of varies moved the sane nt whats known ar uno i difee), Having to mae a pri dios ‘Shout wht willbe known and wba il be unknown before we ul te mode Nm he eat ofthe mel Because spun wil iby come bag which oat bese a pro sumptions Fo thee bn, ume we isto apy aoe oh sha on the eft and aes terine the pston vel and acelin of th Shaftom te gh. Figure 112 sowe ache forthe melanism lng ith actutr oie te System el easly 11.22 Problem formulation Ate poim, we hve ets what the Beha equion ar. ie known and wh! tobe compat. were, sil hve 3 i rca work sbeat of. While we tow the equ eng applied oo he ie he staf got sft js apy Eaton (1.3) 0 compe te ‘ection ofthe driven sat Toe compte he motion of he hh ‘term a secu the efletive nets of the oval mechan. “Ti ighghts he second deadntge of block agra ornalaons [Nene some mathematica manipula s ecesary ofthe po Jem ie, detving amequntion eet yn tems of The ft se toundeand the fest of grounding the caer ear I we assume tal {aon the entices forte platy gear Equation (1.8), canbe +R = 0 an 258 INTRODUCTION TO PHYSICAL MODELING WITH MODELICA groundeo ogi pote A a a ae sie ‘Now we mst cone he ans which desert he etulr afte two ‘hate Ji = aon au Jin = te as) ‘Let tinint yang Equant (1) which eee wit: Joy = ane cus0) Sion = Be aun “Trfoe mit nds, or cae ye gastos is Jn = nn an Jay = = Rr, a1) f+Rh = 0 ane Carnet robles ta we have equtins icvng daa fo Rec tat what we ely want o compote. Ise malpy Ego (1112) ‘Rad then aio Eaton (113) we ae le wits te falowing egpaton= aor Ry = Bn aus) bt Rb = 0 a6) ek Diprons 4. Arta Medelng 259 ‘This allows us to ge io al eee 1 Now we Nou Ket ae th fo reming eqns and we thn 12 sevclop an etn fe a. In ede ose thse eutons we mst wate Imexpliat equation for which we cn thn itt we ose for fo. ‘Wenre alms ihe except at Egon (115) il conan ference toy. By diferentatng Eguaton (1-16) ie we can wy ine | Bn “RATE ‘rom Equation (1.17) we tate ste inet, forthe sytem ‘hero tre ever acelin a= aun cu Bhth E Now tat we can salve fry yen, We an 9 back an se te feowing equations ose forthe ato gest rand the onl ‘ely efter sha, andthe nul oon the dive hf ‘ing ts olowing equa aeee tum oi = wee fin an 1123 Block diagrams After fraiting the problem, we can conte our Mock dara. The singram cn be sone gue 113 Anather elect common abered with bok gras ithe catego ree ales among may compen. ‘Three tvelandarenal parma the esha: JL a2, Noe, in Figut 113. now ane preter seared in mle places. No ale sbjet in Figue 1.3 sin repesets, or example, te pln ges Inseaehe efecs the peta gears ae seein vitally vey compen ‘This satesig of pursater cn ase obese ad manne pele Decne it becomes peer 1 ere ta he sme eS Bang ed onsite everywhere tbe preter appears 11.24 Initia conditions igure 11.3 conan hee iegato leks A render iepate the system feu west (4) ad a). How 6 we ‘Aeonine wha the inl eondtons othse anteshowl be? pete PZ as Sere, ose Wael yoo ‘ve sige cei when nt) nd ot) no, ht by dito ion 1 10, a sna) = wt) ou tua scone tt reemale as wae od fps cal‘ och cs at format a Te no te ny tr neon cor nl gees ere meter Byun debe anes a) it) = 20. any sn em en lene ean xeon ore say = 2 cian “The poit ofthe lst wo eases ta Egon (11.14) was eid in order tad conien iil sndtone! However, ation (1-18) 0% Ac Diagrams, Asa Moding 26 ppesenta gue 113. Futherore, Egat (1.14) emt even be ied from Fgwe 11? Tn her words, i bldg or Mak ding we hve "este inferation comand nono (11). When adel Ike the ‘ona shown in Figure 11 pase log fo ter nr il not Be eo "es that Equion (1114) ue be satis, "To some een, he cles with ial condons inthis expe ae onrved Is possible to ete block dara fomulation hi ober ‘theron o nit coton mt be gies andthe oil conan Sivas frm consent ae Homever coming up wih such a formalaion| ‘egies mere wrk fo be pt ito te formulation ces. on, | Protas Become mare cole, difiates related to Incostet inal 125 Rewse Hig gone though the execs of crting the made! shorn in Figure 113, easier fora men the pact of cing oe fon Foden sumptions. For example what here were ast tsons ring tte ‘he caer nd roa te hn ai coeon? Ox imagine eng | ‘wee cennecedin ground andthe caer nee fe. Would we be eo ese ‘uch ay the model we ed raed nigh of ch ior hanes? 11.26 — Conclusion Wie block diagrams ae weil they have several dawbscs for phys system Ft, he equation tnd ins block diagram must te manually lve tom the coatittve snd conertion euatons. This is otc) ‘tedious and potty ee poe proces, bat can te very ct when ‘he system bebo s deserted by DAES ferent algerai equations) Baton, cunsty stumptons mast he mae a he compen eve ahr than he system lee which it the ety the compnent models Furermore, sine and manenance ics ase becuse of arte ‘estring trophont he gram (, pclems cn ely oscar conse “lies se to sed thoughout he dara). Fall, een once he model ‘ee foaled th tsk of determining const ital conitons i it ‘habenging bese the gram isl may ot contain act neraion ‘compat tem. feeranare arco omaha matteo s Reve 262 INTRODUCTION To PHYSICAL MODELING WITH NODELICA 113. ACAUSAL APPROACIL uli cas modes snp les dropping te aeted components oto achenatesd conning heating om penal mel, ie the one shonin Fue ILL we can fre develop te mol yang Ilonal compass (dangers emesis) onl we are 8 Sop ptt eg, Fgue 112) The impor hing o aoe ahot te aul approach I tat we do at ote 0 make any 2 rior! asmions| (ies abot whats Known tats tknonn) when bingo mode ‘con of thecal equine se maintained (Len information i “fin the prob fomlson) at computng omit sna ‘ae stil posible “Another aang of easel approach that we decide to make 3 stght change inthe pyc cnigrtin of cur ods, we do ot ave ‘eset aw pole ola ce wed ot vee demine the eof ‘epee ones in Seton 1.22 a ges fom what we ow to wha tre wth olxom). Tis mikes he poset of making cofgution hanes {b ourmosel es iting. For example, gine we wi noone ‘he sonal ifs nd orp between he coe of thea gc fu he mount pot, Sach change mol be gute tcl of the changes hat are made aa mel voles romania stem ta mor etal os. “This change rea nthe sytem shown in Fgue 114 Noe ht the ony ‘hangs ied ply remove eg comection ad pac it with atonal spring nd ape ground-0 ily the fact the model shown in ges 1.2 and 11.4 ese ginning scenes iran advnape in ay eumstnees. ne word, Alc iran: Aca Moling 263 tbe components on) andthe ctl mate th comecton weal ‘ftv o many engineers. OF cure, hi rgument cts both Ways ‘csureth seul formation ides mathematical suet epee ih is fu wien developing onal system: While is posable o ‘tomatic anforn he castles oa sk gram (5 We ‘pesos, ti gery imposible cary ot thi oes inves 44 SUMMARY ‘As meron previous, Bock diagrams ae wel in many sitions sad tha sy hy are sped By the Madea langage ad hy te ‘MSL. pov signtcrt Collen of tock dagram moss However, ‘Rs imporant to Ke in mind sme of the davis of the lock agra qpmac hen developing physical mods ce plant model). Clea bah ‘Mick apna eau! oroatons canbe ia cle spol. he ‘gieson mu whtber such ork dara can Be formulated, ut wher the ae he fastest ond mst lent ma to solve the problem. The yi ‘eal dang thing manly Le ns eto nd em roe Way) Whe "ey ent dave stomatal. ‘Wale block sais contain ust nfrmation, therein son hie fnfrmstion cana be ect setomstlly fom an scl orm For eampl, the fling canna frm pill used when walang A+ Bu Aone a2 ‘he A.B, Cand D matics every ef in computing rope othe ye tem (poles tnd natal equa). Dolce of oma wrt such ates by lng Medel model oan pares felon AS «fsa acatsal modes can geerse och ofthese wt {sl nfermation se block lapram moe without he previously mewioned entacke Modes provides acu featices for making your phyial model at ‘tebe nd vexed a ote In cnr ace maim Bex and ‘ease, ia pose o lei when to se he ena etre, Blk CSagrame are plore fr comeing sly one-way intone. te ‘petd egused of a ono othe camel gear fo tsision). Using ental modes nich cons woul be award apd confusing I cases ‘were sinlaoeos equations or conervaion pci ued he aca {proc makes teaero creat and ese modes {64 wrmoDUCTION 70 PHYSICAL MODELING WITH MODELICA Looking coy ates wo approaches, the fndamestl eens hit ichaetan anrenly lev fomeltons contig mxbena Teentarton, Thy reeset the procesing othe pecblem teh to Spc sete mahal operons wed sae th pac pecble BTS han he aus orlaion press he pl etl: of Be stem wou pectin the proces by which he posem shook be teed Me sn block dagrams ae more preva hat ols which ws blosk ere ee deeop, Ts Yonsei kf washing ‘fecal formula ot the pete mathematical operations dos A dae Prom a er penpetve teal sation woul befor sain (rire fom tntasiion somata. Theemerzeec fol sha [Byala power ennui to racy pce et maniplatons wit ‘ary ben eet othe yes ay em mode deen eaeiace tine demas aber we sient abtaniogs oe acta Spach when deeing te behav of pysal syste. Nt that Soe nel simple xl or sen is cope, Keepin Urmot ofthe datas of lok dagrams ony Become me (ijBeis tecome ge and more complex se baat appro sales Selah anger nl more complex ss 115 PROBLEMS PPmopues 11.1 Create on alerare to he Bok gram sown i Fl ec ct imponie fo psiae ot nconsen e of nioh ‘indian ‘Pmopies 1.2 Build emadelfr th stom shown Figure 1.4 ing bot eons ttr daca components, How much smarty here rec aes for Land [1t? Compore isthe sna Berwect theo cou model. Proaten 11.3 How do you compute ino conditions for Be nga ‘lot ned i he Problem 11.2? ‘Pnosues 11.4 Build botha block gram model ond an eau model for ‘pean conn Pg. Dhen. ocr the acu model of he Freee mer he rin ore comected © prowl nad of he care te ong app he carer gente of hsm ger, Oe Fee eater lok dag fhe new cogation ter by a eras one or evating anew ane fom sth. Aga compo’ ‘ie ct gm model 0 cack operand he ro col ode hee Whar oe he inion dferences? How much ase wo here ‘een he ol coniguntion andthe ew conigwron? Chapter 12 BUILDING LIBRARIES 121 OBJECTIVE "The package ooep we iadca into Mode ep opie def sine fol conecior ee. Tees was allow for collections ofl tolls tbe nes gute Packages which conaincoapnens (eco ‘etd me fee rei oman an be. ‘rss wll implemented at ingle pclae which comsins sever ‘etd (rote packages We wl discs the conventional se for these rested pcan “Aart fom the sca pects, a Rory soul als ance ety and buses ely,» package povies wets wth endespouiis {er ving tem y comming ope povided compone. Ate same tine so be cl for uses tose hes components incre, Whe romehing done nest shel ita be immediately obvi 0 he {oof alg an nal cometion ore dlagrosble (eg. providing ‘teppei Inthis chapter, we wil evi te Chensty pchage presente in Seton Gan cis octring i peter seal. You my et wish ogo ask “Sl reviow te materi in Secon 64 beer reading foe. 122 CLASSIFICATION sore cvting 2 package of reuse conponets iiss to decide wo tb scope of te pckage wile. Forename, he MSL opie by Treiowing pn fg stacy and commas). Within each of these ‘Sepia ate ete wich messy Tor st let the as they reookng fo Fer exemple, ia the ode} ica echantca pack 246 NrmoDUCTION TO PHYSICAL MODELING WITH WODELICA ge ree packages num Teanalat sonal and Rotations} whi neatly dvide the components to mata exc ‘Now consi wha wuldhappenf beodel oa. Rachantisyockage wer intend dvd int eategnies like Astonot Sve, Appliances and Zevoapace. The pla wh tee catego i ut by ono peak nally exchsie pt reall of hse aegres won have wes ferthe TdoaiGear mode Some models (eg, OnclayClute) nigh te ungue to one capory but onthe whol would be dict eae ‘adel ng uch caeprznon. "The source ofthe problem is eating ‘ocatgoiae ced n apples wich alae many everaping model ‘Toad ths chores taxonomy” Ge, asyemat chaseton shee) ho aloe ten wo gs erat Uranhor of th package ech. Soch over cans be eel oie (eg where woud you plas the electronic hemes wot ound a Fig 10110" ates be nines 123° STRUCTURE ‘Once tie dion has bon made concerning what deftons shoul be Included tna pkgs ts acer to az hove defitons. While the Mode langage does no pace ary sete on he srcte of ‘rchago tee are comentons orow package sabe sete. Meal [packager shoud hae conse str cus, enc poche a ‘completely unique src woul be gt dconcering forthe cage teem, Forhisreaton, vedexatecevetalofthecomentns pcg elements 2nd ofapernce in package. Before me este he eomentna ase gacages, we sould point ct that te MSL ncledes sever part saz package defons ta oo Side nae oa or leet types of pkgs, Typically anew package (eg, Ghenscesy) sold exe fom tbe brary deinton found Model iea, toons. Any need packages shold eend rome Liban ‘non ao found i adel seu. Toone. The brazy2 gape lve ‘oom fer atoniaos Le, addon apical anacnios) while e at {efor Library ae mor gover, with rom for customize. 1231 ‘Types Inthe ca ofthe Chon st ry package, we incomes pschage a cntied al he psa wee sei to te chomisry pasa, Le Pits Nedeliee. oso udgaver 261 ‘The MoLarPiownat.e ype is ded win te Chensaty package be crue iis eed bat t des not eit inthe Sunde pckage inthe MSL. ‘The Types package might alo conn record defo wed wii the pectage. It ently presets package wil be we ht dost Tele sina ype or record deen sod thre aleady aval imothee pockages such asthe MSI In sch eres, texedTypea package segue, 1232 Interfaces very packge nal inca some ete detios whic re aed ought ie pectage. Frthemost prt, uch detonate oes rpartial models (eg, OnePore see Example), ‘och eintions shoul be incon ered package cad Eat ‘xcoa,Beease these defies seo mpi sso widely wed ain the pce, the nore noan package wally apes to fet. he tp sf aveiage, Fre Senlatypsags Ener tase pl cage coenistey Not te we ofthe MolaxPouRat ype dled previ ia the Type package Some descrip txt falling the declrtonsin the Interfaces pack sg illelpisersto eter undertannycometordefniions An important ‘ing wo romember when developing a pckage allow te Mode ign onveion egarng ioe vane in conctos e, post Hoi io She componee ‘Alo te Coomtoey package does ot conn any parzial df ations, sch deionr are gate common (x AppeninC sone parcis) 288 TRODUCTION 70 PHYSICAL MODELING WH MODELICA nitions found in the MSL). See Seoon 125. for dicusion on he ‘shmtages sed daetge of partis defo 1233 Functions ‘The Functions package is ini the Type package 1 thee ae sacks specific fonction defnios ht ar sed housout he package Perel falc te contest of th package, is pl calle themin he FunctLone package However, tis te possible th ork ‘consent for spven stag and in sch act the Funct fone pacing iro essary Trcic Ghomtsty package, he CaloRate md Calcttalesptiox unton Seie inthe Funct Lona package. These nto represent ‘Sin of he fame conte relations for emir. Bees ‘bey conl pte eased by matile models ia molly develop (hems stry plage ey arekepein he Funct sons phage aber bn ei te eck thet comely ne em (ee React Een mode). ‘Tesco te Chemise sy -unct- Sons ska nom 1234 Sensors Ter actgs whch con defn elated pss yen sed package scr made pely pve, Aim Bee ses ‘aidbecapateof outing sgn hat comespends ote meme ae peice soph eras able for tar Ser. Type tt {Nes aera es ae nde One seo tp i aa ane ‘NSoroot np tole oan ar valet 7 e'cinpemtare apn Another type of sean I nae ena ‘mance erm en om ine ae ot (a Wonca difenc ewcen tw pol) Fy." ses” ‘Sieh leben ro pn eg heat ow ou) ‘Tipu rhe stor forth ces vals are gewaly comet It fra! mie the "lo esr eel conected ns th he Be tan Toe an cramp of such sen, bok atte models Nadal i= ding Ltrores 208 1235 Examples “Tobulp wer understand how mode sold te connect iti eel © incide aollecion of mma samples. Foray package wioat xa, ‘er wil ial wisundesand some apt fhe package. The es ‘harifapaceagsirrttedto severe ee ibe estonia ‘crmisondrunlngs ht ocr among any wer Insome cases, ese iy be de fo bad mods desig bt ofa Te ses ae fundamental fh kage snd ete ceria undersanng onthe ptf he wer thai {et obviou rom the cet sce or eacumeniaton of the polage. I I precely deve juss whch shold be ested bya need Examples pects. "The Chemistry package ome uns nat cots Bo Se cinco node. Ths ene hat impose cea mn exarpe ‘rho fst ening al arcing pees and actions Therefore i cu to ice np example Howeve. oe posiiity woul te to est he resonator package (ao dese in Saige 6) inde tie (Ghemiet zy. xanles package fo seve a a demonszaton of Bow He (Chemie ry postage can be we ‘Alle pakagesin the MSL. consinSxarpeepucages and exaiing tose packages wl te usa in undennding haw to cet n Beompee wclage tht will ceary desta be use f «package. In ation, (he MSL consis a spoil partial node called Hodel Lea. Toons Example tat example models con be deed frm. Tis roves em ‘sont kes the mel xi ropa sa camp Tis god iden toapply the socapeslated gulf Ge Seton 9.1.13) sy oe me mtd cng) ow te ear factage, The wlalow now wes of he packape cop he examples of bh package hertchy toc stan ane mode. These model cn den be ‘ly oid aed sto ee 1236 Tests ‘Aadevelopr its imporant mini ate fs csesto aie the dein Inthe pckage. Sch ame shud eal test ever component Inland ube defi! with th package Whi est aes ae go tril ones hich shld work ts sometimes flo nto ince ‘amps which shoul ot wer nth yet le may be designed Side ot ony he package bt lo he too with which he pctage sed (eg, toile srt cpa of pope iagnoing common mistakes). ‘Wa teste areata, hy shoud ebay ot be sine spat oth package. Ine hy should eke ina epaate package boas ‘her inay be sna by the est es Thi i epee When et 290 pvTRODUCTION TO PHYSICAL MODELING WITH MODELICA are ocd which rina fai. While srs ight leas some wel infomation ihe ence (Le te esteases may how moe sophisticated ‘hampls af nage tan hexane package est ess ae Ely nt ‘Seopa te rise examples. 1237 Package specie structure Sof, we hve deed nest pcages tht conmesy ape 8 panna Ten pease Srl ted cat tne pels cagesng in op at rit ecg ‘rcpt, te chenietey palag cosine ese package led aude hint one tog Stations ctnge chansetey “These mel prove tebe odes for chemi estes. While hese nel ae not afc or repesening ll cher syems at kato of These models ely preset in every cena ptm. “Toe model ica. Electrica). Analog package a goed example of a pctape with coniorabe package sei cet. The cues! veron ‘ind a fom: Peng nee St Sora ae thas ances 2. Sa Souron ug Libres 271 De ht in dition to the pial Tntexfaces ad Seneors plage ‘tere ar sever ahr donais pce palages (eg, Somiconsuctors), 1238 Canonical form of a package ‘The dcuson the previous ett on conventions or eed packages ‘a summary teflon canonical form for ew package! Pees ey ere: Such comentons sr inpontnt rouily wo the wer ofthe package, The ssiliy of ven package geal teed by bow ord and da tmentd ii "The aby to quickly view the Tacerfaces package, 0 roms the compos and nex wt Rnd of iafomation hey cna | ‘newt xanples package to ee how te components in he package ‘comand, pe este ta fel forhow thy package shuld teased 124 DOCUMENTATION ecurentation was cused previously in Sections 24 snd 9.22. The ‘mpotane of docamentato, arial when developing package cam trove. Ar Figure 94s, he documentation wed by te Seeger an be ley format by he ol efor ts seen y the end ase eis adviable to provide some hind of docmenttion foreach model ily, fin explanation of he model shoul be peed in HTML 2 docmenaton ancuin Gee Secon 9.2.2) Also ts wef provide {7 RODUCTION 70 PHYSICAL MODELING WITH MODELICA akon documentation nntatos for eacpachagotogive an overview of that peckage ands cone “Secs apa tbe MSL wan escelnt example wrk rom, The sunt sonore MSL entoraiclypneated tom th Modsica source code and The embedded docwnertog amctatons. Te ocumentsion i generated (Repay ta ppt encoded to llow jumping between rete ‘Sidon Poets you lok st he detain or component mse ou WU in ype othe connector deftons. In ates, te sical vance an a wed to gener phil ges hat ar as edn the sented deeamentato. 125 MAXIMIZING REUSABILITY ‘Wow cstunoursetonomalingrckagsssreublea possible, The sole ertebind makings packet rt ple io develop component WRSai tite edocs difercteystms,projctsand er nied {Garson ae sacral dea on fw to masa reusable should Kept init when developing poche. Tne gener ule wen developing 2 package ie ry ad se Deyo te sglcntene yon fan win consgerapilaioes tat ther POE ‘ruses mgt ve 125.1 Including partial definitions ‘Somhingto keepin mind when eelping a kage tse may sdf nt pcg fl bt pomp or hei purpose. In sah RSENS mam wih o cene a componen which extends rom yous ‘Sy lpuing sch ng, you will ake yur pckage moe usb "rorctunplhetodel ios Wechansos-Ratat ional .Tntex£sces pachage conan he follovngdeion fora Compliant componeat ea exangy pt ~ flage_s.0t7 ung Les 213 “Tae compl ant dentin i comparable othe CnePoxt dition shown In xampe 4 Thx pareil deft alls us aly wae dels fo ‘pong spe ia uch he sae wy athe One Pore defo allows Sietiy ae eon mapas en aig rence conse eae). “Whe th we te exende wont an help in ining eduancy cso corpo can li edt cnfsing model Remeber ha 0) ‘co extande eu inthe complt component defon ing ied ‘Sctos the package erry Tica make elo fore. comple pi turer he ered omnes. Forex, corer loving Jeno ‘ager onc reson ‘Tenvisnal-incertaceny Tra tenes « toe sah Wile part sal definiins ae soe for promoting ese, finely Fagen ‘pret modes thre above canbe ar tuners. "The pups of to partis define i to dee an inerae. The ine fs componet tay composed of parameter and comsactor ‘clare nimny cet i fl oer soe vrs and one inte partial dentin Forexsmpl, be vag, inte One Port 24 InrRoDUCTION TO PHYSICAL MODELING ITH MODELICA noel wa inode repent oka cop zrotshecomponet. Note that an quo for v wa al aloe Ie mnt case, recommended than eton bic foray variable dell n a partial deft, ‘Antic h val "angling Le, witb an equa) it soul be ‘ell doen wh ht vibe represent and tha eues an xo, “The pons tht ll oe of extend cress sone atonal comply ina packagebecaneit agents become definin,Howeve andra Ing of ow te comply i sorted wl el fs cooing he eee ‘nd coment of extend usage rich Oa complete ept mamgeste- 1252 Making components replaceable esl rom ou scson in Chapter hw the replacoablekeywoncan te wed when bling component (eg Example 48). Tas sae posh ‘hn be employed when bldg packages. The mont come appeaicn| ‘te replaceable Keyword iver ype nd node) stain How ‘her key nnd tn he replaces eyed cn be wed wih Facord, block, inceion odeven package isuiaon Whenaconpone sole ‘eal ia god cao ape cori ase othe elation (| ‘decnsd In Secon 4852) ‘The eomsealig ype soul be a parcial ‘kntion ftom he Entereaces pacage 1283 Package granularity ‘While tiling package, ke seo cleat define eee of de you expect ee fe pacage to wok a For example,» iy of base ipa componest i ane dveloer of hye cats bt co ‘Srcting complete hi yt rom ese bare composes might be ‘tte conmigo hi fearon, he cetor of such package ay be tempted Inde several complex sue subse esa el {orsyrems er hyrstatc tans. BY doings, the crgaiation of kage ay sie teense heel fetal change acess te plage. “Te ne, in a nthl, fr eiing whether the package sou be a et of pie mods or set of composte made If ba yes of modes fe beng develope, hte ar at eae 0 prs. Fs You ca | ‘ganze he package ley detinewetetveen te pine mpl snd {he compose moder The second aproach o crete Wo rps paca neo fe pimte rndl acd ne tthe rine models to rove Ute composts mel 126 MAXIMIZING ROBUSTNESS “When developing package tise apt as much os biel tein tes atl Sever ay hae fore detios you ang ees 275 se prong. Such rescane brten dwn in te ro cago. Fi, {te model developer may ae he dfn ae hay mee nen tbe US Fora wel ese package all be define shold anton rope (Le bons ug) try we sed as nen. Sei he model eee ay te thedettonsincoet(eusing aon pal ales for prmee) "Thee aur shalé be detested and enna reenable agnosie message (bow tis done wil be essed ay) Fal, here ay betes tat ‘ete vot ate (nt al poste can beanie). A thy ae ut Covered thy snl eter te made to work cnet oF provide iagnosti Information aso why hey arr allowed 126.1 Using assertions and limits you bokathe Medel sca.Tunit package ou wil lathe follow ‘ag dealin or Revizeance: ote he we of i mn st. Tis an exam fet ii on ia ype prevent mie A esitance of han 0 oe ial ‘eaigfl and sing tein tut in way prover he ston oe ‘curing ad thee aoiepeting reals ha ay be coil “Themin abuts jst oe way of preventing noe pty ales Inmore eres fist sacle seat asinplelii. nea, scontions ‘iretion med a deters whether sm py. Fo example, ‘nny ao be acesry to en when he amount fpowe sip by a tester exceeds erecta ae, In such ce, he Following seen ‘eal be alo ote resistor mel Incadingsachan serion wl genet dagrosic espe when te sista ‘Suse in an impopr way (eg ina cr where te component wou al ‘Aol examples wig aeoeze() ea be foul in Seton 8 1262 Finalizing choices "Toei osply modification component dtl sabcrmponeas i sn porn! Tere of dele. However uch esbity shoud cura Itiis not appropeine. For example conte the flloing sews defion| foandinihe Model Soa achanice. Rot at sons peckage! {716 nwtRoDUCTIONTo PHYSICAL MODELING WITH MODELICA ‘Sie thi sensor is only designed oop snl voy sigh ie ‘ibe ouput prt ouzboet, har been permanently fied 6 one. THs i ‘Suc wing the Fina qi ona mata. Using he fina qulier (2 coral a wore deta Soon 4) allows fates, a ths ese ovewsiesl todieaton 1263 Reducing the potential for modeling errors “Te fn clas of sis ites commonly cll "odting ees ‘parece ae dic o preet bese they depen on how te models Fr oxampe, many single dese restor, seins) ee the sme sua reps ftir one (ce i oes nt ates How you omnes Ue becuse they ae neers). However, does an cxampl of ‘Setponene wo senstie to eienaon Ie dode move a ery ‘Site cer bythe conesor apes or te gropial nations) iis a5y Foca usr to ctry ac nto schema. Such a eo canot be (deed tecue tre an understanding f wha the adel intend, ‘Oe examples might nce the mise of dead comgonens For xan, ane sep wget caer cold case smlaton tl ecae the ete of the vlog sd nthe costatie equation of ‘Se captor woul beings when the ep occurs This aoe example ‘Stoomething at alo reves ecrse sch situations cannot te atoms Signo (by eter the soos bar of enon) poper dosent abut the ony way ach ‘Sutin can petal be soe 127 STORAGE OF MODELICA SOURCE CODE ‘When we lc ft beavis descriptions. gph emotions snd acumen, the Molen code forthe Chemistry package could ‘cme gute long conned wihina singe le, todo aor eye flan Chentstry package cane pito salle les whe maining (ten eral pro Thre re several bee wing mE (hee lot sng le wed and component wiin tat package is ‘ated then he ee fle must he ead and pursed by the ata ‘aie ci ifthe components ae kp in separate les, oly he le entaiing te eu omponetdefnsios mist te res od pase, For ‘Spr eats acne very cweint becuse wil sped ope poess (fvedng sparing defone. A second ease for tsing wile less tomakeheoystom mere tanepene. Wiser less casero rename, tho ret te Hes inuly witout having o estou er fe dng eran 27 “ocr singe package which pane lp le, cen coments tnt evel, The onan oa sing te mae le speach (Swear suc o cnt esse et ate) 6 ten ec ce th pachage Te ky tb my pacage ete Sherine peril sg le or atts. Hae {tS sear pokaga ta rectory most cot 2 ele orkage nt cosine page tao, Tet fon lane ii barpchage mst psn ls ith eae ‘Scat cnt ey conn foie ff no~ Frere all IS" hs ust consinaethin tt one ine ining ws inte cage uy, ot hon sabe pled™ ‘hftoecerecs acon slcslockthow te chemiaty paragenigrvercpesen wing mp fe, Onesie seta ne TBebuborn ing nites se show bl Nota ech ‘nc opments npacage in ut xg ete Howen, 0 pecapy ae epee a dees. Pogue te hae wbesly Sete Rnc oesngneescnipaerenn ‘rae bbe Totertaces types an soneore pap eres a individval files. a Chemitry pacae.n0 Tntartn ‘ypem coe Cankateme [> paste me Stator. acy ety a {278 INTRODUCTION 70 PHSICAL MODELING WITH MODELICA For packages pte diets, oe tate detry contig a “poctageme” he. Asan exae, he "porkagems” ein the Funct Lon rey Lak ike: Remember, so dfnion appear inthe “pokegem” le. Insel defi tone ins package eset a etry exist in edi les within at ‘ecto (ee Figure 121). cases where apockogsierepesenteby le hele incest pclae icc sting en tt page AF ete "Tipeso™ le ks ts not secesay ta al tpl packages ei in he se deco, For ample the MBL geaeray Kp at ope plas onthe ad ee, wie ‘he ackages are hp same ee alton o searching the een Srvng det anh dco wherethe MSL sep, Model 0s a Seach the Seco hen in he MODELCAPATH encase vale? ‘Tis enviroment aie ata of te estore that wl be sewed for Mode deta, Ea decoy spicy separated by 2 emiaon 128 CONCLUSION “his chapter shoul! provide you with some wel formato on how et sare ding reusable Modlca Rares I you wish ose fartet ‘cape you soul sty the MSL In ation ete ae mero eer fice Models pakage ave Ato sch pkgs can te ound tthe Moéela web te netp:/we.nodel ica.or9) "Waverley ny ig Chapter 13 INITIAL CONDITIONS 134 OBJECTIVE ‘Refare we cn on a ae analy, we mt fe th poe Ina condos forthe varies. Te mo prt reqieme condos that they do nt crtadt any of the unos in he model ‘yond th, hey seal make physical Sense and epeset an apropi (csaly qs ste forthe stem. Tis hgter wil seb chaque ‘or dig th inal codons at re appopte oa given simulation 132 MATHEMATICAL FORMULATION nore tet nderstandh rcs ed folie inl contin, ‘veil examine soe! simple protean examine ow thi varies teins. Spl problems se aed to ap ia he cles oF ining ina conaitons nia tose cep ae ne evil and ae wo represen ea tem bse tht ek om comet jst {ew components. Hopefully, ese cxanper wil provide soe alg shout bow too prom fest sane operas on much le nd mare comes problems Tnapine weve contrac aml which esis in te Folloing ystems equations «an (32) 19 mymoDUCTION 70 PHYSICAL MODELING WITH MODELICA “Onc sinsion tas begun, sling sich system ie stig nce (2's gen vue of shih tay even te ding tansent sinus ‘Saye te town, we can dts y and. However, a he sar of & Timolaon ths tes gues are urknown. Asa esl eae ft with be Fatoing ese of egos for or ini eonstions: a{u) = Sut) «sy Hu) = -2r(t) a) “The ben of indnginlcontons for such syste eset bol on tbe problem fang sonal equations ua we Have a may qutioesas we have uk qumtes. An mprtan caves ering is ‘iments har th sig sytem of equaon at en wa nosing ‘Sem of euatons Fer etal, aig an adtionleuton sth = vee fang ire equations ate) = Sale) ws Hy) = ~2ett) 30 a(t) = 2 37) sents in ssingalar tem of exutions ha when sled ld the fein inl contin a) = 2 ase : t wy = 3 3%) He) = 4 «x10 However inna, we ad "neat dependent” equation Le, one hat it Tica dependent oe nother eqn he =e) cb H(t) = ~6 «aan then he euing syste of eqs: alt) = Sule) usa) Hla) = Pelt) (3) Ha) = 6x) 3) tesnglr and anique soln canoe found. Asanotber example conser De folowing stem: as «319 Init Conditions 281, bane 0319 bar «31 For inalitionprpse, hese quo ae nse nt He) = Sul) asi) HG) = Balt) 39) Hig) = ~alto) 0320) [Now we have ts etn nde wows ney Got) su) 80) sC)} «2p ‘Axara, we mst provide two aldionalegnons. However, al com ‘Semon wil ers Lot ook re cela te maria stretae Toutes what he estos ar Ft, Beas he sn lgsbrae ‘Sosa een n,m canot provide inependea init as fr fain randy. note most following ins guesses of eutons: a) = ute) (329 Ht) = ~2rlt) 032 Ale) = ~All) (3.25 ate) = 2 4325) we) = 2 (3.26) Second, teat th 4 ferent egaon for we mst provide en ton wih sf nial ae for = AS ares we old prove ‘Loa tion for a(),2(4)} o {),=() Wow weave sow, tient sufceto provide ational eusion = {4} 4) ‘Nove icine po ini yale for serves Lets oir wren tem feet o-% sz “te (329 Asi, is last he flowing system of euntons noving te ina a(t) = tt) «3.29 He) = ~Belt) 1330 In aditono providing ntl ves for aie (eg, 2) ff) is also wef pve nl vabes for eves a wel. Fo samp 8 282 INTRODUCTION TO PHYSICAL MODELING WITH MODELICA somo ost al ere vaso zr when chosing inl codons “Thelen ibn ach an ompion that he nse ara sb at froma of ret al he eas nthe sytem re 2 hat eas te change nthe vale wl osu ap some exe infin ists Forth este, ha el led oe allowing pow singular se: s(t) = Sutt) «33 ft) = ~2etto) (333 #4) = 0 11335) storms tis natcarenty ose spcfinitl ve for dees inthe Mods sore cs ie he eas tito. However ome tote do spon hs activi through th raph wer nee "These ae simple examples st easy Yo aay hee state 10 wo er wy ome cobs of esions a val and hers eer tough cnpex poems canna be acaljziahi way nstea,e ‘call geoualy preset ome coe of varies for which inal aves be provided, emery the sr Is poset pacar css il ‘eee ala forth atone dst ere “the prose of scope st elp demons tha a onset set of ‘ni condos me foendefoe tansen simu canbe pert ‘Asaresl ome tne fel coon may mtb led of may ead 0 ‘nome poens (singular syste of quis, 133. USING ATTRIBUTES ‘ne way to contol he nization of he yes ales i se he cave aut incunncton withthe fxed atsibae AI Res variables vette atte Ifthe ied abt seo ere fora variable thas tho effet adding a ution wo teeing Set eqns ed os {ort codons, That alioal quo llega he arable wth thevalucefhe star ate forth varie To abdertand his beter It {tloskatan example, Coser e lowing Mota mel: “Thies he ae pte of eutons seus in Section 132 =m «334 ae ts (335) Ino Contons 289 ‘These gation a hen are it the floing syste oink a(t) = Byte) 33) Ha) = Bett) 1339) Sofia hs ie te process decried in Section 132 ‘By df te sea atte has ale of eo a te fed ate Isao false However sf me mod ome! allows sn gethe se syste of ton fortran ns ut when hes equ oo areranfore into th estos wed ose fo thal eons tm atonal eqn (l) = 2 wil be ss, ling in oe Fong ee a(t) = S96) 338) Ht) = Belt) 1339) at) = 2 ro) 1 his way, the start and ce ates cn Be ed 0 provide a ‘ional egutios forte ssitzaton othe sytem. However, he apa only allows atonal equations imolving varies ob nce (ei proach old no be wed ald he equatin fora deca, 2) = 0). Even the fSxod stat at false, ol may hoe ode ‘x outions ss cededn which ane te cea state may til be ad inthe ones ‘Wail ts ease hw uch atts can etd aden gatos into ly asserted system, irs obo bow they sou te ‘sed ihn indvivl component. ising nt oor he Ed ‘tte boca ican ead ooo stn of goon ih | Solin. god le f tundt follow ito oly a he fsxea sce tobe true for vibe thre ner component mel nd ht hve Tad the de operator ape tte 134 _ START OF SIMULATION “Another way se inal ves can be et is with he Anita (fan tin For example we col inl oar Psat Orarsipen desrbed ‘evo sng he allowing meat {si INTRODUCTION 70 PHYSICAL MODELING WITH MODELICA Foemost now uses of Bogle, is wil probably sem ike he os mata ‘Sy lonltntines poem bsmse is moe procedural. However iis ot TTZLedateton eho. The poem sth he Sn S01 () function ‘Bp tecomes crue the imo afer te siolton ars, ower, tefoe the tals em sr stiles ove aconsent et of nl condos. As TRE wo str of ial oon wl be wed The ett wil De lv earring metode described Seton 32 and 133, ile be ur wt be ved for ine t= fg oe ot fr the simulation Sr cd onthe ote sy benclasestiggeedby the Anita () fenton vr akin wo bsing enfsing, his method of natzation Ce. is acti limtio te vas hat have ta the dx oper api them ate Chapter) Inter words nth ae wile > ean be nina IR ay the saa cant, Toews of te Ana (faci it ‘hres forthe intron of derete vibes nce al acre aval a ened sn his way (ot ast some) an i wes Wie Sapn wit sen clues Several examples of ach sige canbe found in pes. 135 _ INITIALIZATION BASED ON ANALYSIS TYPE. “The fal way of conolng he eatin ofa astm of equine to we he snalyetetype 0 fancion’ As scribd in Seton $2.71 {his fenton allows fren: equoes tobe wed depending on he pe of ian ting perme. A spose pe, reeset byte erat SEUMLISEE reacties retuned when thal cons ae being WeSitioa” Revising oor Feestordersyevem model, we mig choose torowrt the model fellows: Canons 285 By posing our mol hs ny, ciferet st of goons wile generated 0 + Base 10 logmithm: y = Hodelica. math, 1ogt0s):wiereu>0 324 INrRODUCTION TO PuNSICAL MODELING WITH MODELICA GLOSSARY ‘causal An approach fo modeling wher 90 asumplon ae mae about uslty when developing component mde. Ts eds to be reusliy ‘tne devloped models Beeae ey contin ewe asamptons about he Stet of tere attbotes An ast is sscltd with guns sch as parmesan Tarshes Anite provide atonal aeration aboot th qantty [chav uper an lover bounds o psi is. scr arables Vises whic epteseat the “ving fc pont ee Seton 13.2 formore deta ecbrac loop An alga loop coupled silaneon stem of ye Tis Arte lle a omventinal Mock agra nt posible to fsive at astm one arabe at ine ‘ack box A mode fr which he inplemenaton tails rien. ‘lock diagram Block agra awe explicy describ the se of mah mata opertons ia as be ptfomed ie ete to compte 3st of {ntnowns fut) rm asetof knowns Gags). Frere, he backs in sch sagan may have their ov tral aes Wel (fo ‘ep oot). ‘Mocks Components wih sly defied ins and ups wed 10 cele ‘dock dagams ously Cay eh case affect elation between component in compee pel syste, neers) tnt possible o deters the camaliy of neal component. Fer camp des he lage rep ‘roma esto rem from acumen gong hough he estore Clrven tht esl oma vlagedop? It ely once a complete em ‘Gt componc as en const tha tbe cuslty can be dtemined ceefcent of ettution A eae of how mich momentum scone in rnc elion, eamponent A componts i an isance of «mode. So, fora given mel Tepe eso mode th cul inte (eg the esis) wool Be Somponens Is ebje-orented progammig, # empl s onopmas anservaton equation se conservation law omer awe Concern sat th the amount of some qeatiy ep. enczy ots) doe nt change ofr time Ts quay ee Giowary 305 calle controd quant. Cotton a ae sed deve conser ‘toneuatonswichexplely at hat eine eae of econ ‘nity see nerve sytem stn which come quanti eg. beg mas) consti equations Relationships bawen te porns (Lac a les) In ay and eHow of conserved unties (eth a ‘hies) Example cade Hoots la, Onn’ nv Fourie aw Newtons ‘oro systeme Control tems we infrmation fo sensors to tere how anos shoud be edo ested respon fom dae control volume. itl vole the thermodynamic oun fa free andy dag in mectaics. Acool volume cain om ad mss {general nigel or puso fom). Any change in ms re a. (etosome enteral nen eg, work, 80). ‘DAE se ferent lgbrae equations {larson When a component is nthe na syste o inside ‘snr component ht scaled componet devs, Aiton The dessin ofl varie, prantes negations asc ‘ed witha mol cle the eel lon erved typee type which scrote by speciaisng coe of he inns ‘pps ltc, Reals integer, Ser ing md Boolean) “lagram view The view fx ote fo he “le”. The ew eta all Intel subcomponents scones. “ieenilgebracequstione Sytem of eunons thiol bot it Teena get gations Sch sates have the general mie maa foon (3,8) = dare variables Viable ith ves hte pices constant th oman neutral Someting ie domain newal dos at exit bis Tom apie enineing domain caption The silty 0 hide the dete of «component. ely, an derstnding of ese eas shoal ot be necessary this way. the 525. IvrRopUCTION 0 prnstcAL MODELING WITH MODELICA svat of det which tb dtd in cet comprcend a com se system sede, vent Something whish ce instntansoly tx mpi ine or when 2 ‘specie conto xa extensive property An etnine propey is 4 mates propery which | ened the amount of as resent Energy xan eerie Oey [eemaeifyouranoehalthematrinahomogencous ice, yous ‘move al he ergy. For moa etnive ropes thre ae soca Inenie popes fe, piel oe) selene property plc equation An option wher ll te solution variables ano hi "devas cn be sled expel (he, they ae he oly erm en the el ands ofan equation), Ancsanpleaneplctequatn’s = (Ce). {eemplct equation frat priniles Moding approach bated on wing comseatin avs (ce ‘ret current I). ow variables se through variable free ody dlagram_A cara which sows al ste information xe ‘aon potion) fora gen component sal poet ema infenes (eg tongue) ‘iret current Iw The sm fal cuanto st be 20 hybrid system A system invng beth ominous nd dst behave eon ew This view of «model rom he “oud”. This view ater 0 ide tera details and present a "lack box” represeation whch ony nctaes the extern connections othe de Implicit eqeton An euton in wich he slaton varie des not ype by elon he et al ide of regain. f(T) = 0). ser exc uation Ina vn problem mathemati rion which i saved by stating fom ctf nal condone an thes inegrig eye of een Interv property As itive popeny i atrial prope ht isn "aed amotnt of mae. Fer ecole, emperatue and cocenaon fe both tse proper you ke are nfo myer ot een andy remove hal he mire he remsnesseWll ionary 327 ‘ontna have the same temper and concentration, ser extese eoperty Intrace Gens, he neice of a bjt consi of alot deta “isle extemal fa Mode, his would wal inc preter nd ones. Recepiig th seve model pes have common nerfs Ieee oe development fpr models ke he oe shown ESBS tostance When adelration involving adel ctype is made, nna rested. Thi tances om sof pm nd tits sept lromsierintancer ofthe ssmemoseloeiype. Inter werd, Beas sto= Isa model and Rx could be speciicinstance ofa Rea ator wih is Ont ‘ae frresitanee init Te iio ay ime varying vale when approche from Wheel Cie, valcs of ine love ane tine a which ean big ke). ‘ecalvarable A variate wich sol visible othe ey wichitbelons. For exapl oa arable ina faction aly ible ota ction model A odes beavonldescipion Fr example, a ede of arse is drt ty Ohm's iu, The made! a dseripion of stor behaie othe resis In ote words inporan spate tee ‘estar nel (eV = [of fom te estoritances (components ih reat aes of eitanoe, IC 3ou ae al with ajo rowing, mode! ir analgene tcls. model deeper enon who irons ore model Fo ge ‘sulin projets th model develope, adel ue neo er may Pe ‘ice poe olan Modine we o over he detain dsarton. ‘Moion ypc ve oveidig vale fo atte ofp rnetnork. collection of component connate topuer Ofte, oer ove | eco component petworasceding othe consti eens of ‘be componens ade tn wor, node the point a which componets re omni “Tn ge ack cc i Pipa 3! we mde in th paca network package A package refers 0 colleon of Modetea models hich ae ‘nent io be ued opie. Forel am let pacage woul ly Inelade deetoe fessor epactor and actor adel. 528 INTRODUCTION TO PHYSICAL MODELING WITH MODELICA package hierarchy A diagram bowing wha i cole win a yckag. Te bjecr-ovemedemaacogy, hist 2 gran sbowng tea rl ‘onsipe se inkeriance rare rameter expreson Aa exresion which dos ot chang with ime aril ferential equation An eetin which consis desvves ihe Speco spl dens and poly although not lve) Seraives si espe tine PE se parti ierential equation ‘ant mae A plat de the model f the physic stem ond = ned dane spo) fr whch cone sie, Sess sd ‘Stone ual ene he foundry between be cul dhe las. pica meeting Ths typeof nodlingiciracszed ty fst pipes “ranch to forolaing shu eqations. Pain modeling refers 19 ‘thr cont sytem ener cll ant modeling physical types Physic spe gve deed information abou he physical Mipnifcmce of guns Fr example te vag fea iat usally ‘ehetented ytheVoleage ype cnsine ine Modelica. STun es ppolage In bis my, tna iferaton eq wits iit) ca be ‘ott wi har gomty, fhe way, aie ae weed oe than jn mabe with ae quantity A quantity refers to sone ees which have nwa (egy the Tessance ofa esate) In Modeica, all abe ar eer el eget Sing or boolean Furthermore uaity might he deen vel of Sarny te, vble pres conta adit mph Be sar perv schematic A sche graphical representation o sat coining Teil components nd thr conecians wo each ae semanties The semantic of the Modis anguage defn wht he intent of rsync cmt Iesrence, the emai of he langage he ncaa get itd with Keywords, operators an 508 shor defisiton A defintion whichis so sir oan essing definition tat “ean dee in tems of oaicaton nthe exiting dit, side ets funtion esi ove sie fet i store noemation be sed ding seen ions. Externally sch ne fet cause the Foneson ttre ifret eke eenfogph he sae input ae psc Gouary 329 solver The stare response roving he syste ytd DA wich "esl fm a Modsiea mods. state space frm Aa equation rye sido bent pe frm when it eerste = Ast Bo y= Cx4Du ste A propery ofsstems with coupling ween as dyad slow mc Terry aes nts aes abcomponest 4 steomponen is wed oer components which ae comin win ober component Forex, ates gM 040 ‘ormponnt af anter component ikean ental. Futhemors th ‘Seti cited te assompanent of aap. Sobemponen {Sv ed tof leach md i ojeceodeted programming ‘Sbcomponen woe bea member cj. ‘symbolic manipulation Using alge o erage egation ao oon hat sexier ose resin more fie salon. system model A syn slime whichis comply scones Inher wo does oo bey exer comets an represen complete mee ‘hrongh variables Vales which represen uattes Bowing though a opt (ee Seon 13.2 for mere Sal type Modetic i ong ped lngsge. Ever ety in Modsica has pe Each gunfiy ha 9p neigh its 0 oaig ps. incgerorbeolen, Each upnen has ype acetng what mode ti savibty The aay gue anincaten bow fe that uy eto change we Secon 2823, sariaityqualfer quiet esis ow varie may change. The "asabihtyquaitosinModecaa constant, paraeter andaiserets, References Anderson, ML (1984). Object Oneal Modeling and Smut of Hybrid ‘Sten FAD thesis, Land sae of Technolgy Deparment Autom {Coed Land, Sweden. ISRN LUTFDATERT= 1045S, Asin, Kings Had Matson SE (1998) Belton ofcotncs ‘ime modeling at sialin ln The 2 European Smation co Force ‘Bato, A (2000 Ineo chemical nets noes Tuipivclence nro as ueaching 237/23 Totem eae. P.(200) Modeling ad digi! silaton of yale atm “Ssignandegineeing tscaa uinghodslea sod HL Proceeding ‘ofthe 06 Modelos Norkshap. ‘Bowe JM. ad Beem. D. (1990). The Boot of GENESIS: Exploring Rel Ti Newal Modes ith th OEnera ura Staion Sym Springer Veta Bowles, P Titer M. Einav. H., rk, D., Matson . Mie. A ‘Olson Hs Oe. 200), easily of det vebile modsing ‘n Proceng ofthe 200! SAE Congres and spoon Breunse, APJ. and Bronk, JF (1957) Modeling mechanic systems ‘ing th SIDOPSfneuage In Prveaings of ICBGM'7, I Intra Vina Conrnce on Bond Graph Mol and Smut, 19 ‘Simution Seis, pages 301-30, Pheeai,Aaoaa, SCS Pobishing ISBN ESe585.050 ‘Brot J.(1997) Modi. simaaton nd assis wih 20m. Journal ‘4 (Beni quae furan cutee ome), 280), Broga, W-1.(991), Moder Conte Theory. Pei HA, hid eon Celt, 8 (1991). Commu Sytem Modeling. Spring Veto. 382 NTRODUCTIOWTO PHYSICAL MODELING WH MODELICA Chass, C, Scheie, A, Lites, and Schwa P2000, Modeling of ‘vials wih Model In Proceedings ofthe 200 odelce Wok Stop. are (199) Anintrtactory couse ia modeling dynamic chen coll ses psa geurgtown etary igyis, H. (1978, A Saved Model Longuge for Large Continous ‘Shr, PD this La leo Tecan, Sweden, paren of ‘tomate Cel mai H, Brel, D, Maison, S.E, Obson, Han One, M. 2001. ‘Dymola~ Dynamic Modeling Langue - User's Manas, Dyin AB, Research Par Tan, SE-223 0 Lad, Sweden preys se. ‘igi Hy Celle, FE, and Oe M, (1983). Object rine odin i yb systems Un Proceeding of Europea Sma Sposa, S59. The Soi) of Computer Snulton. ling H, Mateo, pd One, M1988) Modlin -annerationl ‘ion io esgnan cert moelng ngnge-In Proceeding of he 1998 Samer ConpaterSimuion Conference. iy T nicer Sad Kote, M, (197), The rites ofthe sie Ihalaenentoament I Proceedings of he SB IMACS World Congress ‘on Selene Companion Mdeling and Applied Methemas, ame 6 Fiupatnick, D. and Mile, 11995) AnlogBehovionl Modeling Wah The Ver Language Kuwer Acar Poise, Fowler, A.C. (1997) Mather! Models inthe ppd Sloces. Cambie ‘Univers Pre ten, Vian, Fen, D. an Hebe (198), Migheve mah cates! modeling sa propane BEE Sofware. Heike U, Pee, M, ass, W. Bure. lier W, Wal, M- Bris, Hs ener Ty ani Gass, h (200). The VHDL Reference: A Proc. {ni Guide o Comper Add berated Ce Design (nding VHDL- ‘Eas Ion Wey an Sos ‘odghin, A. ant Haley, AF (1952). A quantitate descigtion of me “wane cet and is apation fo cnducton and exciton Innere. our of Polagy. 00-388, eae, A Boa, and Lari, E (1997), ALLAN. Gar de Fes, Franc, ition eee 3. dessin eon. Jeandel, A Bod, F, Ravi, P, and Baking, A. (1996) ULLME Un TLngage de Moiisuon, a modeling ngage la Procedngs of the (CESA'36 IMACS Matccfereee IMACS. Lh, Face Larson M: (200), Objet Model bray fo power yes sbity tes In Pocedigs ofthe 2000 Modelice Workshop. gross 383 Nason, SE, Anerson, Mand Asim KJ. (1983). Obed ‘ig at AD fr Con Senter 2s ation, SE andStetnd. (193). Idex reoton in diferent tigen equations wing dy devas. SAM Journal of Scenic Cpu, 4577-092" at (978. Sytem Danie, etc Hal (ter M. Dempsey Mand Seleg C200), Package Porn. Med ln ear or mclng sn lion vee owe a InP teadngs of he 2000 Modelo Workshop. (ver My Est, 8 Masao, (1998) yb modeling in lca tne chou dts ow pis In EEE Sporn on ‘Gaonpterided Cont Senem Dei. Ptr, €-D. (98H Toe comin nization often ge “yt SUM Jour of Sine Sete Compang, 9213-251 ating L 98, Genera Chen, Boe, Mine NY Pree M. (98) xeric apc emia complmentes es yer sce ou poi ASTEC 3: ALLAN 6. “ete eon Gn de Pane, Pc. Techel pt MLDS mo. 4038. Sin P Big, A and Sowell (1995) The neal model frat or aig sin, erson 302. Tesco Te Raa Ise of “nls Socttom, Sweden. ‘Sian (991, Ute ec er eishdug sind ier ie ting in pole Phy. Chem 2269-288. ‘rman Nagin D.C Pacha. MSs, BB Lint TN an Sawn, FH (i957), The econo ste saan Ines Sulsion ” ‘ile Ms Bowes, Elmavs, H, Brick, Mato, SB, Moles, A ‘Olson Hod One (0D Dene wet pore msg Ia Issn in Proering of he 2000 eden Workshop. “nese Hand tea R(1997, Simla of slr tema cera tear yowe la In Proceedings of he 15 IMACS Word Congest on Siete Comution Modeling and Appl Matematica 6, es erst About the Author ‘i Miche Ter Tec Spada athe Fed Research Labomtony 1 Ferd Motor Casany. He rao member ofthe Modes Asrocinon| De Tier reccied hs PRD. ros the Depron of Mechanical ta ngiceing a he University of inns, Utne Chmpaiga. His PhD. work fosted on developing rele simulon sate fr sensiity anny ‘sth apn 1 sean roe. Index eer ae a ete ain a bes oot SEES ee a 2 Sie HES ao ie a a 538 lVTRODUCTION TO PHYSICAL MODELING Wir MODELICR Senn sept 7 cre as asasansnguran — Sg ATR os SOSien eg ts, Thflue Souci seco 105 186 Sais sh SER none ‘Mo moDUCTIOW 70 PHYSICAL MODELING WITH MODELICA Ho. etn 2 ‘ne 3 re ola Spec 7 api Seria an a EER a ina ase ASAE MENA aon aes HERS SEEEAE or ee akan Sekeies reste Inder 341 sores ae eee et RE a wt vet 3 2.8.10. [38 mimRoDUCTIONTo PuSICAL MODELING Wir MODELICA Sretiraier ee Sac LE Sa P. mee SEE acon. al e295 one oe = a cee SEER om eouttaalth manana ‘eee SA 101 Engage a ae SENT son. U. sae tan {MA etmoDUCTIOW To PHSICAL MODELING WH MODELICA chin ma Z rete st ABOUT THE CD-ROM. ‘The CD-ROM included with this book features the Modlin sourcecode fr all examples as well as an evaluation copy of Dymo ‘The disk (CD-ROM) i dsibuted by Kluwer Academic Publishers with absolutely no support and no waranty from Kluwer Academic Publishers, Us or reproduction of the information onthe dick fer commercial gains sil probit Kluwer Academie Publishers shal not be ible for damage in ‘ounecton with, or arising out ofthe furnishing, peformance or te ofthe dik (CD-ROM). Dymola software CDynasin AB SimpleCar and Thennal software libraries Michael M, Tiler

Potrebbero piacerti anche