|
228 | 228 | # Plots.scatter(sol[friction.w], sol[friction.tau], label="")
|
229 | 229 | end
|
230 | 230 |
|
| 231 | +@testset "lossy gear" begin |
| 232 | + @mtkmodel LossyGear begin |
| 233 | + @components begin |
| 234 | + drive = Blocks.Sine(frequency=1, amplitude=10) |
| 235 | + load = Ramp(duration=2, height=5, offset=-10) |
| 236 | + torque1 = Torque(use_support=true) |
| 237 | + torque2 = Torque(use_support=true) |
| 238 | + inertia1 = Inertia(J=1) |
| 239 | + inertia2 = Inertia(J=1.5) |
| 240 | + gear = IdealGear(ratio=2, use_support=true) |
| 241 | + fixed = Fixed() |
| 242 | + end |
| 243 | + @equations begin |
| 244 | + connect(drive.output, torque1.tau) |
| 245 | + connect(torque1.flange, inertia1.flange_a) |
| 246 | + connect(inertia1.flange_b, gear.flange_a) |
| 247 | + connect(gear.flange_b, inertia2.flange_a) |
| 248 | + connect(inertia2.flange_b, torque2.flange) |
| 249 | + connect(torque2.tau, load.output) |
| 250 | + connect(torque1.support, fixed.flange) |
| 251 | + connect(gear.support, fixed.flange) |
| 252 | + connect(torque2.support, fixed.flange) |
| 253 | + end |
| 254 | + end |
| 255 | + @mtkbuild model = LossyGear() |
| 256 | + tspan = (0.0, 10.0) |
| 257 | + prob = ODEProblem(model, ModelingToolkit.missing_variable_defaults(model), tspan) |
| 258 | + sol = solve(prob, Rosenbrock23()); |
| 259 | + @test ModelingToolkit.SciMLBase.successful_retcode(sol) |
| 260 | +end |
| 261 | + |
231 | 262 | @testset "sensors" begin
|
232 | 263 | @named fixed = Fixed()
|
233 | 264 | @named inertia1 = Inertia(J = 2) # this one is fixed
|
|
0 commit comments