Technical Overview of OpenModelica and its Development Environment

Similar documents
Technical Overview of OpenModelica and its Development Environment

OpenModelica Compiler (OMC) Overview

Technical Overview of OpenModelica and its Development Environment

OpenModelica Compiler (OMC) Overview

Technical Overview of OpenModelica and its Development Environment

Technical Overview of OpenModelica and its Development Environment

and its Development Environment

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

OpenModelica Environment and Modelica Overview

Modelica Environments and OpenModelica

1st Annual OpenModelica Workshop Feb 2, 2009

The OpenModelica Modeling, Simulation, and Development Environment

A Modular. OpenModelica. Compiler Backend

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

3rd Annual OpenModelica Workshop Feb 7, 2011

4th Annual OpenModelica Workshop Feb 6, 2012

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

Integrated Model-Driven Development Environments for Equation-Based Object-Oriented Languages

Institutionen för datavetenskap Department of Computer and Information Science

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

ModelicaML: Getting Started Issue April 2012

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

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

5th Annual OpenModelica Workshop Feb 4, 2013

Modelica Based Parser Generator with Good Error Handling

OpenModelica Eclipse Plugin and MetaModelica Exercises

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

To All Participants!

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

State Machines in OpenModelica

OpenModelica System Documentation

Scientific Software Development with Eclipse

OMEdit OpenModelica Connection Editor

Model-Based Dynamic Optimization with OpenModelica and CasADi

12/7/09. How is a programming language processed? Picasso Design. Collaborating with Subversion Discussion of Preparation Analyses.

OMEdit. OpenModelica Connection Editor. User Manual Version April 2011

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

Implementation of a Graphical Modelica Editor with Preserved Source Code Formatting

Eclipse Support for Using Eli and Teaching Programming Languages

Towards Unified System Modeling with the ModelicaML UML Profile

The Open Source Modelica Project

NSIGHT ECLIPSE EDITION

9th Annual OpenModelica Workshop Feb 6, 2017

Modelica Development Tooling for Eclipse

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

Heat An Interactive Development Environment for Learning & Teaching Haskell

Domain-Specific Languages Language Workbenches

Module Road Map. 7. Version Control with Subversion Introduction Terminology

GENERATING A MODELICA COMPILER FROM NATURAL SEMANTICS SPECIFICATIONS

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

OpenModelica OMShell and OMNotebook Introduction and Exercises

PTP - PLDT Parallel Language Development Tools Overview, Status & Plans

NSIGHT ECLIPSE EDITION

