Modelica Environments and OpenModelica

Similar documents
OpenModelica Environment and Modelica Overview

OpenModelica OMShell and OMNotebook Introduction and Exercises

OpenModelica Compiler (OMC) Overview

OpenModelica Compiler (OMC) Overview

1st Annual OpenModelica Workshop Feb 2, 2009

int a; class x { public int a; class x { float b; Asda ad public int a; Asa asad Aac sdscfcc c a

The OpenModelica Modeling, Simulation, and Development Environment

Research in Model-Based Product Development at PELAB in the MODPROD Center

Technical Overview of OpenModelica and its Development Environment

OpenModelica Development Environment with Eclipse Integration for Browsing, Modeling, and Debugging

3rd Annual OpenModelica Workshop Feb 7, 2011

High Level Mathematical Modeling and Parallel/GRID Computing with Modelica. Peter Fritzson

4th Annual OpenModelica Workshop Feb 6, 2012

INTRODUCTION TO OBJECT-ORIENTED MODELING AND SIMULATION WITH MODELICA USING THE OPENMODELICA ENVIRONMENT

To All Participants!

Integrated Modeling of CPS including Requirements: Open Source MBSE Tools Based on Modelica and UML

5th Annual OpenModelica Workshop Feb 4, 2013

Proceedings of the 4th International Modelica Conference, Hamburg, March 7-8, 2005, Gerhard Schmitz (editor)

Vice Chairman of Modelica Association Director of Open Source Modelica Consortium

Increasing programmability

Technical Overview of OpenModelica and its Development Environment

Research in Model-Based Product Development at PELAB in the MODPROD Center

Technical Overview of OpenModelica and its Development Environment

ModelicaML: Getting Started Issue April 2012

9th Annual OpenModelica Workshop Feb 6, 2017

Technical Overview of OpenModelica and its Development Environment

Proceedings of the 4th International Modelica Conference, Hamburg, March 7-8, 2005, Gerhard Schmitz (editor)

Towards Run-time Debugging of Equation-based Object-oriented Languages

MODPROD'2014 8th International Workshop on Model-Based Product Development

Towards Unified System Modeling with the ModelicaML UML Profile

Mo E A Communication Service Between Modelica Compilers and Text Editors

Technical Overview of OpenModelica and its Development Environment

EXPRESSING REQUIREMENTS IN MODELICA

An Easy-to-use Generic Model Configurator for Models in Multiple Tool Formats

An OpenModelica Python Interface and its use in PySimulator

and its Development Environment

Modelica Development Tooling for Eclipse

An Eclipse-based Integrated Environment for Developing Executable Structural Operational Semantics Specifications

Simulation and Benchmarking of Modelica Models on Multi-core Architectures with Explicit Parallel Algorithmic Language Extensions

OMEdit. OpenModelica Connection Editor. User Manual Version April 2011

AN INTEGRATED MODELICA ENVIRONMENT FOR MODELING, DOCUMENTATION AND SIMULATION

Scientific Computing: Lecture 1

Institutionen för datavetenskap Department of Computer and Information Science

OMEdit OpenModelica Connection Editor

What follows is a list of the OMC APIs with their syntax and examples.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

ADT: Eclipse development tools for ATL

Modeling Technical Systems [ ] Mag MA MA Schweiger Gerald TU Graz Spring 2017

Introduction to Java

Heat An Interactive Development Environment for Learning & Teaching Haskell

SNiFF+ for Eiffel: A new programming environment for Eiffel

The Open Source Modelica Project

Oriented Modeling and Simulation with Modelica

A Portable Debugger for Algorithmic Modelica Code

OpenModelica User s Guide

Today. Review. Unix as an OS case study Intro to Shell Scripting. What is an Operating System? What are its goals? How do we evaluate it?

Introduction to ROOT. M. Eads PHYS 474/790B. Friday, January 17, 14

Parallel Code Generation in MathModelica / An Object Oriented Component Based Simulation Environment

The following are brief descriptions of the scripting commands available in the OpenModelica environment.

Programmiersprachen (Programming Languages)

Model-Based Dynamic Optimization with OpenModelica and CasADi

MapleSim User's Guide

Automatic Parallelization of Mathematical Models Solved with Inlined Runge-Kutta Solvers

News in RSA-RTE 10.0 updated for sprint Mattias Mohlin/Anders Ek, June 2016

Proceedings of the 4th International Modelica Conference, Hamburg, March 7-8, 2005, Gerhard Schmitz (editor)

MathModelica An Extensible Modeling and Simulation Environment with Integrated Graphics and Literate Programming

AUTOMATIC PARALLELIZATION OF OBJECT ORIENTED MODELS ACROSS METHOD AND SYSTEM

Eclipse CDT Tutorial. Eclipse CDT Homepage: Tutorial written by: James D Aniello

Software-Entwicklungswerkzeuge

Software-Entwicklungswerkzeuge. Modelica Overview. Contents. 1. Modelica Introduction. 2. Modelica Users View. 3. Modelica Libraries

Formal editing: jedit-mmt. Narrative editing: LaTeX-MMT. Browsing: MMT web server. Building: MMT scripting language. The MMT API: A Generic MKM System

Textadept Quick Reference. Mitchell

Exercises: Instructions and Advice

Implementation of a Graphical Modelica Editor with Preserved Source Code Formatting

CS251 Programming Languages Handout # 47 Prof. Lyn Turbak May 22, 2005 Wellesley College. Scheme

Modelica Change Proposal MCP-0019 Flattening (In Development) Proposed Changes to the Modelica Language Specification Version 3.

Automatic Regression Testing of Simulation Models and Concept for Simulation of Connected FMUs in PySimulator

Shell scripting and system variables. HORT Lecture 5 Instructor: Kranthi Varala

A Modular. OpenModelica. Compiler Backend

12.620J / 6.946J / 8.351J / Classical Mechanics: A Computational Approach

CPS221 Lecture: Operating System Functions

Abstract Syntax Can Make the Definition of Modelica Less Abstract

Towards Modelica 4 Meta-Programming and Language Modeling with MetaModelica 2.0

Integration of OpenModelica in Ptolemy II

x ide xml Integrated Development Environment Specifications Document 1 Project Description 2 Specifi fications

Textadept Quick Reference

The current topic: Python. Announcements. Python. Python

News in RSA-RTE 10.1 updated for sprint Mattias Mohlin, November 2017

Frontend guide. Everything you need to know about HTML, CSS, JavaScript and DOM. Dejan V Čančarević

TNM093 Practical Data Visualization and Virtual Reality Laboratory Platform

Flask Web Development Course Catalog

News in RSA-RTE 10.1 updated for sprint Mattias Mohlin, January 2018

News in RSA-RTE 10.2 updated for sprint Mattias Mohlin, May 2018

Institutionen för datavetenskap Department of Computer and Information Science

Soar IDE. Keith Knudsen, Mike Quist, Dave Ray & Bob Wray May 24, 2007

JavaScript CS 4640 Programming Languages for Web Applications

The use of the UML within the modelling process of Modelica-models

Modelica Change Proposal MCP-0021 Component Iterators Status: Under Evaluation , version v2, #1848

Textadept Quick Reference

AN4464 Application note

Transcription:

Environments and Open 1 Peter Fritzson Dymola Dynasim (Dassault Systemes) Sweden First tool on the market Main focus on automotive industry www.dynasim.com 2 Peter Fritzson 1

Simulation X ITI Germany Mechatronic systems www.simulationx.com 3 Peter Fritzson MapleSim Maplesoft Canada Recent tool on the market Integrated with Maple www.maplesoft.com 4 Peter Fritzson 2

Math MathCore Sweden Released 2006 General purpose Mathematica connection www.mathcore.com 5 Peter Fritzson The Open Environment www.open.org 6 Peter Fritzson 3

Open and simforge Open Open Source Consortium (OSMC) Sweden and other countries Open source www.openmodelica.org Graphical editor simforge Politecnico di Milano, Italy Runs together with Open Open source 7 Peter Fritzson Open Advanced Interactive compiler (OMC) Supports most of the Language Basic environment for creating models OMShell an interactive command handler OMNotebook a literate programming notebook MDT an advanced textual environment in Eclipse ML UML Profile Meta extension 8 Peter Fritzson 8 4

Open Source Consortium Open-source community services Website and Support Forum Version-controlled source base Bug database Development courses www.openmodelica.org Code Statistics Founded Dec 4, 2007 Industrial members (12) ABB Corporate Research Bosch-Rexroth AG, Germany Siemens Turbo Machinery AB Creative Connections, Prague Equa Simulation AB, Sweden IFP, Paris, France MostforWater, Belgium MathCore Engineering AB MapleSoft, Canada TLK Thermo, Germany VTT, Finland XRG Simulation AB, Germany University members (9) Linköping University, Sweden Hamburg University of Technology/TuTech, Institute of Thermo-Fluid Dynamics, Germany Technical University of Braunschweig, the Institut of Thermodynamik, Germany Université Laval, the modeleau group, Canada Griffith University, Australia University of Queensland, Australia Politecnico di Milano, Italy Mälardalen University, Sweden Technical University Dresden, Germany 9 Peter Fritzson OMNotebook Electronic Notebook with Dr Primarily for teaching Interactive electronic book Platform independent Commands: Shift-return (evaluates a cell) File Menu (open, close, etc.) Text Cursor (vertical), Cell cursor (horizontal) Cell types: text cells & executable code cells Copy, paste, group cells Copy, paste, group text Command Completion (shifttab) 10 Peter Fritzson 5

Interactive Session Handler on dcmotor Example (Session handler called OMShell Open Shell) >>simulate(dcmotor,starttime=0.0,stoptime=10.0) >>plot({load.w,load.phi}) model dcmotor.electrical.analog.basic.resistor r1(r=10);.electrical.analog.basic.inductor i1;.electrical.analog.basic.emf ect. a og. as c. emf1;.mechanics.rotational.inertia load;.electrical.analog.basic.ground g;.electrical.analog.sources.constantvoltage v; equation connect(v.p,r1.p); connect(v.n,g.p); connect(r1.n,i1.p); connect(i1.n,emf1.p); connect(emf1.n,g.p); connect(emf1.flange_b,load.flange_a); end dcmotor; 11 Peter Fritzson Event Handling by Open BouncingBall >>simulate(bouncingball, stoptime=3.0); >>plot({h,flying}); model BouncingBall parameter Real e=0.7 "coefficient of restitution"; parameter Real g=9.81 "gravity acceleration"; Real h(start=1) "height of ball"; Real v "velocity of ball"; Boolean flying(start=true) "true, if ball is flying"; Boolean impact; Real v_new; equation impact=h <= 0.0; der(v)=if flying then -g else 0; der(h)=v; when {h <= 0.0 and v <= 0.0,impact} then v_new=if edge(impact) then -e*pre(v) else 0; flying=v_new > 0; reinit(v, v_new); end when; end BouncingBall; 12 Peter Fritzson 6

Run Scripts in Open RunScript command interprets a.mos file.mos means MOdelica Script file Example: >> runscript("sim_bouncingball.mos") The file sim_bouncingball.mos : loadfile("bouncingball.mo"); simulate(bouncingball, stoptime=3.0); plot({h,flying}); 13 Peter Fritzson Open MDT Eclipse Plugin Browsing of packages, classes, functions Automatic building of executables; separate compilation Syntax highlighting hli hti Code completion, Code query support for developers Automatic Indentation Debugger (Prel. version for algorithmic subset) 14 Peter Fritzson 7

Open MDT Usage Example Code Assistance on function calling. 15 Peter Fritzson Open Environment Architecture Eclipse Plugin Editor/Browser Emacs Editor/Browser Interactive session handler Graphical Model Editor/Browser Textual Model Editor Dr OMNoteBook Model Editor Execution Compiler Debugger 16 Peter Fritzson 8

Open Client-Server Architecture Server: Main Program Including Compiler, Interpreter, etc. Parse Corba Client: Graphic Model Editor Client: OMShell Interactive Session Handler SCode Inst Ceval Interactive system Untyped API Typed Checked Command API plot etc. Client: Eclipse Plugin MDT 17 Peter Fritzson Translation of Models to Simulation Code Graphical Editor Textual Editor Model Source code Translator Analyzer Optimizer Code generator C Compiler Simulation Model Flat model Sorted equations Optimized sorted equations C Code Executable 18 Peter Fritzson 9

Corba Client-Server API Simple text-based (string) communication in Syntax API supporting model structure query and update Example Calls: Calls fulfill the normal function call syntax.: savemodel("myresistorfile.mo",myresistor) will save the model MyResistor into the file MyResistorFile.mo. For creating new models it is most practical to send a model, e.g.: model Foo end Foo; or, e.g., connector Port end Port; 19 Peter Fritzson Some of the Corba API functions savemodel(a1<string>,a2<cref>) loadfile(a1<string>) loadmodel(a1<cref>) deleteclass(a1<cref>) addcomponent(a1<ident>,a2<cref>, A3<cref>,annotate=<expr>) deletecomponent(a1<ident>, A2<cref>) updatecomponent(a1<ident>, A2<cref>, A3<cref>,annotate=<expr>) addclassannotation(a1<cref>, annotate=<expr>) Saves the model (A2) in a file given by a string (A1). This call is also in typed API. Loads all models in the file. Also in typed API. Returns list of names of top level classes in the loaded files. Loads the model (A1) by looking up the correct file to load in $MODELICAPATH. Loads all models in that file into the symbol table. Deletes the class from the symbol table. Adds a component with name (A1), type (A2), and class (A3) as arguments. Optional annotations are given with the named argument annotate. Deletes a component (A1) within a class (A2). Updates an already existing component with name (A1), type (A2), and class (A3) as arguments. Optional annotations are given with the named argument annotate. Adds annotation given by A2( in the form annotate= classmod(...)) to the model definition referenced by A1. Should be used to add Icon Diagram and Documentation annotations. getcomponents(a1<cref>) Returns a list of the component declarations within class A1: {{Atype,varidA, commenta },{Btype,varidB, commentb }, {...}} getcomponentannotations(a1<cref>) Returns a list {...}of all annotations of all components in A1, in the same order as the components, one annotation per component. getcomponentcount(a1<cref>) Returns the number (as a string) of components in a class, e.g return 2 if there are 2 components. getnthcomponent(a1<cref>,a2<int>) Returns the belonging class, component name and type name of the nth component of a class, e.g. A.B.C,R2,Resistor, where the first component is numbered 1. getnthcomponentannotation( A1<cref>,A2<int>) getnthcomponentmodification( A1<cref>,A2<int>)?? Returns the flattened annotation record of the nth component (A2) (the first is has no 1) within class/component A1. Consists of a comma separated string of 15 values, see Annotations in Section 2.4.4 below, e.g false,10,30,... Returns the modification of the nth component (A2) where the first has no 1) of class/component A1. 20getInheritanceCount(A1<cref>) Peter Fritzson Copyright Open Source Returns the number Consortium (as a string) of inherited classes of a class. getnthinheritedclass(a1<cref>, Returns the type name of the nth inherited class of a class. The first class has number 1. 10

Platforms All Open GUI tools (OMShell, OMNotebook,...) are developed on the Qt4 GUI library, portable between Windows, Linux, Mac Both compilers (OMC, MMC) are portable between the three platforms Windows currently main development and release platform Linux available. Also used for development Mac available 21 Peter Fritzson Open Recent Developments Dec 2008. OSMC Board decides to focus on improving the Open compiler for libraries during 2009 Dec 2008. MathCore contributes 1 man-year worth of source code for the flattening frontend. Jan-Sept 2009. Development mostly on the compiler frontend Sept 2009. Open release 1.5, containing i approx 2 man-years development compared to version 1.4.5. (Beta release available today). 22 Peter Fritzson 11