Download Object-Oriented Modeling with Modelica: A First Look at Dymola and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!
September 8, 2003 (^) Start of presentation
Object Oriented Modeling
- The aim of this lecture is to illustrate the requirements of a software environment for object-oriented modeling of physical systems and to show how these requirements can be met in practice.
- The lecture offers a first glimpse at features and capabilities of Dymola , a software environment created for the purpose of modeling complex physical systems in an object-oriented fashion. Dymola offers a graphical user interface.
- Some features of the underlying textual model representation, called Modelica , are also introduced.
September 8, 2003 (^) Start of presentation
Table of Contents
• The causality of the model equations
• Graphical modeling
• Model structure in Modelica
• Model topology in Modelica
• Inheritance rules
• Hierarchical modeling
September 8, 2003 (^) Start of presentation
The Causality of the Model Equations
U (^0) i +
R
I (^0) I 0
R
U 0 = f(t) i = U 0 / R
I 0 = f(t) u = R· I 0
Identical Objects
Different Equations
The causality of the equations must not be predetermined. It can only be decided upon after the analysis of the system topology.
September 8, 2003 (^) Start of presentation
Basic Requirements of OO Modeling
• Physical objects should be representable by
mathematical graphical objects.
• The graphical objects should be
topologically connectable.
• The mathematical models should be
hierarchically describable. To this end, it
must be possible to represent networks of
coupled objects again as graphical objects.
September 8, 2003 (^) Start of presentation
Models in Modelica
• Models in Modelica consist of a description of
their model structure as well as a description of
their embedding in the model environment :
model Model name Description of the model embedding ; equations Description of the model structure ; end Model name;
September 8, 2003 (^) Start of presentation
Model Structure in Modelica
- The model structure in Modelica consists either of a set of equations, a description of the model topology, or a combination of the two types of model structure descriptions.
- A topological model description is usually done by dragging and dropping model icons from graphical model libraries into the modeling window. These models are then graphically interconnected among each other.
- The stored textual version of the topological model consists of a declaration of its sub-models (model embedding), a declaration of its connections (model structure), as well as a declaration of the graphical description elements (Annotation).
September 8, 2003 (^) Start of presentation
Model Topology in Modelica
Class name
Instance name
Modifier
Connection
Connector
model MotorDrive PI controller; Motor motor; Gearbox gearbox(n=100); Shaft Jl(J=10); Tachometer wl; equation connect(controller.out, motor.inp); connect(motor.flange , gearbox.a); connect(gearbox.b , Jl.a); connect(Jl.b , wl.a); connect(wl.w , controller.inp); end MotorDrive;
controller motor PI n=
Jl=
w l
w r
September 8, 2003 (^) Start of presentation
Resistors in Modelica
i^ R vp vn
u
connector Pin Voltage v; flow Current i; end Pin;
model Resistor "Ideal resistor" Pin p, n; Voltage u; parameter Resistance R; equation u = p.v - n.v; p.i + n.i = 0; R*p.i = u; Voltage^ end^ Resistor; type ElectricPotential = Real (final quantity="ElectricPotential", final unit="V"); type Voltage = ElectricPotential;
September 8, 2003 (^) Start of presentation
Decomposition and Abstraction
planetary1=110/
C4=0.12 C5=0. planetary2=110/
C6=0.
bearing C8=0.
demultiplex
shaftS=2e-3S planetary3=120/
C11=0.
shaftS1=2e-3S
C12=0.
bearing4 bearing
Courtesy Toyota Tecno-Service
September 8, 2003 (^) Start of presentation
Heterogeneous Modeling Formalisms
inertialyx
axis
axis
axis
axis
axis
r3Drive1 axis qdRef (^1) S qRef (^1) S r3Controlr3Motor 1
k2i qddRef (^) k1i cut joint
l
qd
tn
Jmotor=J spring=cfric=Rv0 gear=i relS joint=0S
Vs
Rd2=100 C=0.004D/w m La=(250/(2D*wm))Ra= +-OpI
Rd1= Ri=
Rp2=50Rp1=
Rd4= g1hall2Rd3=
g
g hall g
g
w r qd q
rate2b(s)a(s) rate3340.8S rate1b(s)a(s) tacho1PT
0.03Kd w Sum
pSum +1+1sum
- 0.3Kv tacho2b(s)a(s) q (^) qd
qRef iRef
qdRef
September 8, 2003 (^) Start of presentation
References
- Brück, D., H. Elmqvist, H. Olsson, and S.E. Mattsson (2002), “Dymola for Multi-Engineering Modeling and Simulation,” Proc. 2nd^ International Modelica Conference , pp. 55:1-8.
- Otter, M. and H. Elmqvist (2001), “Modelica: Language, Libraries, Tools, Workshop, and EU-Project RealSim,” Modelica web-site.