Skip to content

Commit e75cd1d

Browse files
author
Jacob Vaverka
committed
test: lossy gear
Gear efficiency example containing 2 inertias connected by an ideal gear Reference: https://github.com/modelica/ModelicaStandardLibrary/blob/master/Modelica/Mechanics/Rotational/Examples/LossyGearDemo1.mo
1 parent c85424e commit e75cd1d

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/Mechanical/rotational.jl

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,37 @@ end
228228
# Plots.scatter(sol[friction.w], sol[friction.tau], label="")
229229
end
230230

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+
231262
@testset "sensors" begin
232263
@named fixed = Fixed()
233264
@named inertia1 = Inertia(J = 2) # this one is fixed

0 commit comments

Comments
 (0)