260 likes | 276 Vues
This presentation introduces Modelica to the SysML community and proposes efforts to integrate Modelica and SysML for descriptive modeling in SysML and formal executable modeling in Modelica. It covers an overview of Modelica, its features, and the Modelica Standard Library. The text explains the object-oriented modeling in Modelica using a Sliding Mass example and discusses the acausal, equation-based nature of Modelica. It explores the benefits of Modelica, its appeal, and explains the Modelica Standard Library and its applications. The presentation also touches upon the OpenModelica Project, providing insight into the open-source Modelica environment and its tools.
E N D
OMG, Santa Clara, December 2008 SysML and Modelica:Opportunities for Synergy Chris Paredis, Peter Fritzson, Russell Peak Georgia Institute of Technology Linköping University
Intent of Presentation • Introduce Modelica to SysML community • Propose an effort to explore an integration between Modelica and SysML further: Descriptive Modeling in SysML + Formal Executable Modeling for Analyses and Trade Studies in Modelica
Overview • Modelica overview • What is Modelica? • What makes Modelica so appealing? • The Modelica Standard Library • The OpenModelica Project • SysML – Modelica Synergy • SysML – Modelica Correspondence • Steps Forward • Summary • Additional References
What is Modelica? • State-of-the-art ModelingLanguage for System Dynamics • Differential Algebraic Equations (DAE) • Discrete Events • Formal, object-oriented language • Ports represent energy flow (undirected) orsignal flow (directed) • Acausal, equation-based, declarative • Multi-domain modeling
Modelica is Object-Oriented model SlidingMass "Sliding mass with inertia" extendsInterfaces.Rigid; import SI = Modelica.SIunits; parameterSI.Mass m = 1 "mass o the sliding mass"; SI.Velocity v "absolute velocity of the component"; SI.Acceleration a "absolute acceleration of the component"; equation v = der(s); a = der(v); m*a = flange_a.f + flange_b.f; end SlidingMass; Class consists of declaration + equations Specify the default value for parameters Modelica is case sensitive Objects are declared as instances of classes Equations arenon-causal Use dot-notation to refer to object variables
Modelica is Acausal, and Port-based • Acausal, equation-based • F = m*a • a = F/m • 0 = F – m*a • Port-based • Connectors represent energy flow • Undirected connections • Semantics of Kirchhoff's laws • E.g., fluid port contains • Pressure • flow: Mass flow rate • Temperature • flow: Enthalpy flow rate
Textual and Graphical Views Annotations for visualization, compilation & simulation Do not affect mathematical model model myCircuit annotation(uses(Modelica(version="2.2.1"))); Modelica.Electrical.Analog.Basic.Ground Ground1 annotation (extent=[-62,-44; -42,-24]); Modelica.Electrical.Analog.Basic.Resistor Resistor1 annotation (extent=[0,-14; 20,6], rotation=270); Modelica.Electrical.Analog.Basic.Capacitor Capacitor1 annotation (extent=[-32,6; -12,26]); Modelica.Electrical.Analog.Sources.ConstantVoltage ConstantVoltage1 annotation (extent=[-62,-14; -42,6], rotation=270); equation connect(ConstantVoltage1.p, Resistor1.p) annotation (points=[-52,-24; -52,-14], style(color=3, rgbcolor={0,0,255})); connect(Resistor1.n, Capacitor1.p) annotation (points=[-52,6;-52,16;-32,16], style(color=3, rgbcolor={0,0,255})); connect(Capacitor1.n, ConstantVoltage1.n) annotation (points=[-12,16; 10,16; 10,6], style(color=3, rgbcolor={0,0,255})); connect(ConstantVoltage1.n, Ground1.p) annotation (points=[10,-14; -52,-14], style(color=3, rgbcolor={0,0,255})); end myCircuit;
What Makes Modelica so Appealing? Symbolic manipulation of equations enables • Causality assignment • Simplification / elimination of algebraic loops • Index reduction • Zero-crossing functions for event detection • Symbolic differentiation for faster root-finding • Bottom Line: • Very expressive models • Very efficient simulations
Example: Stribeck Friction • Hybrid model • DAE +discrete events • 5 states: • locked • startForward • forward • startBackward • Backward • Dynamically reverses causalitywhen v=0 • Avoids typical stiffness at v=0
The Modelica Standard Library motor torque
Information about syntax and semantics of Modelica For working with signals & controls: generate waveforms, transfer functions, sampling, logical operators, look-up tables (interpolation) Defines constants: pi, e, G, h, … Motors and generators: DC, (a-)synchronous induction Multiphase power grids, power electronics (thyristors, etc.) Standard Mathematical functions (trig, log, interpolation,…) Mechanical 3D and 1D (for planar motion use 3D) Media = liquids and gasses; no component models Large number of units Simple models for flow of fluids with thermal properties Utilities for printing and file access The Modelica Standard Library
Other Modelica Libraries • Modelica association — 20+ free libs (www.modelica.org) • EUROSYSLIB project — 20+ libs under development(http://www.itea2.org/public/project_leaflets/EUROSYSLIB_profile_oct-07.pdf)
The OpenModelica Project • Open source Modelica environment • OMC, The Modelica Compiler/Interpreter • OMShell, The Interactive Session Handler • OMNotebook, DrModelica Simple Electronic notebook • Graphic Model Editor – SimForge(developed by Technical University of Milan) • Modelica Development Tooling (MDT) as Eclipse Plugin • Modelica XML conversion • Debugger for extended subset algorithmic code • Supported by the Open Source Modelica Consortium • European ITEA2 project OPENPROD • PI: P. Fritzson; 25 Partners; €11M • More info: http://www.openmodelica.org
SysML – Modelica Synergies • Modelica = state-of-the-art modeling language for system dynamics • Complements SysML Parametrics • Very expressive, formal language for differential algebraic equations and discrete events • Is (more or less) Compatible with SysML • Object-oriented, port-based • Broad Range of (Open Source) Libraries • Addresses need for domain models in SysML • Access to Free, Open Source Solvers
Overview • Modelica overview • What is Modelica? • What makes Modelica so appealing? • The Modelica Standard Library • The OpenModelica Project • SysML – Modelica Synergy • SysML – Modelica Correspondence • Steps Forward • Summary • Additional References
SysML – Modelica Correspondence:Model Definitions Modelica SysML Block or Constraint Block Modelica connectors could map to flow ports, or a stereotyped constraint property Stereotyped connector or stereotyped binding connector No formal equivalent textual constraint • Class • Has restricted classes: package, record, function,… • "connector" is crucial • Connection • For energy-flow, the connections have the semantics of Kirchhoff's laws • Equations and Algorithms • Initial equations and algorithms
SysML – Modelica Correspondence:Model Usage Modelica SysML Properties (usages) No equivalents new stereotypes? Multiplicities Not sufficiently expressive Property-specific types Somewhat vaguely defined Not (well) supported by tools Fixed visualization • Component clauses • discrete, constant, parameter indicates time variance • input, output, flow • Arrays • Modifiers • Change default values • Redeclare type • Arbitrarily deep in hierarchy • Visualization annotations NOTE: this is just an illustration – much work remains
Initial Work towards Integration • ModelicaML UML profile • Pop, A., and Akhvlediani, D., and Fritzson, P. (2007). "Towards Unified Systems Modeling with the ModelicaML UML Profile." International Workshop on Equation-Based Object-Oriented Languages and Tools. Berlin, Germany, Linköping University Electronic Press. • SysML-Modelica profile and mapping • Johnson, T. A., C. J. J. Paredis and R. M. Burkhart (2008). "Integrating Models and Simulations of Continuous Dynamics into SysML." 6th International Modelica Conference, Bielefeld, Germany, March 3-4, Modelica Association, 135-145. • Tool prototype • Automated mapping from SysML (MagicDraw) to Modelica • Model transformation with MOFLON • Model simulation with Dymola
Example: Hydraulic Circuit DiagramPressure-Compensated, Load-Sensing Excavator—ISO 1219 notation
SysML Schematic (ibd) — Basic ViewPressure-Compensated, Load-Sensing Excavator
D i g C y c l e h y d r a u l i c s environment world y p _ amb = 101325 T _ amb = 288 . 15 x Excavator Case StudyCorresponding Modelica Models Hydraulics Model Multi-Body System Dynamics Model(linkages, ...)
Simulationin Dymola Simulation Results ModelicaLexical Representation (auto-generated from SysML) [Johnson, 2008 - Masters Thesis]
How to Move Forward from Here? • Further develop and refine SysML-Modelica profile and mapping • In parallel with other SysML 2.0 efforts • Provide input to future SysML 2.0 submissions • Team members: Roger Burkhart,Sandy Friedenthal, Peter Fritzson,Chris Paredis, Russell Peak, …
Summary • Modelica = state-of-the-art modeling language for system dynamics • Strong SysML-Modelica synergy • Complements Parametrics • Is (more or less) Compatible with SysML • Broad range of libraries • Access to Free Solvers • Good high-level correspondence,but some (minor) differences • Team: extensive experience in both Modelica and SysML
Additional References • Modelica Specification: http://www.modelica.org/documents/ModelicaSpec30.pdf • Fritzson, P. (2004). Principles of Object-Oriented Modeling and Simulation with Modelica 2.1. New York, NY, Wiley-IEEE Press. • Akhvlediani, D. (2006). Design and implementation of a'UML profile for Modelica'/SysML. M.S. Thesis. Linköping University. LITH-IDA-EX--06/061—SE. • Johnson, T. A. (2008). Integrating Models and Simulations of Continuous Dynamic System Behavior into SysML. M.S. Thesis. G.W. Woodruff School of Mechanical Engineering, Georgia Institute of Technology. Atlanta, GA. • Peak, R., McGinnis, L., Paredis, C. Integrating System Design with Simulation and Analysis Using SysML – Phase 1 Final Report, (available from russell.peak@gatech.edu)