Home
Tutorial 1 - ModProd - Linköping University
Contents
1. af Automated Chassis components with ECU with ECU systems cargo door roadway ECU e g ESP courtesy Daimler e FMI development was started by ITEA2 MODELISAR project FMI is a Modelica Association Project now Version 1 0 e FMI for Model Exchange released Jan 26 2010 e FMI for Co Simulation released Oct 12 2010 Version 2 0 e FMI for Model Exchange and Co Simulation released July 25 2014 e gt 50 tools supporting it https www fmi standard org tools A 75 Copyright Open Source Modelica Consortium MODELICA Functional Mockup Units FMUs Import and export of input output blocks Functional Mock Up Units FMUs described by e differential algebraic discrete equations with time state and step events e An FMU can be large e g 100 000 variables An FMU can be used in an embedded system small overhead e FMUSs can be connected together A 76 Copyright Open Source Modelica Consortium MOD ELICA FMI in OpenModelica Model Exchange implemented FMI 1 0 and FMI 2 0 e FMI 2 0 Co simulation is under development A prototype of FMI 2 0 including tool co simulation is available e Ongoing work to support full FMI 2 0 The FMI interface is accessible via the OpenModelica scripting environment and the OpenModelica connection editor of OMEdit Import FMI Import FMI E Dees Output Directory Optional Browse I
2. class Color dec end Point Real blue extends Point Real green end ColoredPoint equation red blue green 1 end Color class ColoredPointWithoutInheritance The inherited fields from Point keep Real x their protection status since that extends clause Is preceded by public protected Real red protected Real blue equation red blue green 1 end ColoredPointWithoutInheritance A protected element cannot be accessed via dot notation 104 Copyright Open Source Modelica Consortium Mo vi LICA Exercises Part Il 30 minutes 105 Copyright Open Source Modelica Consortium M nnt CA Exercises Part Il tmn OMNotebook part of OpenModelica Start gt Programs gt OpenModelica gt OMNotebook e Open File Exercises ModelicaTutorial onb from the directory you copied your tutorial files to Note The DrModelica electronic book has been automatically opened when you started OMNotebook Open Exercises Modelica I utorial pdf also available in printed handouts 4 106 Copyright Open Source Modelica Consortium MOD ELICA Exercises 2 1 and 2 2 See also next two pages Open the Exercises ModelicaTutorial onb found in the Tutorial directory you copied at installation Exercise 2 1 Simulate and plot the HelloWorld example Do a slight change in the model re simulate and re plot Try command completion val etc class HelloWorld A simple
3. 149 Copyright Open Source Modelica Consortium me der Learn more OpenModelica www openmodelica org e Modelica Association e www modelica org e Books Principles of Object Oriented Modeling and Simulation with Modelica 3 3 A Cyber Physical Approach Peter Fritzson Modeling and Simulation ot Technical and Physical Systems Modeling and Simulation of Technical and Physical ES a Systems with Modelica Peter Fritzson http eu wiley com WileyCDA Wiley Title productCd 111801068X html e Introduction to Modelica Michael Tiller ri rs DN Y WHEY 150 Copyright Open Source Modelica Consortium MO 0 LICA Summary Multi Domain Modeling Visual Acausal Component Modeling MOD ELICA Declarative n n Hybrid Textual Language Thanks for listening Modeling 151 Copyright Open Source Modelica Consortium MO Y CA
4. Exarrplan Fon ej Fram SE Gen Al es Mathematica sables Gerten Mewsges Ir ahead Se ete 1 1 son epee fior ini mai m inoi to mada de 2 compen dam ronda ku Tus f Ta Salice fi ai armi hd 7 Tus och sues e tz bs add ge x let bul Simulation and analysis Courtesy Car model graphical view Wolfram Hesearch 50 Copyright Open Source Modelica Consortium non 4 LICA TI ET Dassault Systemes Sweden 49 N D Bevo 6555 OH P KH MAIER Time 35 oc e Sweden re e First Modelica tool on the market See 5 e Initial main focus on automotive Summary a x summary a X d I ind Uu Str summary v m gt y 1 summary y j summary a 2 a s pe Lateral acclarat e WWW dymola com summary wx yaw rate rad s SINMA NY Sutreniaty_w_2 suhoel_ sk whesl 2 E whesl 3 amp whesl 4 mat n lt gt Advanced zinzlatebo3el VernicleDynaniczsr Veniclesr Ezxperimentzs Exanplesr Doc5leLareChtarngeArd5rarirgz WI 4 Modena Y Sensation 51 Copyright Open Source Modelica Consortium MO 0 LICA Simulation X e ITI e Germany e Mechatronic systems e www simulationx com ae les Te Tem ure cmo eme Mireia perd e VALLI 52 Copyright Open Source Modelica Consortium MODELICA MapleSim tene x m oF see m LAXE Mates m gt re Tetes S ment a ren eg ZE e ge e ra Gaslini r E
5. If there is enough time Open the DrControl electronic book about control theory with Modelica and do some exercises e Open File C OpenModelica1 6 0 share omnotebook drcontrol DrControl onb nie Sett Cell format Weert Wocow Pp Fila Fee Cell Format rot Winder Filip B y d Y WI alle id e a q Transfer Function Pan qve qe auc Feedback bt n Q9 k n ur sea ta al s vishy fee Leslee neniom of de greaved questes Dee importer metodi in cirsiari cone puerro i a herdiack loop It caa he garg a rberrag Ge IG ristin h uai State Space Form S leewe of obse pr mo Semesse he EE eng we n a weyers o de renze of iniorrianaos merid kr desermm iang De future corpas of fer visam ti the Loge ques are kiran The state pace Somn fer continioui me dependent serte cam be expeessed os wen of Ln onder diiberentud pumate The dres moot w why the passe gaci n at peefermmd p dui De dera of Vis d de m tal cadis yi h pero Now try anmumeng Ze sotal value of de sign stu derwatwe intel values are afl zero and thee Laplace qusssomioag de ddfesennae equation p ch e 1 Linear Differential Equations in State Space Form HEY Y e At villa ul 5 377794 A AT si dt Higher otir Ziferrrtul eqestore can be rer gr secta alo d zetrsiked to trat orie Giiertisi beds u aquari ur a 1 7 a Pr e loge kb IS Get mr corti ze uiti Example p Now de differestal equados with 4E us deri agee te
6. gt 5 e NEN NE NC M Correct Indentation Fy H C C gt El rmlzsig case MATRIX matrix explli m runtime local list lt lisat lt list lt ComponentRet gt gt gt resl E scripts equation Lay test codegen Lay tools Eg VC7 real Util listListMaplexpll getCretFromExp resz DUtil listFlatteni resl res Util_ listFlatten resii then IN Absyn mo 3116 2008 02 04 14 44 krsta res GEN Absyn 3116 2008 02 04 14 44 krsta case RANGE start el step SOME e3 stop e2 AM Algorithm mo 2992 2007 12 22 22 17 adrpo equation Mj Builtin mo 3585 2008 05 22 07 03 adrpo 11 getCrefFromExp el h Ceval mo 3605 2008 05 27 02 48 adrpo E Classinf mo 3496 2008 04 23 11 59 krsta ClassLoader mo 3193 2008 02 15 05 17 adrpo hay Codegen mo 3585 2008 05 22 07 03 adrpo Ju Connect mo 3584 2008 05 22 06 45 adrpo AM Constants mo 3011 2007 12 22 22 36 adrpo AM Convert mo 3496 2008 04 23 11 59 krsta IS function getCrefFromExp function Returns a flattened list of the component references in an expression getCrefFromExp input Exp inExp output list lt ComponentRet gt outComponentRetLst autComponentBEBefLst matchcontinue inExp ComponentRef cr Absyn FF 4 h lui ADD L zc Problems El El console LI Bookmarks Prox det El ALG_ASSIGN Exp assignComponent Exp value 3 T i 113 errors 0 warnings 0 infos coperta nuanmer
7. der x Exercise Locate in DrModelica sin time simulate and plot Change x y exp 0 9 x cos y the model simulate plot end DAEexample Simulation in OpenModelica environment Simulate DAEexample stopTime 1 plot x SP 110 Copyright Open Source Modelica Consortium M 0 D ELICA Exercise 2 4 Model the system below Model this Simple System of Equations in Modelica XK atKNty d X y 5 y 7 EX YV xil z Fil 3 111 Copyright Open Source Modelica Consortium MOD ELICA Exercise 2 5 Functions a Write a function sum2 which calculates the sum of Real numbers for a vector of arbitrary size b Write a function average which calculates the average of Real numbers in a vector of arbitrary size he function average should make use of a function call to sum2 A 112 Copyright Open Source Modelica Consortium MODELICA Discrete Events and Hybrid Systems 113 Copyright Open Source Modelica Consortium MO B CA Hybrid Modeling Hybrid modeling continuous time discrete time modeling Continuous time Real x Voltage v Current 1 o h h na Discrete time discrete Real x Integer 1i Boolean b gt time Events e A pointin time that is instantaneous i e has zero duration e An event condition so that the event can take place e A Set of variables that are associated with the event e Some behavior associated with t
8. 000 3 000 000 4 000 000 3 000 000 2 000 000 1 000 000 O y 1998 1999 2000 2002 2003 2004 2005 2006 2008 2009 2001 2007 2010 2011 2012 2013 Z Eu m Copyright Open Source Modelica Consortium 2014 Industrial members e Bosch Rexroth AG Germany Siemens PLM California USA Siemens Turbo Sweden e CDAC Centre Kerala India Creative Connections Prague e DHI Aarhus Denmark e EDF Paris France e Equa Simulation AB Sweden e Fraunhofer IWES Bremerhaven e Frontway AB Sweden e IFP Paris France University members Austrian Inst of Tech Austria e Linkoping University Sweden UC Berkeley USA TU Berlin Insti UEBB Germany FH Bielefeld Bielefeld Germany TU Braunschweig Germany e Univ Calabria Italy e Danish Technical Univ Denmark TU Dortmund Germany TU Dresden Germany Universit Laval Canada Georgia Inst Technology USA Model based Development Tools 46 members Mar 2014 GTI USA e ISID Dentsu Tokyo Japan e ITI Dresden Germany Maplesoft Canada Ricardo Inc USA STEAG Dehli India TLK Thermo Germany Sozhou Tongyuan China VTI Link ping Sweden e VTT Finland e Wolfram MathCore Sweden e Ghent University Belgium e Halmstad University Sweden Heidelberg University Germany e TU Hamburg Harburg Germany e KTH Stockholm Sweden e Univ of Maryland Syst Eng USA Univ of Maryland CEEE USA Politecni
9. 21 EE A B array size defined e at function call time output Real sum protected Real xpower local variable xpower algorithm sum 0 xpower 1 for 1 in 1 size A 1 loop sum sum A i xpower xpower xpower x end for end PolynomialEvaluator 96 Copyright Open Source Modelica Consortium 1 2 3 4 becomes the value of the coefficient vector A and 21 becomes the value of the formal parameter x The function PolynomialEvaluator computes the value of a polynomial given two arguments a coefficient vector A and a value of x MOD ELICA Inheritance parent class to Color restricted kind of class without equations class ExpandedColor parameter Real red 0 2 child class or parameter Real blue 0 07 subclass Real green keyword denoting ane ance end ExpandedColor end Color Data and behavior field declarations equations and certain other contents are copied into the subclass 97 Copyright Open Source Modelica Consortium non 4 LCA Multiple Inheritance Multiple Inheritance is fine inheriting both geometry and color class Point Real x class Color Real y z parameter Real red 0 2 parameter Real blue 0 6 end Point class ColoredPoint Real green equation red blue green 1 multiple inheritance end Color end ColorgNiPoint class ColoredPointWithoutInheritance Real x Real y ameter Equivalent to parameter Real
10. Using Drag and Drop Composition File Edit Ver Simulation Pos Help ribh 2220 weno Components 3 5 Modelica gy Blocks 2 Constants ga Electrical CT Analog zs TE Basic i 7 Example w 7 Interfaces s 7 Lines 7 Semiconductors J Sources D ConstantCurrent ek ConstantVoltage i ExponentialsCurrent s t ExponentialsVoltage D gt ExpSineCurrent ExpSineVoltage l PulseCurrent os 2 Copyright Open Source Modelica Consortium 177 Multi Domain Electro Mechanical Modelica Model e A DC motor can be thought of as an electrical circuit which also contains an electromechanical component model DCMotor Resistor R R 100 Inductor L L 100 VsourceDC DC f 10 Ground G ElectroMechanicalElement EM k 10 J 10 b 2 Inertia load A ovy equation R L connect DC p R n EM connect R p L n r DC connect L p EM n I connect EM p DC n load connect DC n G p connect EM flange load flange G end DCMotor 28 Copyright Open Source Modelica Consortium Mo yt LCA Corresponding DCMotor Model Equations The following equations are automatically derived from the Modelica model 0 DC p i R n i EM u EM p v EM n v DC p v R n v O EM p 1 EM n 1 EM i EM p i O R p 1 L n 1 EM u EM k xEM w R p v L n v EM 1 EM M
11. Vienna Austria The 6 International Modelica conference March 3 4 2008 in Bielefeld Germany The dn International Modelica conference Sept 21 22 2009 in Como Italy The 8 International Modelica conference March 20 22 2011 in Dresden Germany The 9 International Modelica conference Sept 3 5 2012 in Munich Germany The 10 International Modelica conference March 10 12 2014 in Lund Sweden Coming 11 International Modelica conference Sept 21 23 2015 in Paris Copyright Open Source Modelica Consortium MODELICA h E l L 4 all mm WW lt a xercises Part CLA A 5 m p m uw uw gt Due um Si 12M lol yal 5 a a f e aphical modeling ell p Ss Gel al m dE A et t gt m i 1 A VATI RANGO e A C e TS m G ee 7 y E I d 7 SCH d E d A 4 d gt I I I mJ v 45 Copyright Open Source Modelica Consortium MODELICA Exercises Part Basic Graphical Modeling e See instructions on next two pages Start the OMEdit editor part of OpenModelica e Draw the RLCircuit e Simulate resistor1 indaciori E T L 1 E 100 5 I T gt pe d ae T E so The RLCircuit Simulation groundi 46 Copyright Open Source Modelica Consortium SV MOD ELICA Exercises Part OMEdit Instructions Part I Start OMEdit from the Program m
12. access to the mternal states ot sue mt z 3 9 J have to reconstruct the state of the system based o model KalmanFeedback i The idea with an observer is that we feedback the parameter Real A size A 1 0 1 1 0 C p parameter Real B size A 1 107 111 i the estamtion is correct then the difference should par esl E 201 Hao parameter Real 2 1 K 2 4 3 4 Another difficulty is that the measured quantitie parameter Real 1 2 L 2 4 3 4 i i parameter Real ABL A B L AAA gt gt 9M OMNotebook Kalman onb D x Here are e denoting a disturbance in the input signa be evaluated bv the difference K Gy By using this quantity as feedback we obtain the ot parameter parameter parameter parameter parametor parameter stateSpaceNoise Kalman stateSpace A Anew stateSpace B Bnew Real Real Real Real Real Real stateSpace F Fnew stateSpaceNoise noKalman end KalmanFeedback simulate KalmanFeedback stopTime 3 BL B L 2 zeros size ABL 2 size AKC 1 AKC A K C Anew 0 1 0 0 1 4 Bnew 0 1 0 0 Fnew 1 0 0 0 2 4 3 4 0 0 2 4 1 0 0 2 4 0 stateS3pace C 1 0 0 0 plot Kalman stateSpace y 1 noKalman stateSpace y 1 i i true X Ax t Bull Plot by OpenModelica Now form the error as d 15 Ready 98 The differential error is 10 Copyright O Open Source Modelica Consortium Q Kalmar sta
13. b 2 Inertia load ABONA equation H L connect DC p R n emf connect R p L n DC me connect L p emf n E connect emf p DC n load connect DC n G p connect emf flange load flange G end DCMoto e 140 Copyright Open Source Modelica Consortium MO B CA Exercises Part IV Graphical Modeling Exercises using OpenModelica 141 Copyright Open Source Modelica Consortium MOD AI Graphical Modeling Using Drag and Drop Composition OMEdit OpenModelica Connection Editor DCMote File Edit View simulation FMI Export Jools SS CE XC OE Leo Libraries B se Write Diaaram x d cu Variables Browser Case Sensitive Regular Expression T Modeli ema B UsersGuide z vede me un Blocks su i H MAT DCMot ComplexBlocks i xd El emf ba StateGraph Wen El derfphi 03403 d flange Libraries ES Complex fixed del 0 533507 A internalSu S El Di Rotational Le ernal5uppo Fl k UsersGuide n gt Examples Ac t P Components F hi de de Fixed ET 3 usesupport U v 0 3403 V w 0 3403 rads CR Inertia le Disc sA Spring groundi TE Damper inductorl te SpringDamper _ K 3203 Y 33 14 142 Copyright Open Source Modelica Consortium MOD ELICA y MEG nk C File Edit View Simulation Tools Components Modelica Standar
14. can be declared by prefixing the type name to a variable name The declaration states that moon Is a variable containing an object of type CelestialBody 91 Copyright Open Source Modelica Consortium Mo vi LCA Moon Landing Rocket altitude only access inside the class access by dot notation outside the class thrust l moong moonmass ql apollo gravity apolloaltitude moon radius class MoonLanding parameter Real forcel 36350 parameter Real force2 1308 protected I L l parameter Real fthrustEndTime 210 parameter Real thrustDecreaseTime 43 2 Ls 4 Rocket name apollo13 CelestialBody NUN name moon mass 7 382e22 radius 1 738e0 equation apollo thrust if time thrustDecreaseTime then forcel else if time thrustEndTime then force2 else 0 apollo gravity moon g moon mass apollo altitude moon radius 2 end MoonLanding 92 Copyright Open Source Modelica Consortium MOD ELICA Simulation of Moon Landing Simulate MoonLanding stopTime 230 plot apollo altitude xrange 0 208 plot apollo velocity xrange 0 208 30000 4 25 5 p pDHQ 0 ua a E a LL 50 100 200 25000 100 20000 200 15000 10000 300 3000 400 It starts at an altitude of 59404 The rocket initially has a high not shown in the diagram at negative velocity when approaching time zero gradually reducing it the lunar surface This is r
15. f x u E s x u tl 0 dt X F berg f f 145 Copyright Open Source Modelica Consortium MO A CA Exercise 3 1 e Draw the DCMotor model using the graphic connection editor using models from the following Modelica libraries Mechanics Rotational Components Electrical Analog Basic Electrical Analog Sources e Simulate it for 15s and plot the variables for the outgoing rotational soeed on the inertia axis and the voltage on the voltage source denoted u in the figure in the same plot SP 146 Copyright Open Source Modelica Consortium MODELICA Exercise 3 2 e f there is enough time Add a torsional spring to the outgoing shaft and another inertia element Simulate again and see the results Adjust some parameters to make a rather stiff spring Ha Resistor Inductori 1 1 O De Constantvoltagel n E MF 1 Inertia round 147 Copyright Open Source Modelica Consortium m mr pring Inertia MOD ELICA Exercise 3 3 e f there is enough time Add a PI controller to the system and try to control the rotational speed of the outgoing shaft Verify the result using a step signal for E the PI It controller by changing its parameters in Uess W EF 1 Inerlia1 Spring Inertiaz SpeedSensar 1 148 Copyright Open Source Modelica Consortium MO A CA Exercise 3 4 DrControl
16. iiam rocket class parameter Real massLossRate 0 000277 Real altitude start 59404 Real velocity start 2003 Real acceleration Real thrust Real gravity equation thrust mass gravity mass acceleration der mass massLossRate abs thrust der altitude velocity der velocity acceleration end Rocket model Body generic body Real mass String name end Body model PLATA d constant desi g 6 6 2e 11 parameter Real radius end CelestialBody 102 Copyright Open Source Modelica Consortium MO vi LICA The Moon Landing Example using Inheritance Il inherited parameters model MoonLanding parameter Real forcel 36350 parameter Real force2 1308 parameter Real thrustEndTime 210 parameter Real thrustDecreaseTime 43 2 Rocket apollo name apollol3 mass start 1038 358 CelestialBody moon mass 7 382e22 radius 1 738e6 iname moon equation apollo thrust 1f time lt thrustDecreaseTime then forcel else if time lt thrustEndTime then force2 else 0 apollo gravity moon g moon mass apollo altitude4moon radius 2 end Landing 103 Copyright Open Source Modelica Consortium MO B CA Inheritance of Protected Elements If an extends clause Is preceded by the protected keyword all inherited elements from the superclass become protected elements of the subclass class ColoredPoint class Point MW no 2 gt gt Real se QQ Real Y 2 EY
17. motion of two or more Y SL spacecraft d Formation Center Attitude control for satellites using magnetic coils as actuators Torque generation mechanism interaction between coils and geomagnetic field Courtesy of Francesco Casella Politecnico di Milano Italy 37 Copyright Open Source Modelica Consortium Mo vi LCA System Dynamics World Society Simulation Limits to Material Growth Population Energy and Material flows 38 Fe emm di oada Dperddrdelica Consecion Editor eee o A be Bit Wee Sra Fill AL ee Een Left World3 simulation et omen Ao a Fee E TE en mm DEEN with OpenModelica Ste SSS e 2collapse scenarios close to current LL developments Se e 1 sustainable scenario Es green BB abo ation ne Bm E CO2 Emissions per rel person Ds a E USA 17 ton yr dec EN nss e Sweden 7 ton yr speri Saat India 1 4 ton yr a Bamgladesh 0 3 ton yr zm e E gi 4x o System Dynamics Modelica library by Francois Cellier ETH et al in OM distribution Warming converts many agriculture areas to deserts USA Europe India Amazonas Ecological breakdown around 2080 2100 drastic reduction of world population To avoid this Need for massive investments in sustainable technology and renewable energy sources Copyright Open Source Modelica Consortium MOD ELICA What Can You Do Need Global Sustainability Mass Movement e Book Current catastrophic scena
18. 2 7 am Cc 2 1 Integrator 1 Gain Vi Torque Inertiai Inertia2 oe E Spring A Qum LR Een SA A zz UK i tau S phi2 Component mU UST o M Level Ze q A Equation A resistor equation Causal possibilities Level R i v i v R V R 1 R v i 86 Copyright Open Source Modelica Consortium non 4 LCA Typical Simulation Process Static semantics compile time Dynamic semantics run time Modelica model e Hybrid DAE Executable __ Gelee Elaboration Equation Simulation esu Transformation amp Code generation 87 Copyright Open Source Modelica Consortium MODELICA Simple model Hello World an wi Name of model Initial condition Equation x xX Initial condition x 0 1 Yi A simple equation Continuous time Real x start 1 variable parameter Real a 1 equation Parameter constant der x a x during simulation end HelloWorld Simulation in OpenModelica environment erential equation simulate HelloWorld stopTime 2 plot x 88 Copyright Open Source Modelica Consortium non 4 LICA Modelica Variables and Constants Built in primitive data types Boolean true or false Integer Integer value e g 42 or 3 Real Floating point value e g 2 4e 6 String String e g Hello world Enumeration Enumeration literal e g ShirtSize Medium Parameters a
19. 40001 global scenariodepartB z problems OMOptim Optimization 2 0X0020mNm 2o0 0 U oc nn Misc K I Calculate all variables from selected points _ Force recomputation Multiple Shooting and Collocation Dynamic Trajectory Optimization Minimize a goal function subject to model equation constraints useful e g for NUPC Multiple Shooting Collocation Solve sub problem in each sub interval In OpenModelica 1 9 1 beta release Jan 2014 Ci 4 Xi tj441 hy f x t u t t dt F t ti 4 hi up x tj hj Ci Example speedup 16 cores MULTIPLE COLLOCATION 1 2 4 8 16 t mm mm Im Wm Im mm mm mm SES Im Im mm mm Wm Im mm mm Wm NEED S Im Im Im Im Wm Im Im Im Im Wm mm mm Wm Im mm o t mas Im Wm ipopt scaled mjac g scaled 73 Copyright Open Source Modelica Consortium non 4 LCA 74 OpenModelica Dynamic Optimization Collocation Cost Con Weight sum of the cost Residual Discrete Discrete goal constraint function function equations Gradient Jacobian Collocation technique Discrete NLP Hessian Copyright Open Source Modelica Consortium m 772 A General Tool Interoperability amp Model Exchange Functional Mock up Interface FMI etc
20. 8359e 308 double getValueMultiphedByTwo at simulationmodel mo 13 eqFunction 3 at simulationmodel mo 5 vi CAUsers adeas31 workspaceMDT HelloWorld SimulationModel exe List of Stack Frames gen _ _ a SimulationModel mo ii i Variables View B ES Outline x E anita x e model SimulationModel getValueMultipliedByTwo Real x start 1 inValue Real IN heo ad z 1 o outValue Real OUT algorit x getValueMultipliedByTwo x M SimulstionModel y i Xj o x end SimulationModel oy function getValueMultipliedByTwo input Real inValue output Real outValue axila me De 1 20 Output View 62 Copyright Open Source Modelica Consortium M T CA DE i S ier Ora if e e fo qoc Correct Indentation Build project File Edit Navigate Search Run Project Window Help gt 9g Breakpoints Tm MDT GDB Modelica Developement Tooling MDT GDB ae MDT gi Main Thread stepping ANEP ae Ow GA at quotedfunction mo 5 Ceval_cevalCallFunction at Ceval mo 1294 try H 7 05 2 E TIVA Av br Ceval_ceval at Ceval mo 318 Interactiwe_evaluateExpr at Interactrve mo 935 Interactive evaluateExprToStr at Interactive mo 985 Interactive evaluate at Interactive mo 507 Interactive evaluateToStdQut at Interactive mo 3298 Interactive evaluateToStdQut at Interactive mo 333 Interactive evaluateToStdQut at Interactive mo 333 Le m
21. Beta4 released MODELICA The Ope www openmodelica org odelica Open Source Environment e Advanced Interactive Modelica compiler OMC OMEdit graphic Editor e Supports most of the Modelica Language e Modelica and Python scripting e Basic environment for creating models e OMShell an interactive command handler e OMNotebook a literate programming notebook Plot by Openfdodetza D rM odel jC odaia Edinon Copyright c Lik pong Universiv PELAB 2003 1007 Wiky IEEE Press Modelica Association Costect Open odebcadinls Buse OpenSiodesca Progect web de Peter Sand ee or Ll 55 Copyright Open Source Modelica Consortium e OMDebugger for equations e OMOptim optimization tool OM Dynamic optimizer collocation e ModelicaML UML Profile e MetaModelica extension e ParModelica extension Bie Ham ops rua PHN a deed Lir ze r1 EE P EFEEIrE a MAAN KE amp Pal IEEE ope del e 16000000880808 Jk sitt Fr Lex q bh s DC CO ene k ap lO mm Da reiia m y d A D fe E won eT LA OSMC International Consortium for Open Source 96 Lines Founded Dec 4 2007 Open source community services Website and Support Forum e Version controlled source base e Bug database Development courses e WWW openmodelica org Code Statistics ftrunk Lines of Code 8 000 000 7 000 000 6 000
22. D ED NP UA ORT UE x i Ta Name Value Description 41 PHmized variables Z Ic glabal saurcee aude ville h 1 18294e 06 Jikg Description Opt Minima n E global sourceeaudeville AowPort p 100000 global sourceEfAuentsB debit kaka Er global sourceInEchColdBh 1 413476 06 kal global sourceEFuents debit lass coutdinvestissement gaincoutoperationnel global sourceInEchColdB AowPort p 100000 global scenari x Em C Oz2PACI global sourceInEchColdB debit 12 78 kq 5 2h global sourceEMuentsECS h 1 35495e 06 1Jkg Le glabal saurceEFRuentsE CS AowPort p 100000 Puissae i Puissbe glabal saurceEFRuentsE CS etat 1 i Puissce Description Scan Minimum Scan Maximum E Di na global saurceEHuentsE CS debit 1 D global sourceEMuentsE C5 debit 1 nr glabal saurceEFRuentsB h 1 354352 06 och global sourceEMuentsB HowPart p 100000 caukdeFanckavecPAC glabal saurceEFRuentsE etat 1 2 ee glabal saurceEFRuentsE debit 1 226 12 TOSygmaECs global sourceE Huents h 1 35495e 06 H COPEC System m Wm mm i PElecEC 5 Max glabal sourceEffluentzA MowPort p 100000 Name Description Direction KH EchIAOuECald global gaincoutoperationnel Maximize global sourceEFluentsA etat 1 H echA H Sourcemod scenariaEchA H scenarioPACA echB rose Components Launch global sourceERfluentzA debit 0 501234 global coutdinvestissement Minimize global scenariosourceE audeville debit 0 3
23. EM k EM J EM w EM M EM b x EM w O L p 1 EM n i L p v EM n v DC u DC p v DC n v O DC p 1 DC n 1 O EM p 1 DC n 1 DC i DC p i EM p v DC n v DC u DC Amp x Sin 2 zn DC f xt O DC n i G p i load component not included DC n vV G p v Automatic transformation to ODE or DAE for simulation dx f x u E s x u tl 0 dt X F berg f f 29 Copyright Open Source Modelica Consortium Mo yt LCA Model Translation Process to Hybrid DAE to Code Modelica Graphical Editc Modelica Modelica Source code Modelica Model Textual Editor amp mmm Modelica Model Frontend pa Modeling Flat model Hybrid DAE Environment NNNM Middle end Sorted equations Optimized sorted equations Backend C Code Executable SP 30 Copyright Open Source Modelica Consortium M 0 D ELICA Modelica in Power Generation GTX Gas Turbine Power Cutoff Mechanism power control startTime 400 i load drop startTime variableDampePettiae d Inertial S art imeziD S p E 1 B EHI Fee ba clutch ven Arm Turki load qain TA ue i AP LL Add do P AIT m s an Lay zero T Rampi i m io Developed by MathCore Courtesy of Siemens Industrial Turbomachinery AB 31 for Siemens Copyright Open Source Modelica Consortium MOD ELICA Modelica in Automotive Industry 32 Copyright Open Source
24. IN a ALG CATCH list AlgorithmItem gt catchBody ALG EQUALITY Algorithm equ ALG FAILURE Algorithm equ ALG FOR Forlterators iterators listzAlgorithmItem forBo ALG GOTO String labelName were Code Outline for ALG MORETCALL ComponentRe ALG RETURN ALG THROW easy navigation within ALG TRY list lt Algorithmltem gt tryBod en online rmitomod mo OQpenModelica tools rml2mod ALG WHEN A Exp whenStmt list lt Al VEO oco Mod e li C d f1 les een on line rmitamad ma OnenMndelica tanls rml mnd NN da of 254M Lo Ctrl Contrib Bottom H fz Errors 100 of 113 items The identifier at start and end are different The identifier at start and end are different The identifier at start and end are different pa Da en on line Hovering OpenModelica tools rml2mod ken online rmltomod mo OpenModelica tools rml2mod rmidump mo en online modrefacto OpenModelica tools rml2mod cu So Dr mir a Dr a nic x a on ou en s on line moddump mo OpenModelica tools rml2mod en on line rmltomod mo OpenModelica tools rml2mod Debug 21 eet 0 m3 De Sis 7 a 0 oo variables 53 9e Breakpoints MDT Data Stack 58 El MM rr 77 Simulation Model Modelica Developement Tooling MDT GDB Name Declared Type Value Actual Type 18 MDT inValue Real 1 double aff Main Thread stepping outValue Real 6 945328072060
25. Image Plot by OpenModelica Req 001 is instantiated 2 times there are 2 tanks in tank height is 0 6m Req 001 for the tank2 is violated e dim tanki h the system D dm tankz h Qr 1 Lenk violated iron tants violated Req 001 for the tank1 is not violated 83 Copyright Open Source Modelica Consortium M 0 D ELICA vVDR Method virtual Verification of Designs vs Requirements Actor Task Created Artifact Requirement Monitor Models Analyze Modify Designs Alternative Models Le Scenario Models Goal Enable on demand Verification Models verification of designs AUTOMATED against requirements using automated model AUTOMATED composition at any time during development 84 Copyright Open Source Modelica Consortium non 4 LCA Part Ill Modelica language concepts and textual modeling parent class to Color restricted kind of class without parameter Real red equations parameter Real blue class ExpandedColor parameter Real red a4 s child class or gd Real blue 0 ES subclass keyword denoting Ah r anti end ExpandedColor end Color Typed Declarative Equation based Textual Language Hybrid Modeling 85 Copyright Open Source Modelica Consortium non 4 LICA Acausal Modeling The order of computations is not decided at modeling time Acausal Causal 10 S phi G7 tau
26. Introduction to Object Oriented Modeling and Simulation with Modelica and OpenModelica Tutorial Version Feb 03 2015 Peter Fritzson Link ping University peter fritzson liu se Director of the Open Source Modelica Consortium ot E Tei 71 Vice Chairman of Modelica Association SoS Senet see CENE re h snus Mahder Gebremedhin PhD student ky Coq 7 e mahder gebremedhin liu se sifet a ETE p Slides E ret Wea ssaa Based on book and lecture notes by Peter Fritzson ee 0 lis Contributions 2004 2005 by Emma Larsdotter Nilsson Peter Bunus Ment Went ie ter Uu Contributions 2006 2008 by Adrian Pop and Peter Fritzson nn PA Contributions 2009 by David Broman Peter Fritzson Jan Brugard E and Mohsen Torabzadeh Tari Contributions 2010 by Peter Fritzson Contributions 2011 by Peter F Mohsen T Adeel Asghar FIT Contributions 2012 2013 2014 2015 by Peter Fritzson Lena ak Buffoni and Mahder Gebremedhin VALLI PS e Link pings universitet 2015 02 03 MODELICA Tutorial Based on Book 2004 Download OpenModelica Software Peter Fritzson PRINCIPLES OF Principles of Object Oriented OBJECT ORIENTED MODELING AND Modeling and Simulation with Modelica 2 1 SIMULATION Wiley IEEE Press 2004 940 pages WITH MODELICA 2 1 OpenModelica www openmodelica org e Modelica Association e www modelica org PETER FRITZSON 2 Copyright Open Source Modelica Consort
27. Modelica 2004 940 pages Wiley IEEE Press ISBN 0 471 47163 1 Ail of the examples and exercises im DrModelica and the page references are from that book Most of the text in DrModelica is also based on that book Detailed Copyright and Acknowledgment Information OpenModelica commands Berkeley license OpenModelica A Quick Tour of Modelica Getting Started First Basic Examples There is a long tradmon that the first sample program m any computer language a trmal program printing the string Hello World p 19 in Peter Friteson s book Since Modelica is an equation based language printing a string does not make much sence Instead our Hello World Modehca program solves trivial age The s second example shows how you can write a model that solves a gt System p 19 In the Van der Pol p 22 example declaration as well as intisliratic n and prefix usage are shown tn a shghtly more compbcated way Classes and Instances In Modehca objects are created unphcaly just by Declanng Instances of Classes p 26 Almost anything m Modelica is a class but there are some keywords for specific use of the class concept called Getting Started Using OMNotebook OMnotebook Interactive Electronic Notebook Here Used for Teaching Control Theory OM OMNotebook Kalman onb cae e S File Edit Cell Insert Window Help Format o dh kW en P A gt 1 Kalman Filter cocco Often we dont have
28. Modelica Consortium non 4 LCA Modelica in Avionics Inputs Outputs S EM GSTAAD m toEngine Engine 33 Copyright Open Source Modelica Consortium non 4 LICA Modelica in Biomechanics 34 Copyright Open Source Modelica Consortium MOD 4 LICA Application of Modelica in Robotics Models Real time Training Simulator for Flight Driving Using Modelica models generating real time code Different simulation environments e g Flight Car Driving Helicopter e Developed at DLR Munich Germany e Dymola Modelica tool Courtesy of Martin Otter DLR Oberphaffenhofen Germany 35 Copyright Open Source Modelica Consortium MOD ELICA Combined Cycle Power Plant Plant model system level e GT unit ST unit Drum boilers unit and HRSG units connected by thermo fluid ports and by signal buses Low temperature parts condenser feedwater system LP circuits are represented by trivial boundary conditions e GI model simple law relating the electrical load request with the exhaust gas temperature and flow rate ECO Courtesy Francesco Casella Politecnico di Milano Italy and Francesco Pretolani CESI SpA Italy SH2 RH2 SHI RH EV SH_IP ECO EV P 36 Copyright Open Source Modelica Consortium Mo yt LCA Modelica Spacecraft Dynamics Library Formation flying on elliptical orbits j spacecraft Perigee Control the relative
29. Ye TU oo fi de cr kraza a Optimizing the Design of an ice Tank Carriage Powers De soltion m Es sa dE Feed oe E ef a datum c 1 Coe nis z wee e EJ EU i TUM l sete A e rH td on Pec Pague wen d ag ee Porta Dots ces Wen Fuma wo a nato P A Lei bu qui ese gt ke gt EE y si Mee seg e ves gt x i Pare ected em he Appio oe si cam Dm es eed Probas Guy Spard friisi idy peed i m1 CE 1 i 1 eteo sp due to breaking ke ium cd cecilMen base OU takty able ta dewied qued La 2 m Before After Cm ome 53 Copyright Open Source Modelica Consortium Maplesoft Canada Recent Modelica tool on the market Integrated with Maple www maplesoft com ATT MODELICA The OpenModelica Environment www OpenModelica or 20973087 ARA PAN ot LOSS IA eee EGG ain ae E HOME DOWNLOAD Top information TIS Industrial Products ag Commercial Applications using Openmodelica OME dit Enhanced OpenModelica Connection Editor Library Coverage Latest library coverage iilii Modelica OpenModelica Videos Overview of Modelica lt A e n hu be TOOLS amp APPS USERS DEVELOPERS FORUM EVENTS Introduction OPENMODELICA is an open source Modelica based modeling and simulation environment intended for industrial and academic usage Its long term development is supported by a non profit organ
30. asted work Total Profit Completion Kate 50 TES 100 NN 50 NN goo II 50 a i Wi P ei Total Profit Total Profit Total Profit s ea A 4M Work in KE eg Balancing ae Available Qu Resource Resources uerg y Adequacy Time Week va y MOD ELICA Requirement Capture System Simulation Business Process Control Compilation amp Code Gen Requirements Capture Model Driven Design vVDR virtual Verification of Sof amp I 3 E Gg Designs against Requirements System Produc in ModelicaML UML Modelica Profile part of OpenModelica OpenModelica based simulation Class Components Tree 23 amp Em aso aT E instantiated eM For Es1 Fill and Drain Tank Verification Mqdel H JC sm spe environment 2 l JE ws Es1 Fill and drain tant 9 Provider from Design M el y 214 reg_002 Fil mode _ behavior 5 design model ee reg DU idle mode behavior 4 d J E reg O01 tant Filing time 7 LN Scenario M el Ce Violation Monitor 1 Binding Ea rmand clienti inpu tankIsEempty sm_s Requirement i Sal mand client input Rank seingFilled em spies environment spas tank pLiquidr illir ain massFlowRate gt 0 Models f gg mand clienti input tankIsFull em spws environment spe tank level gt 0 98 lEal Real timeLimit 300 AA Ep Mela Client from requireme
31. ble class VanDerPol Van der Pol oscillator model declarations Real x start 1 Descriptive string for x Real y start 1 y coordinate parameter Real lambda 0 3 equation Typed der x y der y x lambda 1 x x y Declarative end VanDerPol Equation based Textual Language 23 Copyright Open Source Modelica Consortium M a D 4 LICA Differential equations What is Special about Modelica O Multi Domain Modeling Visual Acausal Component Modeling Continuous time Discrete time Clocked discrete time Typed Declarative Equation based Textual Language Hybrid Modeling 24 Copyright Open Source Modelica Consortium MOD 4 LICA Modelica Faster Development Lower Maintenance than with Traditional Tools Block Diagram e g Simulink or Proprietary Code e g Ada Fortran C vs Modelica Causality Systems Derivation Definition Modeling of mE Syston Subsystems manual derivation of Decomposition input output relations Implementation Simulation Proprietary ee REN werte EEN 25 Copyright Open Source Modelica Consortium MO yt LICA Modelica vs Simulink Block Oriented Modeling Simple Electrical Model Modelica Keeps the Simulink Physical model physical Signal flow model hard to easy to understand structure understand 26 Copyright Open Source Modelica Consortium non 4 LCA Graphical Modeling
32. book Principles of ier Oriented Modeling and Simulation with Modelica 2 1 copyright Wiley IEEE Press some examples and figures reproduced with permission from Modelica Association Martin Otter Hilding Elmavist Wolfram MathCore Siemens Modelica Association www modelica org OpenModelica www openmodelica org 4 Copyright Open Source Modelica Consortium M OD ELICA 6 3 Ll a gt um Y EEE EE op Part Introduction to Modelica and a demo example Part Ill Modelica language concepts and textual modeling ce Copyright Open Source Modelica Consortium Part Il Modelica environments Part IV Graphical modeling and the Modelica standard library Mechanics 18 PID Control System MOD ELICA Detailed Schedule afternoon version 14 00 Introduction to Modeling and Simulation Start installation of OpenModelica including OMEdit graphic editor 14 10 Modelica The Next Generation Modeling Language 14 25 Exercises Part 15 minutes Short hands on exercise on graphical modeling using OMEdit RL Circuit 14 50 Part ll Modelica Environments and the OpenModelica Environment 15 10 Part III Modelica Textual Modeling 15 15 Exercises Part Illa 80 minutes Hands on exercises on textual modeling using the OpenModelica environment 15 45 Coffee Break 16 00 Modelica Discrete Events and Hybrid Properties 16 15 Exercises Part Ilib 10 minu
33. co di Milano Italy Ecoles des Mines CEP France Malardalen University Sweden Univ Pisa Italy Telemark Univ College Norway 4 MODELICA OMNotebook Electronic Notebook with DrModelica ag Ot ell Detod efcas ont Fie Edt Cel Format Insert Widow Help Primarily for teaching Interactive electronic book Platform independent Commands 57 Shift return evaluates a cell File Menu open close etc Text Cursor vertical Cell cursor horizontal Cell types text cells amp executable code cells Copy paste group cells Copy paste group text Command Completion shift tab Copyright Open Source Modelica Consortium Version 2006 04 11 DrModelicamedetica Edition Copyright c Linkoping University PELAB 2003 2006 Wiley IEEE Press Modelica Association Contact OpenModebca gida bu se OpenModebca Project web site www ida lu se projects OpenModebca Book web page www mathcore convdrModekca Book author Peter Fntzson ida lm se DiModelca Authors 2003 version Susanna Monema Eva Lena Lengquist Sandelin Peter Fntzson Peter Bunus DrModelica Authors 2005 and later updates Peter Frizeon This DrModelica notebook has been developed to facilitate learning the Modelica language as well as providing an introduction to object oriented modeling and simulation It is based on and is supplementary material to the Modelica book Peter Butzen Principles of Object Oriented Modeling and Simulation with
34. d Library Modelica Modelica Library Help 4 BB 2220 wenomo Bx D x Messages OMEdit Version 1 6 0 OpenModelica Version 1 6 0 Multi Domain Electro Mechanical Modelica Model e A DC motor can be thought of as an electrical circuit which also contains an electromechanical component model DCMotor Resistor R R 100 Inductor L L 100 VsourceDC DC f 10 Ground G ElectroMechanicalElement EM k 10 J 10 b 2 Inertia load A ovy equation R L connect DC p R n EM connect R p L n r DC connect L p EM n I J connect EM p DC oi load connect DC n G p connect EM flange load flange G end DCMotor 144 Copyright Open Source Modelica Consortium MO yt LICA Corresponding DCMotor Model Equations The following equations are automatically derived from the Modelica model 0 DC p i R n i EM u EM p v EM n v DC p v R n v O EM p 1 EM n 1 EM i EM p i O R p 1 L n 1 EM u EM k xEM w R p v L n v EM 1 EM M EM k EM J EM w EM M EM b x EM w O L p 1 EM n i L p v EM n v DC u DC p v DC n v O DC p 1 DC n 1 O EM p 1 DC n 1 DC i DC p i EM p v DC n v DC u DC Amp x Sin 2 zn DC f xt O DC n i G p i load component not included DC n vV G p v Automatic transformation to ODE or DAE for simulation dx
35. da ef n i i Van der Pol Model LOI a da m la ES mts ITIN mm mm mas he e e eee me Too me lee eg go Be Riga pio ei Le pe Pd a ea dd a ta n si heht e db maiya go uem m ma pi ms Sen que as Defi a ced e B b vere Edi AT AA k s De d s duh aS as as RT Beie x gt d e i F PA el mm a Qum Age is c ls A Anna B s I he EE ONLUS E e mami a La dial l islam a Vas eng Saas ame is Temes der n ke menes lt de Pa ll lidia dami p gt eas d De J i a Crotti pl si oe el am der Pel ape ME Pa De Bas e Beki ia a E ual Bn re Fd bey Ta om la p H Ba e A bul ere Sevier th a Ea piu DH bee pirimi a g a ne dep go errs aa D D D D D E a Copyright Open Source Modelica Consortium ce Der IA autrice E Optmizing the Design of an Ice Tank Carriage see Ld Tresor yo Lg 4 xen xi D ET E pS w me m te na eem er Modot fe Cysamics of an ice em Carriage ne E o MODELI Wolfram System Modeler Wolfram MathCore 2225 e Wolfram Research pr Ra DOC GA de fd MM e a e 43i 4 4 mg Cl cc em USA Sweden zeg General purpose 8 me Mathematica integration a mz www wolfram com E Mak donatores Lr lt lt JA s lc Danen www mathcore com e ee H tzt
36. e shops simpler life style Mahatma Gandhi Non sustainable 42 USA 17 ton CO2 Sweden 7 ton CO2 yr High meat consumption 1 kg beef uses ca 4000 L water for production Hamburgers unhealthy includes beef Energy consuming mechanized agriculture Transport dependent shopping centres stressful materialistic lifestyle Copyright Open Source Modelica Consortium Gandhi role model for future less materialistic life style o MODELI CA Brief Modelica History First Modelica design group meeting in fall 1996 e International group of people with expert knowledge in both language design and physical modeling e Industry and academia e Modelica Versions 1 0 released September 1997 e 2 0 released March 2002 e 2 2 released March 2005 3 0 released September 2007 3 1 released May 2009 e 3 2 released March 2010 e 3 3 released May 2012 e 3 2 rev 2 released November 2013 3 3 rev 1 released July 2014 Modelica Association established 2000 in Link ping Open non profit organization 43 Copyright Open Source Modelica Consortium MOD ELICA Modelica Conferences 44 The 18 International Modelica conference October 2000 The 2 International Modelica conference March 18 19 2002 The 3 International Modelica conference November 5 6 2003 in Link ping oweden The 4 International Modelica conference March 6 7 2005 in Hamburg Germany The 5 International Modelica conference September 4 5 2006 in
37. educed to until touchdown at the lunar zero at touchdown giving a smooth surface when the altitude is zero landing SP 93 Copyright Open Source Modelica Consortium MOD ELICA Specialized Class Keywords 94 Classes can also be declared with other keywords e g model record Doc Connector CICCIO an Classes declared with such keywords have specialized properties Restrictions and enhancements apply to contents of specialized classes After Modelica 3 0 the class keyword means the same as model Example Modelica 2 2 A model is a class that cannot be used as a connector class Example A record Is a class that only contains data with no equations Example A block is a class with fixed input output causality model CelestialBody constant Real g 6 672e 11 parameter Real radius parameter String name parameter Real mass end CelestialBody Copyright Open Source Modelica Consortium MO 0 LICA Modelica Functions Modelica Functions can be viewed as a specialized class with some restrictions and extensions e A function can be called with arguments and is instantiated dynamically when called i means assignment function sum input Real argl input Real arg2 output Real result algorithm result argltarg 2 end sum 95 Copyright Open Source Modelica Consortium Mo yt LCA Function Call Example Function with for loop Example Modelica function call p polynomialEvaluator 1 2 3 4
38. elpers sfllanigulwte on the chetiemar y tt colts 67 Copyright Open Source Modelica Consortium M T CA Py gt imulator Package e PySimulator a simulation and analysis package see ee developed by DLR Free downloadable Uses OMPython to simulate Modelica weier SECS OpenModelica gt 68 Copyright Open Source Modelica Consortium MODELICA Modelica3D Library 69 Modelica 3D Graphics Library by Fraunhofer FIRST Berlin Part of OpenModelica distribution Can be used for 3D graphics in OpenModelica Copyright Open Source Modelica Consortium M O0 D ELICA Extending Modelica with PDEs for 2D 3D flow problems Research class PDEModel Insulated boundary HeatNeumann h iso Dirichlet n heatedig 20 HeatRobin h glass h heat 30000 HeatTransfer ht Rectangle2D dom Poorly insulated boundary equation end PDEModel 70 Prototype in OpenModelica 2005 PhD Thesis by Levon Saldamli www openmodelica org Currently not operational dom eq ht doms DO Es OR Glass domt LOD eecht 1907 diego 1807 com erte aech heated Conducting boundary Copyright O Open Source Modelica Consortium OMOptim Optimization 1 MinEIT Fie Project Problem Display Tools Models Problems Project Optimization EI El result Variables B DI i Va Filter Db m
39. ely partial model TwoPin I e e e e e e e x ml partial class cannot be electrical connector class instantiated 1 us flow Current end Pin positive pin negative pin TwoPin TwoPin is same as OnePort in Modelica Electrical Analog Interfaces 127 Copyright Open Source Modelica Consortium MO 0 LICA Electrical Components model Resistor Ideal electrical resistor extends TwoPin parameter Real R equation R 1 v end Resistor model Inductor Ideal electrical inductor extends TwoPin parameter Real L Inductance equation L der 1 v end Inductor model Capacitor Ideal electrical capacitor extends TwoPin parameter Real C equation 1 C der v end Capacitor 128 Copyright Open Source Modelica Consortium MO vi LICA Electrical Components cont model Source extends TwoPin parameter Real A w equation V A sin w time end Resistor model Ground Pin DI equation Du U end Ground 129 Copyright Open Source Modelica Consortium M 0 D ELICA Resistor Circuit model ResistorCircult Resistor R1 R 100 Resistor R2 R 200 Resistor R3 R 300 Zee m Rai E DL T EE e B connect R1 p connect Rl p end ResistorCircult 130 Copyright O Open Source Modelica Consortium MO B CA Modelica Standard Library Graphical Modeling e Modelica Standard Library called Modelica is a Standa
40. enu under OpenModelica e Goto File menu and choose New and then select Model e E g write RLCircuit as the model name For more information on how to use OMEdit go to Help and choose User Manual or press F1 Under the Modelica Library Contains The standard Modelica library components The Modelica files contains the list of models you have created 47 Copyright Open Source Modelica Consortium MO yt LICA Exercises Part OMEdit Instructions Part Il 48 For the RLCircuit model browse the Modelica standard library and add the following component models e Add Ground Inductor and Resistor component models from Modelica Electrical Analog Basic package e Add SineVoltage component model from Modelica Electrical Analog Sources package Make the corresponding connections between the component models as shown in slide 38 Simulate the model e Goto Simulation menu and choose simulate or click on the simulate button in the toolbar gt Plot the instance variables Once the simulation is completed a plot variables list will appear on the right side Select the variable that you want to plot SP Copyright Open Source Modelica Consortium MOD ELICA 49 Part Il Modelica environments and OpenModelica TE eee AX a ei n P ro Rp dike Ph Bre a Cu mes Doha Mets e del y Ke Y eva Wee He OT we Sek SI M Pr I s MAL we tt r mat 83 I H d np ta je
41. ep LJ InitialStepWithSignal Be ota StateGraphRoot Parallel PartialCompositeStep trans Ron bol Step StepWithSignal Transition Transition withSignal gt kal Thermal 136 Copyright Open Source Modelica Consortium MO B CA Other Free Libraries 137 WasteWater ATPlus MotorCycleDymanics NeuralNetwork VehicleDynamics SPICElib SystemDynamics BondLib MultiBondLib ModelicaDEVS ExtendedPetriNets External Media Library VirtualLabBuilder SPOT Wastewater treatment plants 2003 Building simulation and control fuzzy control included 2008 Dynamics and control of motorcycles 2009 Neural network mathematical models 2006 Dynamics of vehicle chassis obsolete 2003 Some capabilities of electric circuit simulator PSPICE 2003 System dynamics modeling a la J Forrester 2007 Bond graph modeling of physical systems 2007 Multi bond graph modeling of physical systems 2007 DEVS discrete event modeling 2006 Petri net modeling 2002 External fluid property computation 2008 Implementation of virtual labs 2007 Power systems in transient and steady state mode 2007 Copyright Open Source Modelica Consortium MODELICA Some Commercial Libraries e Powertrain e SmartElectricDrives e VehicleDynamics e AirConditioning e HyLib e PneuLib e CombiPlant e HydroPlant 138 Copyright Open Source Modelica Consortium MO 0 LICA Connecting Components fro
42. equation Real x start 1 equation der x x end HelloWorld simulate HelloWorld stopTime 2 plot x Locate the VanDerPol model in DrModelica link from Section 2 1 using OMNotebook Exercise 2 2 Simulate and plot VanDerPol Do a slight change in the model re simulate and re plot 107 Copyright Open Source Modelica Consortium Mo yt LICA Exercise 2 1 Hello World A Modelica Hello World model Equation x X class HelloWorld A simple equation Initial condition x 0 1 parameter Real a 1 Heal x start 1 equation der x a x end HelloWorld Simulation in OpenModelica environment simulate HelloWorld stopTime 2 plot x 108 Copyright Open Source Modelica Consortium MOD ELICA Exercise 2 2 Van der Pol Oscillator Class VanDerPol Van der Pol oscillator model Real x start 1 Descriptive string for x x starts at l Real y start 1 y coordinate y starts at 1 parameter Real lambda 0 3 equation der x y This is the 1st diff equation der y x lambda 1 x x y This is the 2nd diff equation end VanDerPol simulate VanDerPol stopTime plotParametric x y 109 Copyright Open Source Modelica Consortium MO B CA Exercise 2 3 DAE Example Include algebraic equation class DAEexample Real x start 0 9 Algebraic equations contain Bun wi no derivatives equation der y 1 0 5 sin y
43. esolvel R rel frame a f 329 frame b t Frames resolvel R rel frame a t 330 end if DE der x time 3 expand derivative symbolic diff der x time E der x time 4 solve Eder x time MODELICA OpenModelica Simulation in Web Browser Client MultiBody RobotR3 FullRobot aah Gin Pages Safety Tool RRC OpenModelica simulation example Modelica Mechanics MultiBody Examples Systems RobotR3 fullRobot Simulation finished Time 00 40 xample Examples Systems RobotR3 fullRobot simulation inset Fare DO 40 Tolerance OpenModelica compiles to efficient Java Script code which is executed in web browser 65 Copyright Open Source Modelica Consortium non 4 LCA Interactive Simulation Simulation Control Simulation Center source flowLevel Simulation Time 00 01 56 220 Status Simulation is running Examples of Simulation Visualization Plot View Requirements View File Edit Ha Requirements Status Info History Show violations 2 v 1 Req 001 tanki A Violation warning Show violations 2 _ _ _ Requirements 1 Start Time 22 sec End Time 50 sec i Start Value tanki 8 m poo a E Maximum Value tank1 15 m Req 002 source Evaluation View 2 Start Time 95 sec End Time 110 sec N Start Value tanki 8 m e d li Click for m
44. f no Output Directory specified then the FMU files are generated in the current working directory Log Level Warning Debug Logging d Generate input connector pins V Generate output connector pins This feature is experimental Most models are not yet handled by it 77 Copyright Open Source Modelica Consortium MO yt LICA OPENPROD Large 28 partner European Project 2009 2012 Vision of Cyber Physical Model Based Product Development a cc c c Ge Feedback Business Process Control Requirements Capture Model Driven Design Compilation amp Code Gen System Simulation Software amp System Product OPENPROD Vision of unified modeling framework for model based product development Open Standards Modelica HW SW and UML SW 78 Copyright Open Source Modelica Consortium MOD ELICA OPENPROD Model Based Development Environment Covers Product Design V System Simulation Business Process Compilation amp Code Gen Requirements Capture _ Model Driven Design dhftware amp WA stem Produc Level of Abgtraction System Maintenance requirements O J Prpduct verification and Ww deployment Preliminary feature desk bubsystem level integration test calibration and verification Subsystem level integration and ve
45. he event e g conditional equations that become active or are deactivated at the event 114 Copyright Open Source Modelica Consortium MO yt LICA Event Creation if if equations if statements and if expressions model Diode Ideal diode If lt condition gt then extends TwoPin true if Ec equations elseif condition then Real s Boolean off equations l equation if equation choosing else lt equations gt oft US i if off then equation for v V s else end if 1 1f off then 0 else end Diode end if 115 Copyright Open Source Modelica Consortium MO DELICA Event Creation when when equations when lt conditions gt then lt equations gt end when event 1 event 2 event 3 Equations only active at event times Time event State event when time gt 10 0 then when sin x 0 5 then end when end when Only dependent on time can be Helated to a state Check for scheduled in advance zero crossing 116 Copyright Open Source Modelica Consortium MO B CA Generating Repeated Events The call sample t0 d returns ee true and triggers events at times t0 i d where i 0 1 time t0 2d t0 3d t0 4d Variables need to be discrete model SamplingClock Creates an event x SI Integer 1 discrete Real r alter 2 3 then equation each 0 5 s when sample 2 0 5 then i 1 pre i 1 prer 0237 end when T end Sampli
46. ium MO yt LICA Introductory Modelica Book Introduction to September 2011 232 pages Modeling and Simulation 1 of Technical and 2014 Translations Modelicai amp zi Sit Physical Systems available in BUR TB FC UE IR S AA Chinese PER with Modelica Japanese Peter Fritzson Spanish nur _ i Wiley IEEE Press For Introductory Short Courses on Object Oriented Mathematical Modeling WILEY cu PETER FRITZSON 3 Copyright Open Source Modelica Consortium MOD ELICA New Big Modelica Book 2014 PRINCIPLES OF OBJECT ORIENTED MODELING AND SIMULATION wm MODELICA 3 3 A CYBER PHYSICAL APPROACH SECOND EDITION Copyright Open Source Modelica Consortium Peter Fritzson Principles of Object Oriented Modeling and Simulation with Modelica 3 3 A Cyber Physical Approach Can be ordered from Wiley or Amazon Wiley IEEE Press 2014 1250 pages OpenModelica e www openmodelica org e Modelica Association e www modelica org SP MOD ELICA Acknowledgements Usage Copyrights If you want to use the Powerpoint version of these slides in your own course send an email to peter fritzson ida liu se Thanks to Emma Larsdotter Nilsson Peter Bunus David Broman Jan Brug rd Mohsen Torabzadeh Tari Adeel Asghar Lena Buffoni for contributions to these slides Most examples and figures in this tutorial are adapted with permission from Peter Fritzson s
47. ization the Open Source Modelica Consortium OSMC The goal with the OpenModelica effort is to create a comprehensive Open Source Modelica modeling compilation and simulation environment based on free software distributed in binary and source code form for research teaching and industrial usage We invite researchers and students or any interested developer to participate in the project and cooperate around OpenModelica tools and applications n AA ge 1 ba eel ntn Register yourself to get information about new releases Participate in the OpenModelicalnterest mailing list Help us get the latest source code or nightiy build and report bugs To learn about Modelica read a book or a tutorial about Modelica For systems engineering with requirement traceability and verification see ModelicaML 54 Copyright Open Source Modelica Consortium RESEARCH Latest news October 25 2014 OpenModelica 1 9 1 released Preliminary Program OpenModelica Annual Workshop 2015 October 07 2014 OpenModelica 1 9 1 Beta4 released March 08 2014 OpenModelica 1 9 1 Beta2 released New Book Peter Fritzson Principles o Object Onented Modeling and Simulatiq with Modelica 3 3 February 02 2014 OpenModelica 1 9 Betai released CFP OpenModelica Workshop Februa 2014 October 09 2013 OpenModelica 1 9 0 released September 27 2013 OpenModelica 1 9 0 RC1 released February 1 2013 OpenModelica 1 9 0
48. m xed phi Copyright Open Source Modelica Consortium substitute boxBodyl body frame a R T 1 xBodyl frameTranslation frame a R T 1 1 solve world frame b f 2 boxBodyl ame_b R T 2 2 revolutel frame b f 2 scalarize 2 world frame b f 1 worl rame b R T 2 2 revolutel frame_b f 2 simplify boxBodyl frame b R T 1 1 1 frame b f 2 revolutel frame_b f 3 inline Modelica Mechanics MultiBody Fr e_b f 2 1 0 revolutel frame b f 3 substitute Modelica Mechanics MultiBo frame_b f 2 revolutel frame b f 3 EET Source View Source Browser OpenModelica trunk build Mechanics MultiBody Joints mo 31 relationships between quantities of frame a and of frame b frame b r 0 frame a r 0 showing equation transformations of a model if rooted frame a R then 321 R rel Frames planarRotation e phi offset phi w 322 frame b R Frames absoluteRotatig a R R rel 323 frame a f Frames resolvel R rel frame b f 324 frame a t Frames resolvel R rel frame DCH y der x time z substitution der x time z der x time 170 25 else 326 R rel l 2 simplify Frames planarRotation y der x time waje 0 phi offset phi w j frame a R Frames absoluteRotatid b R R rel 328 frame b i Frames r
49. m Multiple Domains e Block domain e Mechanical domain e Electrical domain Electrical te domain Mechanical domain model Generator Modelica Mechanics Rotational Accelerate ac Modelica Mechanics Rotational Inertia iner Modelica Electrical Analog Basic EMF emf k 1 Modelica Electrical Analog Basic Inductor ind 1 0 1 Modelica Electrical Analog Basic Resistor R1 R2 Modelica Electrical Analog Basic Ground G Modelica Electrical Analog Sensors VoltageSensor vsens Modelica Blocks Sources Exponentials ex riseTime 2 riseTimeConst 1 equation connect ac flange b iner flange a connect iner flange b emf flange b connect emf p ind p connect ind n R1 p connect emf n G p connect emf n R2 n connect Rl n R2 p connect R2 p vsens n connect R2 n vsens p connect ex outPort ac inPort end Generator 139 Copyright Open Source Modelica Consortium MO 0 LICA DCMotor Model Multi Domain Electro Mechanical A DC motor can be thought of as an electrical circuit which also contains an electromechanical component model DCMotor Resistor R R 100 Inductor L L 100 VsourcevDe DO f 10 Ground G EMF emf k 10 J 10
50. n Magnetic flux potential flux rate Hydraulic Pressure Volume flow Volume OpenHydraulics Heat Temperature Heat flow Heat HeatFlowlD Chemical Chemical Particle flow Particles Under potential construction Pneumatic Pressure Mass flow Air SI oe 124 Copyright O Open Source Modelica Consortium MOD ELICA connect equations Connections between connectors are realized as equations in Modelica connect connectorl connector2 The two arguments of a connect equation must be references to connectors either to be declared directly within the same class or be members of one of the declared variables in that class Pin pinl pin2 A connect equation fin Modelica lt pinl v pin2 v A A eg ae pinl i pin2 1 0 SPN 125 Copyright Open Source Modelica Consortium M 0 D ELICA Connection Equations Pin A EDI t A connect equation E A Corresponds to pinl v pin2 v pinl i pin2 i 0 Multiple connections are possible connect pin1 pin2 connect pin1 pin3 connect pin1 pinN Each primitive connection set of potential variables Is used to generate equations of the form y V SV SV n Each primitive connection set of flow variables is used to generate sum to zero equations of the form kilo E Ges Pera rU 126 Copyright Open Source Modelica Consortium Mo vi LICA Common Component Structure The base class TwoPin has two connectors p and n for positive and negative pins respectiv
51. ngClock pre takes the previous value 5 1 before the event 117 Copyright Open Source Modelica Consortium MO 0 LICA Reinit Discontinuous Changes The value of a continuous time state variable can be instantaneously changed by a reinit equation within a when equation bh height model BouncingBall the bouncing ball model 12 in parameter Real g 9 81 gravitational acc parameter Real c 0 90 elasticity constant Real height start 10 velocity start 0 equation der height velocity der velocity g when height lt 0 then reinit velocity c velocity end when end BouncingBall 0 10 Initial conditions Reinit assigns continuous time variable velocity a new value 118 Copyright Open Source Modelica Consortium Mo vi LICA Exercise 2 6 BouncingBall Locate the BouncingBall model in one of the hybrid modeling sections of DrModelica the When Equations link in Section 2 9 run it change it slightly and re run it Plot by OpenModelica height 8 velocity m M anu id SP 119 Copyright Open Source Modelica Consortium MOD EL CA Part IV components Connectors and Connections Modelica Libraries and Graphical Modeling 120 Copyright Open Source Modelica Consortium MOD 4 LICA Software Component Model Interface Acausal coupling Connector Component Connection Component Causal coupling A component class should be defined inde
52. nt model Sal output evaluationStarted El reqveriFication verdick 4 81 Copyright Open Source Modelica Consortium Hope Ee A OpenModelica ModelicaML UML Profile SysML UML to Modelica OMG Standardization ModelicaML is a UML Profile for SW HW modeling Applicable to pure UML or to other UML profiles e g SysML e Standardized Mapping UML SysML to Modelica Defines transformation mapping for executable models Being standardized by OMG ModelicaML Defines graphical concrete syntax graphical notation for diagram for representing Modelica constructs integrated with UML e Includes graphical formalisms e g State Machines Activities Requirements e Which do not exist in Modelica language e Which are translated into executable Modelica code e Is defined towards generation of executable Modelica code Current implementation based on the Papyrus UML tool OpenModelica 82 Copyright Open Source Modelica Consortium Mo yt LCA Example Simulation and Requirements Evaluation models wolankssystemExamole Systema imulatons Tank5ystemSimulation Plot Window Seles File El components dm TanksConnectedPl El requirementinstance HO tank1 Max level of liquid in a tank quirementinstances HOT tank Max level of liquid in a tank ementinstances MU tank1 Volume of the tank Edit Insert Tools Help Open Save Print Select Zoom Pan Grid Hold Preferences Active
53. obenerator c m QuotedFunction mo function Y ALE T Yep Daf input Real Y D vn D A Yo output Real FIYA dub 0 algorithm EA RE Eee end ALE Yep D El Console MDT GDB Modelica Developement Tooling MDT GDB G OpenModelica trunk testsuite bootstrapping main exe true Declared Type Real Real SNR 8B OpenModelica Equation Model Debugger 64 Ei OMEdit Transformational Debugger Va ri a bles Vi QW OpenModelica OMEdit Modelica Mechanics MultiBody Examples Elementary DoublePendulum_info xml Variables Defined InEquations Used In quations Type ef Case Sensitive Regular Expression e Sei Variables El boxBodyl Equation Type Equation Comment Absolut frame_a Absolut frame_a Operations pues boxBodyl body frame a R T 1 1 boxBodyl frame_b R T 1 1 Positio d frame El frame a Absolut frame Transfo l frame uations e Type Equation r world frame b f 2 boxBodyl frame b R T 1 2 regular assignm er a rel boxBodyl frame b R T 2 2 revolutel frame h f 1 revolutel frame b f 2 regular assignm olute2 a regular assignm era rel regular assignm e a f 2 regular assignm e_a f 1 regular assignm e b f 2 La Operations regular assignm e_b f 1 regular assignm e b t 2 regular assignm e b f 2 regular assignm e b t 2 regular assign
54. ore i Maximum Value tank 11 m in ModelicaML this Requirement Status Simulation is running Formulartitel MaxLevel Liquid Domain Specific Source Visualization View Status Simulation is running OMPython Python Scripting with OpenModelica e Interpretation of Modelica commands and expressions e Interactive Session handling Library Tool Y e rem not dd mo cb ke tes Y c c sport OMPython OMPython execute 10ad 11e c OpenModelical 8 1 testmodelsa BbouncinghBall ehrn tesult OMPython execute simslate bouscingBall stopTimse 2 methode Kuleri print result Clery then execute pl Le th Me KE im ziii i OMPython execu a et hera appdata ge s Mocalitemplopensodelica Gei id 20 201208251207561 Ir ge EIERE y estore lo storeIntenp False cf Optimized Parser results D ROIG o tate Liens ee EE EE Simulationmesults timecompi le 6 8981306279206 el end 0 0229111689831523 mes sages timefront 0 024 3992104508437 timesimulation 0 Kik Ba timerempiate 9 0208 379911344139 timesimcode 0 00999736303670383 time Total 7 1078098383753 resultrile PC Users ganan642 amp ounci ngnall res sat H omc has been Shutdown e Helper functions e Deployable Extensible and Distributable C WWsers ganan642 gt Get Set M
55. ource Modelica Consortium MO LICA Modelica Background Stored Knowledge Model knowledge is stored in books and human minds which computers cannot access Internal combustion engines 417 iio dc comparative cycle as shown in the p V und T S diagrams The change of motion is proportional Se mas ES to the motive force impressed added per unit of gas is Leal Cur ont gas tu urbin ee erplants achie qa cp Ta T2 Cp Ta Ta thermal e ffici er ci p to d NI A and the quantity of he L be removed is haust without supplementary emissions 4 Te T en Ta Ti control devices extremely smooth run mE CW O A fou ning multifu el c ga ra ee E static E que EM inte um the dan EE ene Gd rthe interva MIS wit hs at exchanger Disadvantages manu ns high E nal response higher Nin 1 CowQin 1 T2 T1 T3 T4 fu en sumption GE uitable for low Lex II x er Oi ssor Mutationem motus proportionalem effe vt motrici impreffe C fieri fe cundum lineam rekam qua vis illa o 12 Copyright Open Source Modelica Consortium MO 0 LICA Modelica Background The Form Equations Equations were used in the third millennium B C Equality sign was introduced by Robert Recorde in 1557 i xe e L T T Que EK o 1 Ai Newton still wrote text Principia vol 1 1686 The change of motion is proportional to the motive force impressed CSSL 1967 introduced a special fo
56. pendently of the environment very essential for reusability A component may internally consist of other components I e hierarchical modeling Complex systems usually consist of large numbers of connected components 121 Copyright Open Source Modelica Consortium MODELICA Connectors and Connector Classes Connectors are instances of connector classes electrical connector connector class keyword flow 1 indicates that currents of connected pins sum to zero an instance pin of class Pin mechanical connector connector class Position flow Force end Flange an instance flange of class Flange 122 Copyright Open Source Modelica Consortium MO vi LICA The low prefix Two kinds of variables in connectors Potential variables potential or energy level e Flow variables represent some kind of flow Coupling e Equality coupling for non 10ow variables e Sum to zero coupling for flow variables The value of a flow variable is positive when the current or the flow is into the component positive flow direction 123 Copyright Open Source Modelica Consortium Mo yt LICA Physical Connector Classes Based on Energy Flow Domain Potential Flow Carrier Modelica Type Library El ical Electrical Voltage Current Charge Analog f T l Mechanical Translational Position Force Linear momentum translational Angular Mechanical Rotational Angle Torque MONENA orione Magnetic E Pu
57. ration Modeling Language Declarative language Equations and mathematical functions allow acausal modeling high level specification increased correctness Multi domain modeling Combine electrical mechanical thermodynamic hydraulic biological control event real time etc Everything is a class strongly tyoed object oriented language with a general class concept Java amp MATLAB like syntax Visual component programming Hierarchical system architecture capabilities Efficient non proprietary Efficiency comparable to C advanced equation compilation e g 300 000 equations 150 000 lines on standard PC 17 Copyright Open Source Modelica Consortium MODELICA Modelica Acausal Modeling What is acausal modeling design Why does it increase reuse The acausality makes Modelica library classes more reusable than traditional classes containing assignment Statements where the input output causality is fixed Example a resistor equation SNE V can be used in three ways i v R V Ri R v i SP 18 Copyright Open Source Modelica Consortium MOD ELICA What is Special about Modelica Multi Domain Modeling Visual acausal hierarchical component modeling Typed declarative equation based textual language e Hybrid modeling and simulation 19 Copyright Open Source Modelica Consortium Mo yt LCA What is Special about Modelica Multi Domain Cyber Physical Modeling 3 domains dean electric Phy
58. rdized predefined package developed by Modelica Association e t can be used freely for both commercial and noncommercial purposes under the conditions of The Modelica License Modelica libraries are available online including documentation and source code from Nttp www modelica org library library html 131 Copyright Open Source Modelica Consortium Modelica Standard Library cont The Modelica Standard Library contains components from various application areas including the following sublibraries 132 Blocks Constants Electrical Icons Fluid Math Magnetic Mechanics Media Slunits Stategraph Thermal Utilities Library for basic input output control blocks Mathematical constants and constants of nature Library for electrical models Icon definitions 1 dim Flow in networks of vessels pipes fluid machines valves etc Mathematical functions Magnetic Fluxtubes for magnetic applications Library for mechanical systems Media models for liquids and gases Type definitions based on SI units according to ISO 31 1992 Hierarchical state machines analogous to Statecharts Components for thermal systems Utility functions especially for scripting Copyright Open Source Modelica Consortium MODELICA Modelica Blocks El Nests Continuous discrete and logical input output blocks 4 Blocks El continuous tO build block diagrams gt Discrete El Examples gt El Interfaces gt Logical Math
59. re constant during simulation Two types of constants in Modelica constant constant Real PI 3 141592653589793 e parameter constant String redcolor red constant Integer one 1 parameter Real mass 22 5 89 Copyright Open Source Modelica Consortium Mo vi LCA A Simple Rocket Model thrust mass gravity acceleration Rocket mass thrust D rere mass massLossRate abs thrust I mg altitude velocity velocity acceleration Se Rama eS Se declaration new non class Rocket rocket class comment parameters changeable parameter String name before the simulation Real mass start l0s0 393 7 Real altitude start 59404 floating point Real velocity Start 2003 start value type Real acceleration Real thrust Thrust force on rocket Real gravity Gravity forcefield parameter Real massLossRate 0 000277 name default value equation thrust mass g uo y Wi mass acceleration mathematical der mass massLossRate abs thrust equation acausal der altitude velocity differentiation with der velocity acceleration regards to time end Rocket 90 Copyright Open Source Modelica Consortium non 4 LICA Celestial Body Class A class declaration creates a type name in Modelica class CelestialBody constant Real g 6 672e 11 parameter Real radius parameter String name parameter Real mass end CelestialBody An instance of the class
60. red parameter Real blue Real green equation red blue green 1 end ColoredPointWithoutinheritance 98 Copyright Open Source Modelica Consortium MOD ELICA Multiple Inheritance cont Only one copy of multiply inherited class Point Is kept class Point Real x Real y end Point class VerticalLine class Horizontalline extends Point extends Point Real vlength Diamond Inheritance Real hlength end Verticalline end Horizontalline class Rectangle extends VerticalLine extends HorizontalLine end Rectangle 99 Copyright Open Source Modelica Consortium non 4 LICA Simple Class Definition e Simple Class Definition e Often used for Shorthand Case of Inheritance introducing new e Example names of types type Resistor Real Equivalent to connector MyPin Pin class SameColor inheritance extends Color end SameColor 100 Copyright Open Source Modelica Consortium Mo yt LCA Inheritance Through Modification Modification is a concise way of combining inheritance with declaration of classes or instances e A modifier modifies a declaration equation in the inherited class e Example The class Real Is inherited modified with a different start value equation and instantiated as an altitude variable Real altitude start 59404 A 101 Copyright Open Source Modelica Consortium MOD ELICA The Moon Landing Example Using Inheritance I Rocket IE model Rocket A
61. rification Architectural desigi a system functional design Detailed feature design e implementation Component verification Realization 79 Copyright Open Source Modelica Consortiu l l l Documentation Version and Configuration Management MODELICA Business Process Control and Modeling v y y SS VTT Simantics Simulation _ eren Requirements fi MedelDriven B Compilation Business process modeler LAS Rs Capture Design amp Code Gen Control Software amp System Produc OpenModelica compiler amp simulator OpenModelica based simulation Metso Business model amp simulation a n n n n gt El imantics Graphic Modeling To Pa n n n m Ps Simulation of 3 strategies with T Ww ux M a Ou tcomes STRATEGY 2 STRATEGY 3 E e a E Wasted change requests Wasted Errors c Profit SS 1 400 000 4 1 400 000 1 400 000 q Remborcing p 1 200 000 ime 4 7 200 000 emm P BM AM Average schedule x 1000000 4 000 000 __ 1 000 000 era Performance B 890 000 E 800 000 i 600000 600 000 4 600 000 ales X Es Average Quali i sr as Q ty 400 000 400 000 400 000 aes D Performance ees 200 000 Project Start N 0 0 Wasted work Total Profit Wasted work Total Profit W
62. rios Mark Lynas 6 Degrees Book How to address the problems Tim Jackson Prosperity without Growth e Promote sustainable lifestyle and technology e Install electric solar PV panels e Buy shares in cooperative wind power Elstatistik 2013 2014 m Producerad solel 1500 4 Exporterad solel netto F rbrukning el 1000 amp Importerad el netto n p SA maj juni juli aug sept okt nov dec jan feb mars april Expanded to 93 sqm 12 kW March 2013 House produced 11600 kwh used 9500 kwh Avoids 10 ton CO2 emission per year 20 sqm solar panels on garage roof Nov 2012 Generated 2700 W at noon March 10 2013 39 Copyright Open Source Modelica Consortium Mo vi LCA Example Electric Cars Can be charged by electricity from own solar panels Renault ZOE 5 seat Range EU drive cycle 210 km Realistic Swedish drive cycle e Summer 165 km e Winter 100 110 km Cheap fast supercharger DLR ROboMObil experimental electric car Tesla model S e Modelica models range 480 km 40 Copyright Open Source Modelica Consortium Mo vi LCA ka d E d E da b x LU v Y rt G i ej P y I d al ph EI H U e yr boe j M i 41 Copyright Open Source Modelica Consortium M 0 DE LICA Sustainable Society Necessary for Human Survival Almost Sustainable India 1 4 ton CO2 person year Healthy vegetarian food small scale agriculture small scal
63. rm of equation variable expression v INTEG F m Programming languages usually do not allow equations 13 Copyright Open Source Modelica Consortium Mo yt LCA What is Modelica A language for modeling of complex cyber physical systems e Robotics e Automotive e Aircrafts e Satellites e Power plants e Systems biology CP MODELICA 14 Copyright Open Source Modelica Consortium MO DELICA What is Modelica A language for nodeling of complex cyber physical systems Mechanics Electric Reference Sensor PID Control System Primary designed for simulation but there are also other usages of models e g optimization 15 Copyright Open Source Modelica Consortium MO yt LICA What is Modelica afanguage fanguage tor modeling of complex cyber physical systems Le Modelica is not a tool Free open language de There exist several free and commercial specification tools for example OpenModelica from OSMC e Dymola from Dassault systems e Wolfram System Modeler fr Wolfram MathCore e SimulationX from ITI MapleSim from MapleSoft AMESIM from LMS JModelica org from Modelon Available at www modelica org MWORKS from Tongyang Sw amp Control Developed and standardized IDA Simulation Env from Equa by Modelica Association e CyModelica Modeling tool ESI Group 16 Copyright Open Source Modelica Consortium Mo yt LCA Modelica The Next Gene
64. rm ti described with Ge help of a pol Ny Terres tig riw varies x and x oe Dur Re cwn CETT che spend of a car pr She gd The cor has a res ri welocky c and bus b a s x ay Pf A eases GEN CP COR WY s 13 9 PTF ana coeant o The Bm Dee road der m Fico e dh cun can ke arde de pote det r TTT OTETTA U Lem ovn My i ay meg aint er Tan poivrerr s farson h called tbe rente hunctimn of de vem dad a Gis The Ze differestal agrarios can be sepersenteci o ruso Amais are the ms of de deser which b the same ds De mors D fe Chas I The cen are the nama to the rees of de tramaler Arm The tenere Laplace mami Siti ote este vac Sao table lemer n Moim Br i mad Ae high shu Called de weight fenction amd is Ce impulse sesporse of the aem In Madelica he maast 4510 a Mt e a FIC asvir att ov em wem BETA E mp ceda amp a ver paco diliereatali Forti Therefore the dal cdas ae sopera afgift 13 004 dul Try wilh u Z it ditam Widi mt metabo de apurar ras ars duc birar ja mp HU tus 7 0 E ym P 4 ol s a hy nj l wi Now int el P LI pen Loop 1 8 a loaduoge mode lica j gel EN ad Lil model rot eed bod ci import SI Hodelica 1snits Zen dw tiger ceder diiezergie audi cas be writes ma mor compact ferr St velecity y Ze cate signal sittout r x Anta duit ADise rbera 8o cr viel o8 H DE TOU Ep ue la pra mai doe KS parar gd ena miri arias i Yu Cur 2 Transferfunction to State Space Form
65. sical mechanics N control Mechanics Electric Reference Sensor Cyber OS PID Control System 20 Copyright Open Source Modelica Consortium M a D 4 LICA What is Special about Modelica Multi Domain Visual Acausal Modeling Keeps the physical Hierarchical structure Component Modelino Rampi Torque Inertia Spring Inertia2 Acausal model St 77 m we umm Modelica n fa MT c 5 duraton 2 J 10 J 2 LI 5 a LT Integrator I Causal B e block based model Simulink sali lau A 21 Copyright O Open Source Modelica Consortium MO vi LICA What is Special about Modelica Multi Domain Hierarchical system Visual Acausal Modeling modeling Hierarchical a Component Modelino Srel n transpose n identity 3 n transpose n cos q skew n sin q wrela n qd zrela n qdd Sb Sa transpose Srel rUb rUas vb Srel va wb Srel wa wrela ab Srel aa B zb Srel za zrela cross wa wrela inertial Courtesy of Martin Otter MP 22 Copyright Open Source Modelica Consortium MODELICA What is Special about Modelica Visual Acausal Multi Domain Hierarchical Component Modeling Modeling A textual class based language OO primary used for as a structuring concept Behaviour described declaratively using Differential algebraic equations DAE continuous time Event triggers discrete time Varia
66. step 1 gt Nonlinear gt Routing ju Examples gt Types gt Constants d al Electrical d Icons gt Math gt Mechanics gt Slunits gt bad StateGraph Thermal feedback PIT limiter states pace 133 Copyright Open Source Modelica Consortium Mo vi LICA Modelica Electrical Electrical components for building analog digital and multiphase circuits a Library ay Library Library Y Analog Digital Machines MultiPhase Examples AndGate 1 Gnd7 Gnd8 A 134 Copyright Open Source Modelica Consortium MODELICA Modelica Mechanics Package containing components for mechanical systems Subpackages e Rotational 1 dimensional rotational mechanical components e Translational 1 dimensional translational mechanical components e MultiBody 3 dimensional mechanical components i I Ble AA alzi tau TE TEERT ll _ ui Diese damper a Ch fixed J gt PA E 135 Copyright Open Source Modelica Consortium MOD EL CA Modelica Stategraph 4 Modelica gt El Blocks Hierarchical state machines similar to Statecharts gt Constants gt a Electrical M p a Icons gt x Math p Mechanics b Slunits 4 StateGraph p Examples ew Interfaces b ew Temporary UsersGuide E Alternative InitialSt
67. tes Hands on exercises on textual modeling using the OpenModelica environment 16 25 Part IV Components Connectors and Connections Modelica Libraries 16 45 Graphical Modeling using OpenModelica 17 00 Exercises Part IV 30 minutes DCMotor etc Hands on exercises on graphical modeling using OpenModelica T Copyright Open Source Modelica Consortium MODELICA 8 Software Installation Windows e Start the software installation e Install OpenModelica 1 9 2beta exe from the USB Stick Copyright Open Source Modelica Consortium MODELICA Software Installation Linux requires internet connection e Goto httos openmodelica org index php download down load linux and follow the instructions 9 Copyright Open Source Modelica Consortium Mo vi LICA Software Installation MAC requires internet connection Go to httos openmodelica org index php download down load mac and follow the instructions or follow the instructions written below e The installation uses MacPorts After setting up a MacPorts installation run the following commands on the terminal as root echo rsync build openmodelica org macports gt gt opt local etc macports sources conf assuming you installed into opt local port selfupdate e port install openmodelica devel Copyright Open Source Modelica Consortium MODELICA Part Introduction to Modelica and a demo example 11 Copyright Open S
68. tespace y 1 O nokalman stateSpace y 1 Ready Ln 12 Col Y MOD ELICA m OpenModelica Environment Demo File Edit View Simulation FMI Tools Help 1HB 222 nOBOEN C 20 ve AmE Components 5 x GV Unit E Modelica Files ThermoSysPro i UncertaintiesDemo P amp 100 Modules e D Approximated O Gv Un O GV Unit Approx M SG Unit Propag M SG Unit Reconci ERIT 222 escent ae ap 20 A Tm se ae um Test 5 DEEN 477411 59 Copyright Open Source Modelica Consortium el em Dn Teese oeaio ae arc Ate sot perenni Tree whet thor Cortar RAM OCT geet L0 Tees Cp ad d asset z n rann vem gei cohen ro LIA es ln 001107 ate Mat md presi reo Gei orbem dte G01 SG rk Amat zf nen fren mat soho Cerda GAI SG codone a ze la n OpenModelica MDT Eclipse Plugin Browsing of packages classes functions e Automatic building of executables separate compilation Eclipse Platform e Syntax highlighting Code completion Code query support for developers e Automatic Indentation e Debugger Prel version for algorithmic subset 60 Copyright Open Source Modelica Consortium MP MOD ELICA OpenModelica MDT Code Outline and Hovering Info Modelica OpenModelica Compiler Absyn mo Eclipse SDK E mi xj File Edit Navigate Search Project Run Field Assist Window Help E a pes D gt L id 5 A
Download Pdf Manuals
Related Search
Related Contents
Manual de instrucciones HD オプチカル マルチプレックスユニット de gravité d`une toxicomanie (IGT) - Grille de correction Samsung PS-42C91H Hướng dẫn sử dụng Copyright © All rights reserved.
Failed to retrieve file