Modelica- a Cyber-Physical Modeling Language and the Openmodelica Environment

Modelica- a Cyber-Physical Modeling Language and the Openmodelica Environment

Modelica- A cyber-physical modeling language and the OpenModelica environment Peter Fritzson Linköping University Post Print N.B.: When citing this work, cite the original article. ©2011 IEEE. Personal use of this material is permitted. However, permission to reprint/republish this material for advertising or promotional purposes or for creating new collective works for resale or redistribution to servers or lists, or to reuse any copyrighted component of this work in other works must be obtained from the IEEE. Peter Fritzson , Modelica- A cyber-physical modeling language and the OpenModelica environment, 2011, Wireless Communications and Mobile Computing Conference (IWCMC), 2011, 1648-1653. http://dx.doi.org/10.1109/IWCMC.2011.5982782 Postprint available at: Linköping University Electronic Press http://urn.kb.se/resolve?urn=urn:nbn:se:liu:diva-110300 Modelica – A Cyber-Physical Modeling Language and the OpenModelica Environment Peter Fritzson, Senior Member, IEEE Abstract— Modelica is a modern, strongly typed, declarative, and VHDL-AMS/Verilog-AMS (multi-physics but primarily equation-based, and object-oriented (EOO) language for for electronics, and therefore often not general enough). modeling and simulation of complex cyber-physical systems. In recent years, integrated model-based design of complex Major features are: ease of use, visual design of models with cyber-physical systems (which mix physical dynamics with combination of lego-like predefined model building blocks, software and networks) has gained significant attention. ability to define model libraries with reusable components, support for modeling and simulation of complex applications Hybrid modeling languages based on equations, supporting involving parts from several application domains, and many both continuous-time and event-based aspects (e.g. more useful facilities. This paper gives an overview of some Modelica, SysML, VHDL-AMS, and Simulink/ Simscape) aspects of the Modelica language and the OpenModelica enable high level reuse and integrated modeling capabilities environment – the most complete Modelica open-source tool of both the physically surrounding system and software for for modeling, simulation, and development of Modelica embedded systems. Using such equation-based object- applications. Special features are MetaModeling for efficient model transformations, the ModelicaML profile for UML- oriented (EOO) modeling languages, it has become possible Modelica cyber-physical hardware-software modeling, as well to model complex systems covering multiple application as generation of parallel code for multi-core architectures. domains at a high level of abstraction through reusable model components. I. INTRODUCTION large number of modeling and simulation tools are A. Modelica Background Aavailable on the market. Most tools are very specialized In 1996 several first generation object-oriented and only address a specific application domain. These tools mathematical modeling languages and simulation systems usually have incompatible model formats. (ObjectMath [25], Dymola [23], Omola [29], NMF [31], However, certain tools are of a more general nature. For gPROMS [19], Allan, Smile, etc.) had been developed. modeling and simulation of dynamic systems, we have e.g. However, the situation with a number of different the following de-facto standards: incompatible object-oriented modeling and simulation Continuous: Matlab/Simulink [28], MatrixX/ languages was not satisfactory. Therefore, in the fall of SystemBuild, Scilab/Scicos, ACSL, etc. for general 1996, a group of researchers from universities and industry systems, SPICE and its derivates for electrical circuits, started work towards standardization and making this ADAMS, DADS/Motion, SimPack, SimMechanics, etc. object-oriented modeling technology widely available. This for multi-body mechanical systems, ANSYS, FEMLAB, language is called Modelica [2][1] and designed primarily etc. for finite-element analysis, etc. for modeling dynamic behavior of engineering systems; Discrete: general-purpose simulators based on the moreover, meta-modeling extensions have been developed discrete-event GPSS line, VHDL- and Verilog [26]. The language has become a de facto standard. simulators in digital electronics, etc. The language allows defining models in a declarative manner, modularly and hierarchically and combining Hybrid (discrete + continuous): Modelica, gPROMS various formalisms expressible in the more general [19], AnyLogic, VHDL-AMS and Verilog-AMS Modelica formalism. The multidomain capability of simulators (not only for electronics but also for multi- Modelica allows combining electrical, mechanical, physics problems), etc. hydraulic, thermodynamic, etc., model components within The insufficient power and generality of the former the same application model. modeling languages has stimulated the development of Compared to most widespread simulation languages Modelica (as a true object-oriented, multi-physics language) available today this language offers several important advantages: This work was supported in part by Vinnova in the OPENPROD project, by SSF under the HIPo and EDOp projects, and by the Swedish Research Object-oriented mathematical modeling. This technique Council. Address: PELAB – Programming Environment Lab, Dept. Computer makes it possible to create model components, which are Science, Linköping University, SE-581 83 Linköping, Sweden. Email: employed to support hierarchical structuring, reuse, and [email protected] evolution of large and complex models covering multiple technology domains. 978-1-4577-9538-2/11/$26.00 ©2011 IEEE 1648 Acausal modeling. Modeling is based on equations proceeded through a number of design meetings (the 69:th instead of assignment statements as in traditional January 2010), a nonprofit Modelica Association was started input/output block abstractions. Direct use of equations in Linköping, Sweden year 2000, and a conference series significantly increases re-usability of model components, was started the same year, with the 8th conference in since components adapt to the data flow context in which Dresden March 2011. Several commercial implementations they are used. Interfacing with traditional software is of Modelica (i.e., subsets thereof) are available, including also available in Modelica. Dymola [22] [24], MathModelica [27], and IDA [20]. Part Physical modeling of multiple application domains. of this presentation primarily focuses on the OpenModelica, Model components can correspond to physical objects in which is currently the major Modelica open-source tool the real world, in contrast to established techniques that effort and most complete open source environment. require conversion to “signal” blocks with fixed input/output causality. In Modelica the structure of the model naturally correspond to the structure of the B. An Example Modelica Model physical system in contrast to block-oriented modeling tools such as Simulink. For application engineers, such The following is an example Lotka Volterra Modelica model “physical” components are particularly easy to combine containing two differential equations relating the sizes of into simulation models using a graphical editor. rabbit and fox populations which are represented by the A general type system that unifies object-orientation, variables rabbits and foxes: The rabbits multiply; the multiple inheritance, components/connectors, and foxes eat rabbits. Eventually there are enough foxes eating templates/generics within a single class construct. rabbits causing a decrease in the rabbit population, etc., Hierarchical system architectures can easily be described causing cyclic population sizes. The model is simulated and with Modelica thanks to its powerful component model. the sizes of the rabbit and fox populations as a function of Components are connected via the connection mechanism time are plotted in Fig. 2. realized by the Modelica system, which can be visualized in r abbits connection diagrams. The component framework realizes f oxes components and connections, and ensures that 5 000 communication works over the connections. For systems composed of acausal components with 4 000 behavior specified by equations, the direction of data flow, 3 000 i.e., the causality is initially unspecified for connections between those components. Instead the causality is 2 000 automatically deduced by the compiler when needed. 1 000 Components have well-defined interfaces consisting of t ports, also known as connectors, to the external world. A 2 00 4 00 600 800 1 000 component may internally consist of other connected components, i.e., hierarchical modeling. Fig. 1 shows Fig. 2. Number of rabbits – prey animals, and foxes - predators, hierarchical component-based modeling of an industry as a function of time simulated from the PredatorPrey model. robot. More information on Modelica robot models can for example be found in [32], [33], [34], and [35]. Methods for The notation der(rabbits) means time derivative of the real-time simulation, e.g. in [36]. rabbits (population) variable. class LotkaVolterra axis6 parameter Real g_r =0.04 "Natural growth k2 rate for rabbits"; i axis5 qddRef cut joint parameter Real d_rf=0.0005 "Death rate of qdRef qRef k1 r3Control r3Motor r3Drive1 tn 1 1 i 1 S S rabbits due to foxes"; qd parameter Real d_f =0.09 "Natural deathrate l axis4 Kd qdRef for foxes"; 0.03 S axis3 parameter Real g_fr=0.1 "Efficency in rel qRef pSum Kv sum wSum rate2 rate3 iRef +1 b(s) 340.8 0.3 +1

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    7 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us