Skip to content

Commit d2ca9b9

Browse files
committed
tweak tutorial
1 parent a0ed915 commit d2ca9b9

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

docs/src/examples/kinematic_loops.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ systems = @named begin
3333
b3 = BodyShape(m=1, r = [-l, 0, 0], radius=0.03)
3434
b4 = BodyShape(m=1, r = [0.0, -l, 0], radius=0.03)
3535
damper1 = Rotational.Damper(d=0.1)
36-
damper2 = Rotational.Damper(d=0.11)
36+
damper2 = Rotational.Damper(d=0.1)
3737
end
3838
3939
connections = [
@@ -60,11 +60,15 @@ connections = [
6060
6161
]
6262
@named fourbar = ODESystem(connections, t, systems = [world; systems])
63-
m = structural_simplify(IRSystem(fourbar))
64-
prob = ODEProblem(m, [world.g => 9.81], (0.0, 30.0))
65-
sol = solve(prob, FBDF(autodiff=false))
66-
67-
plot(sol, idxs = [j1.phi, j2.phi, j3.phi])
63+
fourbar = complete(fourbar)
64+
ssys = structural_simplify(IRSystem(fourbar))
65+
prob = ODEProblem(ssys, [fourbar.j1.phi => 0.1], (0.0, 10.0))
66+
sol = solve(prob, FBDF(autodiff=true))
67+
68+
plot(
69+
plot(sol, idxs = [j1.phi, j2.phi, j3.phi]),
70+
plot(sol, idxs = [j1.w, j2.w, j3.w]),
71+
)
6872
```
6973

7074
```@example kinloop
@@ -124,9 +128,9 @@ connections = [connect(j2.frame_b, b2.frame_a)
124128
]
125129
@named fourbar2 = ODESystem(connections, t, systems = [world; systems])
126130
fourbar2 = complete(fourbar2)
127-
m = structural_simplify(IRSystem(fourbar2))
131+
ssys = structural_simplify(IRSystem(fourbar2))
128132
129-
prob = ODEProblem(m, [], (0.0, 1.4399)) # The end time is chosen to make the animation below appear to loop forever
133+
prob = ODEProblem(ssys, [], (0.0, 1.4399)) # The end time is chosen to make the animation below appear to loop forever
130134
131135
sol = solve(prob, FBDF(autodiff=true));
132136
@test SciMLBase.successful_retcode(sol)

0 commit comments

Comments
 (0)