Lecture01 - Introduction
Lecture01 - Introduction
Lecture01 - Introduction
Peter Fritzson
Linkping University, [email protected]
Mohsen TorabzadehTorabzadeh-Tari
Linkping University, [email protected]
Martin Sjlund
Linkping University, [email protected]
Slides
Based on book and lecture notes by Peter Fritzson
Contributions 2004-2005 by Emma Larsdotter Nilsson, Peter Bunus Contributions 2007-2008 by Adrian Pop, Peter Fritzson Contributions 2009 by David Broman, Jan Brugrd, Mohsen Torabzadeh-Tari, Peter Fritzson Contributions 2010 by Mohsen Torabzadeh-Tari, Peter Fritzson
Peter Fritzson
pelab
Outline Day 1
Part I Introduction to Modelica and a demo example Part II Modelica environments
Peter Fritzson
pelab
pelab
Software Installation
Start the software installation Install OpenModelica-1.5.msi and simForge (e.g. SimForge-0.9.RC2.jar) from the USB Stick (If ( you y have a Mac or Linux computer, p install OpenModelica-1.5.0)
Peter Fritzson
pelab
Outline
Introduction to Modeling and Simulation Modelica - The next generation modeling and g g Simulation Language Modeling and Simulation Environments and OpenModelica Classes Components, Connectors and Connections q Equations Discrete Events and Hybrid Systems Algorithms and Functions Demonstrations
6
Peter Fritzson Copyright Open Source Modelica Consortium
pelab
Why Modeling & Simulation ? Increase understanding of complex systems Design and optimization Virtual prototyping Verification
Build more complex systems
Peter Fritzson
pelab
What is a system? A system is an object or collection of objects whose properties we want to study Natural N t l and d artificial tifi i l systems t Reasons to study: curiosity, to build it
Collector
Hot water
Peter Fritzson
pelab
Peter Fritzson
pelab
Experiments An experiment is the process of extracting information from a system by exercising its inputs Problems
Experiment might be too expensive Experiment might be too dangerous System needed for the experiment might not yet exist
10
Peter Fritzson
pelab
Model concept
A model of a system is anything an experiment can be applied to in order to answer questions about that system
Kinds of models:
Mental model statement like a person is reliable Verbal model model expressed in words Physical model a physical object that mimics the system Mathematical model a description of a system where the relationships p are expressed p in mathematical form a virtual prototype Physical modeling also used for mathematical models built/structured in the same way as physical models
11
Peter Fritzson
pelab
12
Peter Fritzson
pelab
Reasons for Simulation Suppression of second-order effects Experiments are too expensive, too dangerous, or the system to be investigated does not yet exist The time scale is not compatible with experimenter (Universe, million years, ) Variables may be inaccessible. Easy manipulation of models Suppression of disturbances
13
Peter Fritzson
pelab
14
Peter Fritzson
pelab
15
Peter Fritzson
pelab
Kinds of Mathematical Models Dynamic vs. Static models y models Continuous-time vs. Discrete-time dynamic Quantitative vs. Qualitative models
16
Peter Fritzson
pelab
Dynamic vs. Static Models A dynamic model includes time in the model A static model can be defined without involving time
Resistor voltage static system
time
17
Peter Fritzson
pelab
Continuous Discrete
time
18
Peter Fritzson
pelab
Quantitative vs. Qualitative Models Results in qualitative data Variable values cannot be represented numerically Mediocre = 1, Good = 2, Tasty = 3, Superb = 4
pelab
Subsystem level integration test calibration and verification Subsystem level integration and verification
Architectural design and system functional design Detailed feature design and implementation
Design Refinement
Verification
20
Peter Fritzson
pelab
10
Connection Component 3
21
Peter Fritzson
pelab
cut joint
r3Drive1 1
axis6
tn
qd
axis5
l
qdRef
Kd
S
0.03
Jmotor=J rel joint=0
spring=c
axis4
0.3
+1 +1
b(s)
340.8 S
a(s)
fric=Rv0
qRef
pSum
Kv
sum
w Sum
rate2
rate3
iRef
S
gear=i
axis3
rate1 b(s) a(s) tacho2 b(s) a(s) tacho1 PT1
g5
axis2
Rp2=50
qd
Rd1=100
C=0.004*D/w m
Rp1=200
axis1
Rd2=100 Ri=10 -
+ diff
+ OpI
+ pow er
Srel = n*transpose(n)+(identity(3)- n*transpose(n))*cos(q)skew(n)*sin(q); g3 wrela = n*qd; g1 zrela = n*qdd; Sb = Sa*transpose(Srel); r0b = r0a; hall1 vb = Srel*va; wb = Srel*(wa + wrela); g4 ab = Srel*aa; qd g2 zb = Srel*(za + zrela + cross(wa, wrela));
Rd3=100 hall2
Vs
Rd4=100
emf
y x inertial
22
Peter Fritzson
pelab
11
Hello
23
Peter Fritzson
pelab
24
Peter Fritzson
pelab
12
Modelica in Avionics
25
Peter Fritzson
pelab
Modelica in Biomechanics
26
Peter Fritzson
pelab
13
27
Peter Fritzson
pelab
Stored Knowledge Model knowledge is stored in books and human minds which computers cannot access The change of motion is proportional to the motive force impressed
Newton
28
Peter Fritzson
pelab
14
pelab
What is Modelica?
A language for modeling of complex physical systems Robotics R b ti Automotive Aircrafts Satellites Power plants Systems biology
30
Peter Fritzson
pelab
15
What is Modelica?
A language for modeling of complex physical systems
Primary designed for simulation, but there are also other usages of models, e.g. optimization.
31
Peter Fritzson
pelab
What is Modelica?
A language for modeling of complex physical systems
i.e., Modelica is not a tool
32
Peter Fritzson
pelab
16
Multi-domain modeling
Combine electrical, mechanical, thermodynamic, hydraulic, biological, control, event, real-time, etc...
Everything is a class
Strongly typed object-oriented language with a general class concept, Java & MATLAB-like syntax
Efficient, non-proprietary
Efficiency comparable to C; advanced equation compilation, e.g. 300 000 equations, ~150 000 lines on standard PC
33
Peter Fritzson Copyright Open Source Modelica Consortium
pelab
MATLAB similarities
MATLAB-like array and scalar arithmetic, but strongly typed and
efficiency comparable to C.
Non-Proprietary
Open Language Standard Both B th Open-Source O S and dC Commercial i li implementations l t ti
34
Peter Fritzson
pelab
17
Modelica Language Properties Declarative and Object-Oriented Equation-based; continuous and discrete equations Parallel process modeling of real-time applications, according to synchronous data flow principle Functions with algorithms without global side-effects (but local data updates allowed) Type system inspired by Abadi/Cardelli Everything is a class Real, Integer, models, functions, packages, parameterized classes....
35
Peter Fritzson Copyright Open Source Modelica Consortium
pelab
Object Oriented Mathematical Modeling with Modelica The static declarative structure of a mathematical model is emphasized OO is primarily used as a structuring concept OO is not viewed as dynamic object creation and sending messages Dynamic model properties are expressed in a declarative way through equations. Acausal classes supports better reuse of modeling and design knowledge than traditional classes
36
Peter Fritzson Copyright Open Source Modelica Consortium
pelab
18
Brief Modelica History First Modelica design group meeting in fall 1996
International group of people with expert knowledge in both language design and physical modeling Industry and academia
Modelica Versions
1.0 released September 1997 2.0 released March 2002 2.2 released March 2005 3 0 released 3.0 l dS September t b 2007 3.1 released May 2009
Peter Fritzson
pelab
Modelica Conferences
The 1st International Modelica conference October, 2000 The 2nd International Modelica conference March 18-19, 2002 The 3rd International Modelica conference November 5-6, 2003 in Linkping, Sweden The 4th International Modelica conference March 6-7, 2005 in Hamburg, Germany The 5th International Modelica conference September 4-5, 2006 in Vienna, Austria The 6th International Modelica conference March 3-4, 2008 in Bielefeld, Germany The 7th International Modelica conference Sept 21-22, 2009 in Como, Italy
38
Peter Fritzson
pelab
19
39
Peter Fritzson
pelab
40
Peter Fritzson
pelab
20
L
L=1 L=0.1
The RL-Circuit
G
Simulation
41
Peter Fritzson
pelab
pelab
21
pelab
22