|
55 | 55 | m = multibody(motorTest) |
56 | 56 | # @test length(unknowns(m)) == 3 |
57 | 57 | # D(motorTest.motor.gear.bearingFriction.w) => 0 |
58 | | -cm = complete(motorTest) |
59 | 58 |
|
60 | 59 | prob = ODEProblem(m, [ |
61 | | - D(D(cm.motor.Jmotor.phi)) => 0, |
| 60 | + D(D(m.motor.Jmotor.phi)) => 0, |
62 | 61 | ], (0.0, 5.0)) |
63 | 62 | sol = solve(prob, Rodas4()) |
64 | 63 | @test successful_retcode(sol) |
65 | | -doplot() && plot(sol, idxs=cm.motor.phi.phi.u) |
| 64 | +doplot() && plot(sol, idxs=m.motor.phi.phi.u) |
66 | 65 |
|
67 | 66 | ## |
68 | 67 |
|
|
93 | 92 |
|
94 | 93 | @named gearTest = GearTest() |
95 | 94 | m = multibody(gearTest) |
96 | | -cm = complete(gearTest) |
97 | 95 |
|
98 | 96 | prob = ODEProblem(m, [ |
99 | | - cm.motor.Rd4.i => 0, |
100 | | - cm.gear.gear.phi_b => 0, |
101 | | - D(cm.gear.gear.phi_b) => 0, |
| 97 | + m.motor.Rd4.i => 0, |
| 98 | + m.gear.gear.phi_b => 0, |
| 99 | + D(m.gear.gear.phi_b) => 0, |
102 | 100 | ], (0.0, 5.0)) |
103 | 101 | sol = solve(prob, Rodas4()) |
104 | 102 | @test successful_retcode(sol) |
105 | | -doplot() && plot(sol, idxs=cm.motor.phi.phi.u) |
| 103 | +doplot() && plot(sol, idxs=m.motor.phi.phi.u) |
106 | 104 |
|
107 | 105 |
|
108 | 106 | @component function GearTest1(; name) |
@@ -156,7 +154,6 @@ m = multibody(gearTest) |
156 | 154 | end |
157 | 155 |
|
158 | 156 | @named controllerTest = ControllerTest() |
159 | | -m = structural_simplify(controllerTest) |
160 | 157 | m = multibody(controllerTest) |
161 | 158 |
|
162 | 159 |
|
@@ -200,35 +197,34 @@ end |
200 | 197 | # m = structural_simplify(axisTest) |
201 | 198 | m = multibody(axisTest) |
202 | 199 |
|
203 | | -cm = complete(axisTest) |
204 | 200 | tspan = (0.0, 5.0) |
205 | 201 | prob = ODEProblem(m, [ |
206 | 202 | # ModelingToolkit.missing_variable_defaults(m); |
207 | | - # D(cm.axis2.gear.bearingFriction.w) => 0 |
208 | | - cm.axis2.motor.flange_motor.phi => deg2rad(20) * 0, |
209 | | - D(cm.axis2.motor.flange_motor.phi) => 0, |
210 | | - cm.axis2.motor.Jmotor.phi => deg2rad(20) * 0, |
211 | | - cm.axis2.gear.gear.phi_b => 0, |
212 | | - D(cm.axis2.gear.gear.phi_b) => 0, |
| 203 | + # D(m.axis2.gear.bearingFriction.w) => 0 |
| 204 | + m.axis2.motor.flange_motor.phi => deg2rad(20) * 0, |
| 205 | + D(m.axis2.motor.flange_motor.phi) => 0, |
| 206 | + m.axis2.motor.Jmotor.phi => deg2rad(20) * 0, |
| 207 | + m.axis2.gear.gear.phi_b => 0, |
| 208 | + D(m.axis2.gear.gear.phi_b) => 0, |
213 | 209 | ], tspan) |
214 | 210 | sol = solve(prob, Rodas4()) |
215 | 211 | @test SciMLBase.successful_retcode(sol) |
216 | 212 |
|
217 | | -@test sol(0.0, idxs=cm.axis2.motor.emf.phi) == 0 |
218 | | -# @test sol(tspan[2], idxs=cm.axis2.motor.emf.phi) == 0 |
| 213 | +@test sol(0.0, idxs=m.axis2.motor.emf.phi) == 0 |
| 214 | +# @test sol(tspan[2], idxs=m.axis2.motor.emf.phi) == 0 |
219 | 215 |
|
220 | 216 | doplot() && plot(sol, layout=length(unknowns(m))) |
221 | 217 | doplot() && plot(sol, idxs=[ |
222 | | - cm.axis2.gear.gear.phi_a |
223 | | - cm.axis2.gear.gear.phi_b |
224 | | - cm.axis2.gear.gear.flange_b.phi |
225 | | - # cm.axis2.gear.bearingFriction.flange_a.phi |
226 | | - cm.axis2.gear.flange_b.phi |
227 | | - cm.axis2.gear.gear.phi_support |
228 | | - cm.axis2.angleSensor.phi.u |
229 | | - cm.axis2.motor.phi.phi.u |
| 218 | + m.axis2.gear.gear.phi_a |
| 219 | + m.axis2.gear.gear.phi_b |
| 220 | + m.axis2.gear.gear.flange_b.phi |
| 221 | + # m.axis2.gear.bearingFriction.flange_a.phi |
| 222 | + m.axis2.gear.flange_b.phi |
| 223 | + m.axis2.gear.gear.phi_support |
| 224 | + m.axis2.angleSensor.phi.u |
| 225 | + m.axis2.motor.phi.phi.u |
230 | 226 | ], layout=8, size=(800, 800)) |
231 | | -u = cm.axis2.controller.PI.ctr_output.u |
| 227 | +u = m.axis2.controller.PI.ctr_output.u |
232 | 228 | @test abs(sol(prob.tspan[2], idxs=u)) < 1e-6 # test control output is zero at the end of simulation |
233 | 229 |
|
234 | 230 | ## |
|
0 commit comments