Index. Symbols. /**, symbol, 73 >> symbol, 21

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

NSIGHT ECLIPSE EDITION

Bootstrapping a Modelica Compiler aiming at Modelica 4

COBOL-IT Developer Studio 2.0

Accelerating Stateflow With LLVM

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

Meta-Programming with Modelica. Model Transformations

Fault Tolerance Analysis using OpenModelica with Figaro Extensions for Modelica

Modelica3D. Platform Independent Simulation Visualization. Christoph Höger. Technische Universität Berlin Fraunhofer FIRST

Dynamic Load Balancing in Parallelization of Equation-based Models

CUDA Development Using NVIDIA Nsight, Eclipse Edition. David Goodwin

Enhancing the RAMSAS method for Systems Reliability Analysis through Modelica

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler so far

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

ADT: Eclipse development tools for ATL

Appending Variable-Structure to Modelica Models (WIP)

A QUICK OVERVIEW OF THE OMNeT++ IDE

JBPM Course Content. Module-1 JBPM overview, Drools overview

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

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

IBM C Rational Functional Tester for Java. Download Full Version :

Module 4: Working with MPI

Outline. Threads. Single and Multithreaded Processes. Benefits of Threads. Eike Ritter 1. Modified: October 16, 2012

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

DDMD AND AUTOMATED CONVERSION FROM C++ TO D

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

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

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

What s new in CDT 4.0 and beyond. Doug Schaefer QNX Software Systems CDT Project Lead

Injecting Model-Based Diagnosis Thinking into the Design Process. Johan de Kleer

An Overview of the SysML-Modelica Transformation Specification

An Annotation Tool for Semantic Documents

J2EE Development. Course Detail: Audience. Duration. Course Abstract. Course Objectives. Course Topics. Class Format.

Abstract Syntax Can Make the Definition of Modelica Less Abstract

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

Task-Graph-Based Parallelization of Modelica-Simulations. Tutorial on the Usage of the HPCOM-Module

Getting the Most from Eclipse

EMF Europa Simultaneous Release

What s NetBeans? Like Eclipse:

Semantic Analysis. Lecture 9. February 7, 2018

OS PORTING AND ABSTRACTION LAB USER MANUAL

WA1278 Introduction to Java Using Eclipse

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

IBM Rational Developer for System z Version 7.5

Rational Developer for i: What's New in 9.0.1

SCA Tools: new & noteworthy

Transcription:

Technical Overview of OpenModelica and its Development Environment Adrian Pop 2010-02-08 Open Source Modelica Consortium Programming Environment Laboratory Department of Computer and Information Science Linköping University www.openmodelica.org 2009-02-02

Outline OpenModelica What is OpenModelica? The past and present OpenModelica Technical Overview OMC, OMShell, OMNotebook, SimForge OpenModelica Development Environment MetaModelica The Eclipse Environment OpenModelica Latest Developments (2009-2010) 2

What is OpenModelica? (I) Advanced Interactive Modelica compiler (OMC) Supports most of the Modelica Language v. 2.2 and v. 3.1 Basic environments for creating models OMShell an interactive command handler OMNotebook a literate programming notebook MDT an advanced textual environment in Eclipse 3

What Is OpenModelica? (II) Advanced Eclipse-based Development Environment Modelica Development Tooling (MDT) - started in 2005 Code Assistance, Debugging, Outline & a lot more Now working on UML/SysML integration and better debugging Used heavily for OpenModelica development Used in 6 OpenModelica Development Courses (INRIA, PELAB) 4

Open-source community services Website and Support Forum Version-controlled source base Bug database (unfortunately) Development courses What is OpenModelica? (III) 5

What is OpenModelica? (IV) An incubator platform for research 4 PhDs since 2004 (Debugging, Parallelization, PDEs Extensions) 15 Master s theses since 2004 Both the students and the project benefit Master theses at PELAB 2006-2010 Refactoring/Parsing and Language extensions UML/SysML view of Modelica code 2D and 3D visualization tools Static and runtime debugging tools Advanced code generation and parallelization of simulation code Bootstrapping and Java Interface Function pointers NVIDIA Cuda parallel simulation External Master theses Model based diagnostics at ISY (Dep. Of Electrical Engineering) Monte-Carlo simulation of Satellite Separation Systems at SAAB Interactive Simulations (EADS) Additional Solvers + Event handling (FH-Bielefeld) A Base for commercial and open source products MathCore AB, Bosch Rexroth, InterCAX (MagicDraw SysML), VTT 6

OpenModelica Roadmap - Past 1997 - started as a master thesis 2003 first usable internal version 2004 first external version: OpenModelica 1.1 2005 more development: OpenModelica 1.3.1 2006 major milestone Translated the whole compiler to MetaModelica Integrated Development Environment for the compiler OpenModelica website started Moved the code repository to Subversion management Extended the OpenModelica environment with new tools 4 versions released during the year External people start using OpenModelica ~ 200 downloads/month first development course at INRIA 7

OpenModelica Roadmap - Past 2007 continued development and community involvement Improvement in website, support and documentation Answered ~1000 questions on the forum Portability is highly improved, ported to 4 platforms Linux, Mac, Solaris, Windows (version 1.4.3) Improvement of the compiler development tools in Eclipse OpenModelica Community starts to react contribute code & report bugs & request enhancements & participate in answering questions in the OpenModelica forum participate at courses and workshops New server acquired for better community services Increased usage: ~600 downloads/month Open Modelica Consortium created in December 4 4 months of work 9 organizations as members already (3 Universities, 6 Companies) discussions are ongoing with other 6 companies 8

OpenModelica Roadmap - Past 2008 Further work on the compiler Release 1.4.4 and 1.4.5 Linux, Mac, Solaris, Windows New Solver Interface Refactoring Dynamic loading of functions Merging of MathCore front-end code 744 commits in Subversion Much more other things I don t remember 9

OpenModelica Roadmap Past & Present 2009 2010 Work mainly happened in OSMC (partially on a non-public branch) Front-end Refactoring (OSMC) Enumerations (OSMC) Java Interface and Booststrapping (Martin Sjölund) MultiBody flattening (OSMC) Braking of constraint connection graph (VTT + OSMC) Support for Modelica 3.x and 3.x annotations (OSMC) Back-end Tearing in the back-end (Jens Frenkel) Template Code Generation and CSharp backend (Pavol Privitzer, Charles University Prague) Interactive Simulations (EADS) C++ Code generation (Bosch Rexroth) Java Interface and Booststrapping (Martin Sjölund) Additional Solvers + Events (Willi Braun, FH-Bielefeld) General New MDT based on Xtext (Antanas Pavlov, SysMO and BMW) New ModelicaML + SysML prototype (EADS) 1144 commits in subversion (Since 2009 to February 8, 2010) Bug fixes (OSMC) Release 1.5.0 and 1.5.0-RC_X (Linux, Mac, Solaris, Windows) More things I don t remember 10

OpenModelica Statistics (I) Mature code base ~ 1000K lines of code, doubled since 2005 11

OpenModelica Statistics (II) 12

OpenModelica Statistics (III) 13

Outline OpenModelica What is OpenModelica? The past and present OpenModelica Technical Overview OMC, OMShell, OMNotebook, SimForge OpenModelica Development Environment MetaModelica The Eclipse Environment OpenModelica Latest Developments (2009-2010) 14

OMShell & OMNotebook Demo? 15

SimForge - Demo? Maybe a movie! 16

Implemented mainly in MetaModelica and C/C++ The compiler has 91 packages (in my local working copy).mo Parse Data Type Modules: Absyn Types Main ClassLoader SCode DAE Absyn Prefix.Prefix ClassInf.Event Prefix SCode /explode ClassInf SCode Exp.Exp (Env, name) Mod Lookup SCode.Class (Env, name) SCode.Exp Inst Static Ceval (Exp.Exp, Types.Type) Connect Types.Mod SCode.Mod Exp.Componentref Exp.Ident ClassInf.State DAE The OMC Compiler DAE: Equations Algorithms Exp.Exp Values.Value Exp.Exp Derive DAE: Functions Patternm DFA DAE CodeGen Dump DAEEXT Exp.Exp Dump DAELow Utility Modules: VarTransform DAE DAELow.DAELow SimCodeGen Debug Flat Modelica C code DAE, substlist Algorithm Exp Builtin MetaUtil Util ModUtil Print System RTOpts 17

Modelica->AST->SCode->DAE->C Code // Parse the file and get an AST back ast = Parse.parse(modelicaFile); // Elaborate the file scode = SCode.elaborate(ast); // instantiate the simplified code (cache, dae1) = Inst.instantiate(Env.emptyCache, scode); // Transform all if equations to if expressions dae2 = DAE.transformIfEqToExpr(dae1); // Retrieve the last class name from the AST. This class will be instantiated. lastclassname = Absyn.lastClassname(ast); // Call the function that optimizes the DAE optimizedae(scode, ast, dae, dae, lastclassname); 18

Two libraries: libc_runtime.a Simulation Runtime Overview Runtime used by the generated functions in the model Linked with the model libsim.a Runtime used for simulations, it contains solver implementations and a main function for the simulation 19

Simulation Runtime Main Executable Model OMC Simulation Runtime Library OMC Generated Code DATA *globaldata: simulation_runtime.h DATA *localdata simparams:start,stop,stepsize, outputsteps,tolerance, method main: simulation_runtime.cpp globaldata = initializedatastruc(flags); setlocaldata(globaldata); read_input(globaldata, simparams); switch (method) dassl : dassl_main(simparams); euler : euler_main(simparams); deinitializedatastruct(data, FLAGS); initializedatastruc setlocaldata deinitializedatastruc dassl_main: solver_dasrt.cpp euler_main: solver_euler.cpp read_input: simulation_input.cpp 20

OMC Simulation Runtime Library DATA *globaldata: simulation_runtime.h simparams:start,stop,stepsize,outputsteps,tolerance, method dassl_main: solver_dasrt.cpp // set the solver parameters and calculate step from simparams initializeeventdata(); initializeresult(numpoints, globaldata); bound_parameters(); initial_function(); storeextrapolationdata(); initialize(init_method); function_updatedependents(); CheckForInitialEvents(globalData->timeValue); StartEventIteration(globalData->timeValue); // calculate initial derivatives functionode(); // calculate initial output values functiondae_output(); functiondae_output2(); // take a tiny step tout = globaldata->timevalue + epsilon; function_updatedependents(); saveall(); emit(); calcenabledzerocrossings(); // call the solver for that tiny step DDASTR(functionDAE_res, function_zerocrossing, jroot); checkforinitialzerocrossings(jroot); // check if we can continue the simulation functiondae_res(globaldata); functiondae_output(); // calculate the next step tout = newtime(tout, step, stop); // enter solver loop storeextrapolationdata: simulation_runtime.cpp initializeresult: simulation_result.cpp emit: simulation_result.cpp initializeeventdata: simulation_events.cpp CheckForInitialEvents: simulation_events.cpp StartEventIteration: simulation_events.cpp saveall: simulation_events.cpp initialize: simulation_init.cpp Simulation Runtime Solver OMC Generated Code DATA *localdata initializedatastruc setlocaldata deinitializedatastruc bound_parameters initial_function functionode functiondae_output functiondae_output2 function_updatedependent s functiondae_res function_zerocrossing 21

Outline OpenModelica What is OpenModelica? The past and present OpenModelica Technical Overview OMC, OMShell, OMNotebook OpenModelica Development Environment MetaModelica The Eclipse Environment OpenModelica Latest Developments (2009-2010) 22

MetaModelica OMC Implemented mainly in MetaModelica and C/C++ Modelica classes, models, records, functions, packages behavior is defined by equations or/and functions equations differential algebraic equations and conditional equations MetaModelica extensions local equations pattern equations match expressions high-level data structures: lists, tuples, option and uniontypes 23

OpenModelica Context Server: Main Program Including Compiler, Interpreter, etc. Parse Corba Client: Graphic Model Editor Client: OMShell Interactive Session Handler SCode Interactive Untyped API Client: Eclipse Plugin Inst system Typed Checked Command API Ceval plot etc. 24

The MDT Eclipse Environment (I) Modelica Browser Modelica Editor Modelica Code Assistant MetaModelica Debugging Modelica Perspective 25

The MDT Eclipse Environment (II).mo file OMC Compiler MMC Compiler Small Modelica Parser AST Information Modelica model Modelica Browser Modelica Editor MetaModelica Builder MetaModelica Build console Eclipse Modelica Code Assistant MetaModelica Debugging 26

The MDT Eclipse Environment (III).mo file MMC Compiler MetaModelica Debugging Executable + Debugging runtime Modelica Editor Eclipse 27

Creating Modelica projects (I) Creation of Modelica projects using wizards 28

Creating Modelica projects (II) Modelica project 29

Creating Modelica packages Creation of Modelica packages using wizards 30

Creating Modelica classes Creation of Modelica classes, models, etc, using wizards 31

Code browsing Code Browsing for easy navigation within Modelica files. Automatic update on file save. 32

Error detection (I) Parse error detection on file save 33

Error detection (II) Semantic error detection on compilation 34

Code assistance (I) Code Assistance on imports 35

Code assistance (II) Code Assistance on assignments 36

Code assistance (III) Code Assistance on function calls 37

Code indentation Code Indentation 38

Code Outline and Hovering Info Code Outline for easy navigation within Modelica files Identifier Info on Hovering 39

Eclipse Debugging Environment Type information for all variables Browsing of complex data structures 40

Eclipse environment for ModelicaML 41

Requirements Modeling in Eclipse 42

Outline OpenModelica What is OpenModelica? The past and present OpenModelica Technical Overview OMC, OMShell, OMNotebook OpenModelica Development Environment MetaModelica The Eclipse Environment OpenModelica Latest Developments (2009-2010) 43

Latest Developments (2009-2010) 2009 2010 Work mainly happened in OSMC (partially on a non-public branch) Front-end Refactoring (OSMC) Enumerations (OSMC) Java Interface and Booststrapping (Martin Sjölund) MultiBody flattening (OSMC) Braking of constraint connection graph (VTT + OSMC) Support for Modelica 3.x and 3.x annotations (OSMC) Better structuring of the compiler (OSMC) Back-end Tearing in the back-end (Jens Frenkel) Template Code Generation and CSharp backend (Pavol Privitzer, Charles University Prague) Interactive Simulations (EADS) C++ Code generation (Bosch Rexroth) Java Interface and Booststrapping (Martin Sjölund) Additional Solvers + Events (Willi Braun, FH-Bielefeld) General New MDT based on Xtext (Antanas Pavlov, SysMO and BMW) New ModelicaML + SysML prototype (EADS) 1144 commits in subversion (Since 2009 to February 8, 2010) Bug fixes (OSMC) Release 1.5.0 and 1.5.0-RC_X (Linux, Mac, Solaris, Windows) More things I don t remember 44

General Modelica issues solved array aliases (100%) enumerations (95%) using enumerations as array indexes remains to be done inner outer with modifications on inner (95%) works for constant modifications started another implementation that uses the inner object directly MultiBody specific issues calling functions via component i.e. world.gravityacceleration (100%) not legal modelica and on plus the gravityacceleration function is protected braking of over constrained connection graph (90%) implemented by VTT (Hannu) constraint types (100%) some issues with inner/outer ovelapping connection braking. performance issues (40%) faster handling of inner outer more caching in the compiler expandable connectors (90%) Implementation as a phase before instantiation Some small bugs still to be fixed MultiBody library 45

Media library The most evil Modelica standard library problems with partial functions in partial packages problems with full packages in partial packages used via the fully qualified path problems with redeclare replaceable model extends x. modifiers are in the wrong scope in the presence of redeclare replaceable model extends x. functions using redelclare replaceable function extends used to set constants in partial packages. 46

Template Code Generation Pavol Privitzer, Charles University in Prague, Creative Connections s.r.o. Czech Republic Simple model of right heart Starling law IDA solver behind (in F#) linked with the code of the model (completely generated using the Susan template code generation in OpenModelica) The generated model runs in the Browser on top of Silverlight! Input Pressure to Right Heart vs. Volume Input Pressure to Right Heart vs. BlodFlow 47

Modelica Development Tooling based on Xtext Atanas Pavlov, SysMo & BMW 48

End Thank You! Questions? OpenModelica Project http://www.openmodelica.org 49