Towards Unified System Modeling with the ModelicaML UML Profile

advertisement
Towards Unified System Modeling
with the
ModelicaML UML Profile
Adrian Pop, David Akhvlediani, Peter Fritzson
Programming Environments Laboratory,
Department of Computer and Information Science
Linköping University
adrpo@ida.liu.se
EOLT’2007, 2007-07-30
Outline
ƒ Introduction
ƒ System Modeling Language (SysML™)
ƒ Modelica
ƒ ModelicaML: a UML profile for Modelica
ƒ Overview and Purpose
ƒ Diagrams
ƒ Package Diagram
ƒ Class Diagram and Internal Class Diagram
ƒ Equation Diagram
ƒ Simulation Diagram
ƒ Conclusions and Future Work
2
System Modeling Language (SysML™)
ƒ Graphical modeling language for Systems
Engineering constructed as a UML2 Profile
ƒ Designed to provide simple but powerful
constructs for modeling a wide range of systems
engineering problems
ƒ Effective in specifying requirements, structure,
behavior, allocations, and constraints on system
properties to support engineering analysis
ƒ Intended to support multiple processes and
methods such as structured, object-oriented, etc.
3
SysML™ - Diagrams
4
SysML™ - Block Definitions
5
Modelica – General Formalism to Model Complex Systems
Robotics
Automotive
Aircrafts
Satellites
Biomechanics
Power plants
Hardware-in-the-loop,
real-time simulation
ƒ etc
ƒ
ƒ
ƒ
ƒ
ƒ
ƒ
ƒ
6
Modelica – The Next Generation Modeling Language
ƒ Declarative language
ƒ Equations and mathematical functions allow acausal
modeling, high level specification, increased
correctness
ƒ 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
ƒ Visual component programming
ƒ Hierarchical system architecture capabilities
ƒ Efficient, nonproprietary
ƒ Efficiency comparable to C; advanced equation
compilation, e.g. 300 000 equations
7
Modelica Language Properties
ƒ Declarative and Object-Oriented
ƒ Equation-based; continuous and discrete
equations
ƒ Parallel process modeling of concurrent
applications, according to synchronous data flow
principle
ƒ Functions with algorithms without global sideeffects
(but local data updates allowed)
ƒ Type system inspired by
Abadi/Cardelli (Theory of Objects)
ƒ Everything is a class – Real, Integer, models,
functions, packages, parameterized classes....
8
Modelica Acausal Modeling Semantics
ƒ What is acausal modeling/design?
ƒ Why does it increase reuse?
ƒ The acausality makes Modelica classes more
reusable than traditional classes containing
assignment statements where the input-output
causality is fixed.
ƒ Example: a resistor equation:
R*i = v;
ƒ can be used in three ways:
i := v/R;
v := R*i;
R := v/i;
9
Connector Classes, Components and Connections
connector Pin
Voltage v;
flow Current i;
end Pin;
Keyword flow indicates
that currents of
connected pins sums to
zero.
A connect statement in Modelica
connect(Pin1,Pin2)
corresponds to equations:
Pin1.v = Pin2.v
Pin1.i + Pin2.i = 0
Connection between Pin1 and Pin2
10
Modelica - Reusable Class Libraries
R=
C=
L=
Info
Info
G
shaft3DS= shaft3D=
S
S
S
shaft=
gear1=
D
T
:1
+
Op
shaftS=
cylBody=bodyShape=
diff=
bearing
V
gear2=
planetary=
ring=
cyl=
S
moveS
c=
move
torque
fric=
C
y
x
barC2=
force
fricTab
clutch=
a
rev=
univ
planar=
sphere
sphereC
c=
d=
prism=
free
cSer=
C
sensor
lineForce=
r
torque
converter
w
S
S
screw =
barC=
d=
freeS
S
sun=
fixTooth
S
prismS= screw S=
planarS= sphereS
S
S
S
revS=
univS
i
E
cylS=
S
planet=
bodyBar=
inertial
Is
Vs
DC=
AC=
Info
body=
bar=
lineTorque=
advanced
drive
translation
Library
Library
Library
lineSensor
s
sd
t
fixedBase
S
state
11
Graphical Modeling - Drag and Drop Composition
12
Hierarchical Composition Diagram for a Model of a Robot
k2
i
qddRef
qdRef
qRef
1
1
S
S
k1
cut joint
r3Control
r3Motor
i
axis6
tn
r3Drive1
1
qd
axis5
l
qdRef
Kd
S
rel
0.03
Jmotor=J
0.3
sum
w Sum
+1
+1
-
rate2
rate3
b(s)
340.8
a(s)
S
S
iRef
axis4
gear=i
axis3
rate1
tacho2
b(s)
b(s)
a(s)
a(s)
tacho1
PT1
g5
q
qd
axis2
C=0.004*D/w m
Rd1=100
Rp1=200
Rd2=100
-
Ri=10
-
Ra=250 La=(250/(2*D*w m))
Rp2=50
-
Kv
fric=Rv0
pSum
axis1
+
Srel = n*n' + (identity(3) - n*n')*cos(q)
- skew(n)*sin(q);
diff
pow er
+
OpI
wrela = n*qd;
zrela = n*qdd;
Rd4=100
emf
Sb = Sa*Srel';
r0b = r0a;
g3
vb = Srel*va;
g1
wb = Srel*(wa + wrela);
ab = Srel*aa;
hall1
w
zb = Srel*(za + zrela + cross(wa, wrela));
fa = Srel'*fb;
ta = Srel'*tb;
g4
+
Vs
Rd3=100
qRef
joint=0
spring=c
hall2
g2
qd
q
y
x
inertial
r
13
Multi-Domain Modelica Model - DCMotor
ƒ A DC motor can be thought of as an electrical circuit
which also contains an electromechanical component.
model DCMotor
Resistor R(R=100);
Inductor L(L=100);
VsourceDC DC(f=10);
Ground G;
ElectroMechanicalElement EM(k=10,J=10, b=2);
Inertia load;
equation
R
L
connect(DC.p,R.n);
connect(R.p,L.n);
DC
connect(L.p, EM.n);
connect(EM.p, DC.n);
connect(DC.n,G.p);
connect(EM.flange,load.flange);
G
end DCMotor
EM
load
14
SysML vs. Modelica
ƒ SysML
ƒ Pros
ƒ Can model all aspects of complex system design
ƒ Cons
ƒ Precise behavior can be described but not simulated
(executed)
ƒ Modelica
ƒ Pros
ƒ Precise behavior can be described and simulated
ƒ Cons
ƒ Cannot model all aspects of complex system design,
i.e. requirements, inheritance diagrams, etc
15
Outline so far
ƒ Introduction
ƒ System Modeling Language (SysML™)
ƒ Modelica
ƒ ModelicaML: a UML profile for Modelica
ƒ Overview and Purpose
ƒ Diagrams
ƒ Package Diagram
ƒ Class Diagram and Internal Class Diagram
ƒ Equation Diagram
ƒ Simulation Diagram
ƒ Conclusions and Future Work
16
ModelicaML - a UML profile for Modelica
ƒ Supports modeling with all Modelica constructs i.e.
restricted classes, equations, generics, discrete variables,
etc.
ƒ Multiple aspects of a system being designed are supported
ƒ system development process phases such as requirements
analysis, design, implementation, verification, validation and
integration.
ƒ Supports mathematical modeling with equations (to
specify system behavior). Algorithm sections are also
supported.
ƒ Simulation diagrams are introduced to configure, model
and document simulation parameters and results in a
consistent and usable way.
ƒ The ModelicaML meta-model is consistent with SysML in
order to provide SysML-to-ModelicaML conversion and
back.
17
ModelicaML - Purpose
ƒ Targeted to Modelica and SysML users
ƒ Provide a SysML/UML view of Modelica for
ƒ Documentation purposes
ƒ Language understanding
ƒ To extend Modelica with additional design
capabilities (requirements modeling,
inheritance diagrams, etc)
ƒ To support translation between Modelica and
SysML models via XMI
18
ModelicaML - Overview
19
ModelicaML – Package Diagram
ƒ The Package Diagram groups logically connected user
defined elements into packages.
ƒ The primarily purpose of this diagram is to support the
specifics of the Modelica packages.
20
ModelicaML – Class Diagram
ƒ ModelicaML provides
extensions to SysML in order
to support the full set of
Modelica constructs.
ƒ ModelicaML defines unique
class definition types
ModelicaClass,
ModelicaModel,
ModelicaBlock,
ModelicaConnector,
ModelicaFunction and
ModelicaRecord that
correspond to class,
model, block,
connector, function and
record restricted Modelica
classes.
ƒ Modelica specific restricted
classes are included because
a modeling tool needs to
impose their semantic
restrictions (for example a
record cannot have equations,
etc).
Class Diagram defines Modelica
classes and relationships between
classes, like generalizations,
association and dependencies
21
ModelicaML - Internal Class Diagram
ƒ Internal Class Diagram shows the internal
structure of a class in terms of parts and
connections
22
ModelicaML – Equation Diagram
ƒ behavior is specified using Equation Diagrams
ƒ all Modelica equations have their specific diagram:
ƒ initial, when, for, if equations
23
ModelicaML – Simulation Diagram
ƒ Used to model, configure and document simulation
parameters and results
ƒ Simulation diagrams can be integrated with any Modelica
modeling and simulation environment (OpenModelica)
24
Outline so far
ƒ Introduction
ƒ System Modeling Language (SysML™)
ƒ Modelica
ƒ ModelicaML: a UML profile for Modelica
ƒ Overview and Purpose
ƒ Diagrams
ƒ Package Diagram
ƒ Class Diagram and Internal Class Diagram
ƒ Equation Diagram
ƒ Simulation Diagram
ƒ Conclusions and Future Work
25
Conclusions
ƒ ModelicaML – UML profile for Modelica
ƒ Targeted to Modelica and SysML users
ƒ Provides a SysML/UML view of Modelica for
ƒ Documentation purposes
ƒ Language understanding
ƒ extends Modelica with additional design
capabilities (requirements modeling,
inheritance diagrams, etc)
ƒ supports translation between Modelica and
SysML models via XMI
26
Future Work
ƒ integration with Modelica Development Tooling (MDT) and the
OpenModelica Compiler
ƒ Translation between Modelica, ModelicaML and SysML
ƒ Further improvements to ModelicaML specification
27
End
Thank You!
Questions?
Modelica Development Tooling (MDT)
http://www.ida.liu.se/~pelab/modelica/OpenModelica/MDT/
OpenModelica Project
http://www.ida.liu.se/~pelab/modelica/OpenModelica.html
28
Download