@@ -5,9 +5,27 @@ using ModelingToolkitStandardLibrary.Mechanical.PlanarMechanics
55D = Differential (t)
66
77@testset " Pendulum" begin
8+ @named ceiling = Fixed ()
9+ @named rod = FixedTranslation (rx = 1.0 , ry = 0.0 )
810 @named body = Body (m = 1 , j = 0.1 )
911 @named revolute = Revolute (phi = 0.0 , ω = 0.0 )
10- @named rod = FixedTranslation (rx = 1.0 , ry = 0.0 )
11- @named ground = Fixed ()
12- @test true
12+
13+ connections = [
14+ connect (ceiling. frame, revolute. frame_a),
15+ connect (revolute. frame_b, rod. frame_a),
16+ connect (rod. frame_b, body. frame),
17+ ]
18+
19+ @named model = ODESystem (connections,
20+ t,
21+ [],
22+ [],
23+ systems = [body, revolute, rod, ceiling])
24+ sys = structural_simplify (model)
25+ unset_vars = setdiff (states (sys), keys (ModelingToolkit. defaults (sys)))
26+ prob = ODEProblem (sys, unset_vars .=> 0.0 , (0.0 , 60 ), []; jac = true )
27+ sol = solve (prob, Rodas5P ())
28+
29+ # phi and omega for the pendulum body
30+ @test length (states (sys)) == 2
1331end
0 commit comments