Peter Fritzson 1 OpenModelica OMShell and OMNotebook Introduction and Exercises Peter Fritzson, Adrian Pop, Peter Aronsson OpenModelica Course at INRIA,

Slides:



Advertisements
Similar presentations
Introduction to Macromedia Director 8.5 – Lingo
Advertisements

Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Introduction to Programming using Matlab Session 2 P DuffourJan 2008.
Pages and boxes Building quick user interfaces. learning objectives o Build a quick UI with pages and boxes o understand how pages and boxes work o click.
IS660Z Programming Games Using Visual Basic Overview of Cannonball.
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Peter Fritzson 1 MetaModelica for Meta-Modeling and Model Transformations Peter Fritzson, Adrian Pop, Peter Aronsson OpenModelica Course at INRIA, 2006.
Professional Toolkit V2.0 C:\Presentations - SmartCafe_Prof_V2.0 - bsc page 1 Professional Toolkit 2.0.
Java Script Session1 INTRODUCTION.
Introduction to JavaScript
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
 Statistics package  Graphics package  Programming language  Can be used to share/reproduce analyses  Many new packages being created - can be downloaded.
Java Applet & JavaScript SNU OOPSLA Lab. October 2005.
OpenModelica Environment and Modelica Overview
CA 121 Intro to Programming Tariq Aziz and Kevin Jones GUI Programming in Visual Studio.NET Chapter 1 Tariq Aziz and Kevin Jones.
1 Ant – Another Neat Tool Representation and Management of Data on the Internet.
A Portable Debugger for Algorithmic Modelica Code Adrian Pop, Peter Fritzson Programming Environments Laboratory (PELAB) Department of Computer and Information.
Introduction to SPSS Short Courses Last created (Feb, 2008) Kentaka Aruga.
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
Prof. R. Willingale Department of Physics and Astronomy 2nd Year C+R 2 nd Year C and R Workshop Part of module PA2930 – 2.5 credits Venue: Computer terminal.
Python for S60 SmartPhones PostPC Workshop Fall 2006 Amnon Dekel.
PYTHON: LESSON 1 Catherine and Annie. WHAT IS PYTHON ANYWAY?  Python is a programming language.  But what’s a programming language?  It’s a language.
CSC3170 Introduction to Database Systems
Javascript and the Web Whys and Hows of Javascript.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
ROOT An object oriented HEP analysis framework.. Computing in Physics Physics = experimental science =>Experiments (e.g. at CERN) Planning phase Physics.
1 April 2005, Siemens Industrial Turbomachinery AB Copyright © Copyright © 2005 Peter Fritzson Modelica Classes and Inheritance.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
IE 411/511: Visual Programming for Industrial Applications
JSP Java Server Pages Softsmith Infotech.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
University of Sunderland CDM105 Session 6 Dreamweaver and Multimedia Fireworks MX 2004 Creating Menus and Button images.
Introduction to MATLAB Session 3 Simopekka Vänskä, THL Department of Mathematics and Statistics University of Helsinki 2011.
Active-HDL Interfaces Debugging C Code Course 10.
Oracle Data Integrator Procedures, Advanced Workflows.
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
EIE375 BlueJ: Getting Started Dr Lawrence Cheung.
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing with Graphics.
1 Getting Started with C++. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Visual Studio 2008.
Chapters 2 & 3 MATLAB Skills This tutorial revisits Examples 3.1 to 3.4 to show how MATLAB can be used to solve the same problems 1.Scatter Plots 2.Other.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
1 Applets are small applications that are accessed on an Internet server, transported over the internet, automatically installed and run as a part of web.
MIS 3200 – Unit 3.2 Page_Load method AutoPostBack property of controls IsPostBack method of the Page object Understanding web page life cycle.
Ben Stöver Winter term 2014/2015 Command line and batch files Molekular Phylogenetics – Practical.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
1 Getting Started with C++ Part 1 Windows. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Microsoft.
Practical Kinetics Exercise 0: Getting Started Objectives: 1.Install Python and IPython Notebook 2.print “Hello World!”
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
Structured Computer Programming EE 201 Introduction to MATLAB 7 for Engineers بسم الله الرحمن الرحيم King Abdulaziz University College of Engineering Dept.
PROGRAMMING USING PYTHON LANGUAGE ASSIGNMENT 1. INSTALLATION OF RASPBERRY NOOB First prepare the SD card provided in the kit by loading an Operating System.
CPSC 233 Tutorial January 21 st /22 nd, Linux Commands.
1 Agent-Based Tools: focus on NetLogo Ing. Cristina Ponsiglione University of Naples Federico II Laboratorio di Simulazione ad Agenti.
Matlab Programming for Engineers
CST 1101 Problem Solving Using Computers
WORKSHOP 1 CUSTOM TIRE SUBROUTINE
CMIP5 Questionnaire Roadmap – beta
Matlab Training Session 4: Control, Flow and Functions
DEPARTMENT OF COMPUTER SCIENCE
WORKSHOP 3 GSE IMPORT.
Programming in Perl Introduction
Use of Mathematics using Technology (Maltlab)
Java Applets.
Code is on the Website Outline Comparison of Excel and R
JavaScript What is JavaScript? What can JavaScript do?
JavaScript What is JavaScript? What can JavaScript do?
On behalf of the SysML-Modelica Working Group
Tutorial 10: Programming with javascript
This is where R scripts will load
Chapter 1: Programming Basics, Python History and Program Components
Presentation transcript:

Peter Fritzson 1 OpenModelica OMShell and OMNotebook Introduction and Exercises Peter Fritzson, Adrian Pop, Peter Aronsson OpenModelica Course at INRIA,

Peter Fritzson 2 OMShell and OMNotebook OpenModelica End- User Subsystems OMShell – interactive session handler for Modelica scripting OMNotebook – interactive electronic notebook for Modelica teaching (with DrModelica), scripting, and documentation OpenModelica Compiler (OMC) – compiles and executes/simulates Modelica models ptplot package (from Berkeley) make plots

Peter Fritzson 3 OpenModelica Environment Architecture

Peter Fritzson 4 Interactive Session Handler – on dcmotor Example (Session handler called OMShell – OpenModelica Shell) >>simulate(dcmotor,startTime=0.0,stopTime=10.0) >>plot({load.w,load.phi}) model dcmotor Modelica.Electrical.Analog.Basic.Resistor r1(R=10); Modelica.Electrical.Analog.Basic.Inductor i1; Modelica.Electrical.Analog.Basic.EMF emf1; Modelica.Mechanics.Rotational.Inertia load; Modelica.Electrical.Analog.Basic.Ground g; Modelica.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;

Peter Fritzson 5 Event Handling by OpenModelica – 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;

Peter Fritzson 6 Run Scripts in OpenModelica RunScript command interprets a.mos file.mos means MOdelica Script file Example: >> runScript("sim_BouncingBall.mos") loadFile("BouncingBall.mo"); simulate(BouncingBall, stopTime=3.0); plot({h,flying}); The file sim_BouncingBall.mos :

Peter Fritzson 7 Some OMShell Exercises Start OMShell (e.g. from the start menu) Look at the examples in the OpenModelicaUsersGuide. Try evaluating a small expression, e.g. 2+3, push return type help() try command completion, e.g. type loadM followed by tab fill in Modelica (i.e. loadModel(Modelica)) Use the file menu->LoadModel and load the dcmotor (../testmodels) type sim followed by tab; fill in dcmotor type plot followed by tab; fill in some variable(s) to plot (look at the users guide) type in a small function and call it

Peter Fritzson 8 OpenModelica OMNotebook Electronic Notebook with DrModelica Primarily for teaching Interactive electronic book Platform independent OMNotebook Does not need Mathematica

Peter Fritzson 9 Interactive Contents in DrModelica Contains Examples and Exercises from Modelica Book Recent Book, 2004:

Peter Fritzson 10 Cells with both Text and Graphics Java must be installed for plotting to work

Peter Fritzson 11 Exercises and Answers in OMNotebook DrModelica

Peter Fritzson 12 Some OMNotebook Commands (see also OpenModelica Users Guide) Shift-return (evaluated a cell) File Menu (open, close, etc.) Text Cursor (vertical), Cell cursor (horisontal) Cell types: text cells & executable code cells Copy, paste, group cells Copy, pase, group text Command Completion (shift-tab)

Peter Fritzson 13 Simplest Model – Hello World! A Modelica “Hello World” model class HelloWorld "A simple equation" Real x(start=1); equation der(x)= -x; end HelloWorld; Equation: x’ = - x Initial condition: x(0) = 1 Simulation in OpenModelica environment simulate(HelloWorld, stopTime = 2) plot(x)

Peter Fritzson Example class: Van der Pol Oscillator class VanDerPol "Van der Pol oscillator model" Real x(start = 1) "Descriptive string for x"; // x starts at 1 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 = 25) plotParametric(x,y)

Peter Fritzson 15 Small OMNotebook Exercise Locate the HelloWorld model in DrModelica using OMNotebook! Simulate and plot the example. Do a slight change in the model, re-simulate and re-plot. class HelloWorld "A simple equation" Real x(start=1); equation der(x)= -x; end HelloWorld; simulate(HelloWorld, stopTime = 2) plot(x) Locate the VanDerPol model in DrModelica and try it! Do some change and re-simulate

Peter Fritzson 16 Small OMNotebook Exercises cont. Select and copy a cell (tree to the right) Position the horizontal cell cursor: first click between cells; then click once more on top of the horizontal line Paste the cell Note: You can find most Users Guide examples in the UsersGuideExamples.onb in the testmodels directory