@@ -9,6 +9,7 @@ using Pkg
9
9
10
10
using ModelingToolkit
11
11
using Multibody
12
+ using Multibody: Robot6DOF
12
13
using JuliaSimCompiler
13
14
using OrdinaryDiffEq
14
15
using CairoMakie
@@ -65,6 +66,54 @@ barplot(f[2,1], timings, axis=(; title="Log Timings", xticks = (xs, labels), ysc
65
66
f
66
67
```
67
68
69
+ ## OpenModelica
70
+
71
+ ```julia
72
+ cd(@__DIR__)
73
+ using Pkg
74
+ Pkg.activate(".")
75
+ using OMJulia
76
+ mod = OMJulia.OMCSession();
77
+ OMJulia.sendExpression(mod, "getVersion()")
78
+
79
+ @show "Start OpenModelica Timings"
80
+
81
+ totaltime = @elapsed begin
82
+ om_build = @elapsed ModelicaSystem(mod, modelName="Modelica.Mechanics.MultiBody.Examples.Systems.RobotR3.FullRobot", library="Modelica")
83
+ om_sim = @elapsed res = sendExpression(mod, "simulate(Modelica.Mechanics.MultiBody.Examples.Systems.RobotR3.FullRobot)")
84
+ end
85
+ @assert res["messages"][1:11] == "LOG_SUCCESS"
86
+
87
+ OMJulia.quit(mod)
88
+ ```
89
+
90
+ ## Comparison
91
+ ```julia
92
+ colors = Makie.wong_colors()
93
+ labels = ["Build", "Simulate"]
94
+ julia_build = time_instantiate + time_simplify + time_prob + time_extract_data
95
+ julia_sim = time_solve
96
+
97
+ data = [
98
+ julia_build julia_sim
99
+ om_build om_sim
100
+ ]
101
+
102
+ xs = repeat(1:length(labels), inner=2)
103
+ group = repeat([1,2], outer=2)
104
+ fig = Figure()
105
+ barplot(fig[1,1], xs, vec(data), dodge=group, color=colors[group], axis=(; title="Timings", xticks = ([1,2], labels)))
106
+
107
+ # Legend
108
+ legendentries = ["Julia", "OpenModelica"]
109
+ elements = [PolyElement(polycolor = colors[i]) for i in 1:length(legendentries)]
110
+ title = "Contestants"
111
+
112
+ Legend(fig[1,2], elements, legendentries, title)
113
+ fig
114
+ ```
115
+
116
+
68
117
## Appendix
69
118
70
119
```julia, echo = false
0 commit comments