Fakultät Maschinenwesen, Professur für Baumaschinen und Fördertechnik
Linköping, 04.02.2013
Simulating MultiBody Applications with
OpenModelica
– Current Status -
Christian Schubert, Dresden University
Multibody simulation with OpenModelica Slide 2
Outline
1. Introduction
2. Feature Status
3. Performance by looking at Examples
a. Examples
b. Translation
c. Compilation
d. Simulation
4. Possible Future Directions
04/02/2013
Multibody simulation with OpenModelica Slide 5
Applications
Toolchain
04.02.2013
=> Performance is most important to us
Modelica Model
OMC
FMU
SARTURIS
Motion Platform
Driver Cabin
Visuals
Multibody simulation with OpenModelica Slide 6
Required Features
Handling of Records, Vectors, Matrices
Overconstrained Connection Graph
Annotations: Inline, (__Dymola_)InlineAfterIndexReduction, derivative, noDerivative, Evaluate
Dynamic State Selection
Handling of replaceable gravityFunction
Current Status
04.02.2013
Multibody simulation with OpenModelica Slide 7
Peformance/Comfort Features
Tearing Reducing size of sparse blocks /
Nonlinear Solver (Kinematic Loops)
Analytic Jacobians
Robust and fast Event Handling
Support for large models
Visualization
/
Current Status
04.02.2013
Multibody simulation with OpenModelica Slide 8
Current Status
Necessary features implemented
Workaround for gravityFunction
Multibody should work
One test from MSL 3.2.1 fails: Elementary.UserDefinedGravityField
Performance/Comfort functions not finished
Let us see how they perform
04.02.2013
Multibody simulation with OpenModelica Slide 9
Examples
RobotR3 EngineV6 Pendulum N
Picture
#Vars 4921 12491 ≈ 242 N
#States 36 4 2 N
#Nls 0 6 0
Linear 137 -> 6 322 -> 31 ≈ 12 N -> N
04.02.2013
Multibody simulation with OpenModelica Slide 10
Examples
Pendulum with N bodies
04.02.2013
…
model Pendulum_N constant Integer N = 2; inner World world; Revolute revolute[N]; BodyCylinder bodyCylinder[N]; Damper damper[N]; equation connect(world.frame_b, revolute[1].frame_a); connect(revolute.frame_b, bodyCylinder.frame_a); connect(damper.flange_a, revolute.support); connect(damper.flange_b, revolute.axis); connect(bodyCylinder[1:N-1].frame_b, revolute[2:N].frame_a); end Pendulum_N;
Multibody simulation with OpenModelica Slide 11
Examples
Division into three steps
04.02.2013
Translation Compilation Simulation
Modelica Model
C Source Code
Executable Resultfile
Multibody simulation with OpenModelica Slide 12
Translation
RobotR3 EngineV6
04.02.2013
Cra
she
d 85
90
95
100
OMC 1.8.1 OMC 1.9.0.b3 Dymola
0
5
10
OMC 1.8.1 OMC1.9.0.b3
Dymola
Software
0
5
10
15
20
25
30
35
OMC 1.8.1 OMC1.9.0.b3
Dymola
Software
translateModel
Templates
Simcode
Backend
Frontend≈ C
rash
ed
Multibody simulation with OpenModelica Slide 13
Translation
04.02.2013
0
0,2
0,4
0,6
0,8
1
1,2
1,4
1,6
1,8
10 30 50 70 90 110 130 150 170 190 210 230 250
Tim
e p
er
bo
dy
Number of Bodies
Normalized Time for Translation (with Tearing)
Templates
Simcode
Backend
Frontend
Multibody simulation with OpenModelica Slide 14
Translation
• Translation lies within factor 10 of Dymola
• Translation scales with O(N²)
• Problems have been identified and are being fixed
04.02.2013
Multibody simulation with OpenModelica Slide 15
Compilation
04.02.2013
1
10
100
1000
0 20 40 60 80 100
Re
qu
ire
d T
ime
/s
Number of bodies
Compilation - Pendulum N
OMC - Mingw
OMC - Visual Studio
Dymola - Visual Studio
Multibody simulation with OpenModelica Slide 16
Compilation
• Compilation as long as translation
• Compilation limits model size
• gcc faster than Visual Studio
• much slower than Dymola
04.02.2013
Multibody simulation with OpenModelica Slide 17
Simulation
Tearing
• Deactivated by default for linear systems
• +d=doLinearTearing
• Always treated as nonlinear system
• => Numerical Jacobian
• Much faster/more robust with symbolic Jacobian
• +d=doLinearTearing,NLSanalyticJacobian
04.02.2013
Multibody simulation with OpenModelica Slide 18
Simulation
04.02.2013
0
0,05
0,1
0,15
0,2
0,25
0,3
t RH
S/m
s
RobotR3
Erro
r
0
0,2
0,4
0,6
0,8
1
1,2
1,4
1,6
t RH
S/m
s
EngineV6
Multibody simulation with OpenModelica Slide 19
Simulation
04.02.2013
0
1
2
3
4
5
6
7
8
9
10
0 20 40 60 80 100
t RH
S/m
s
Number of bodies
Evaluating x_dot=f(x,t)
OMC
OMC - Tearing
OMC - Tearing Analytical
Dymola
Multibody simulation with OpenModelica Slide 20
Simulation
EngineV6 (𝐟 t, 𝐱 equally fast)
Not everything is counted! Event detection has to be improved
04.02.2013
OMC Dymola
Simulation time[s] 9,72 5,18
steps 8081 7912
events 544 335
F-Evaluations 12273 24548
Jacobians 3338 3215
Multibody simulation with OpenModelica Slide 21
Simulation
Pendulum with 40 bodies (𝐟 t, 𝐱 3x slower)
04.02.2013
OMC Dymola
Simulation time[s] 0,951 0,421
steps 257 240
events 0 0
F-Evaluations 364 1837
Jacobians 14 17
Multibody simulation with OpenModelica Slide 22
Possible Future Directions
Short term goals: Finishing • Dynamic State Selection • Tearing • Analytic Jacobians Mid term goal: • Visualization • Clean up OpenModelica-Trac Long term goal:
A complete redesign of the generated code should be considered
04.02.2013
Multibody simulation with OpenModelica Slide 23
Thank you
04/02/2013
Christian Schubert, Dipl.-Ing, M.Sc. Dresden University of Technology Institute of Processing Machines and Mobile Machines E-Mail: [email protected] Tel.: +49 351 463-39278