@@ -26,16 +26,16 @@ g = -9.807
2626 @test SciMLBase. successful_retcode (sol)
2727
2828 free_falling_displacement = 0.5 * g * tspan[end ]^ 2 # 0.5 * g * t^2
29- @test sol[body. ry ][end ] ≈ free_falling_displacement
30- @test sol[body. rx ][end ] == 0 # no horizontal displacement
29+ @test sol[body. r[ 2 ] ][end ] ≈ free_falling_displacement
30+ @test sol[body. r[ 1 ] ][end ] == 0 # no horizontal displacement
3131 @test all (sol[body. phi] .== 0 )
32- # plot(sol, idxs = [body.rx , body.ry ])
32+ # plot(sol, idxs = [body.r[1] , body.r[2] ])
3333end
3434
3535@testset " Pendulum" begin
3636 # https://github.com/dzimmer/PlanarMechanics/blob/743462f58858a808202be93b708391461cbe2523/PlanarMechanics/Examples/Pendulum.mo
3737 @named ceiling = Planar. Fixed ()
38- @named rod = Planar. FixedTranslation (rx = 1.0 , ry = 0.0 )
38+ @named rod = Planar. FixedTranslation (r = [ 1.0 , 0.0 ] )
3939 @named body = Planar. Body (m = 1 , I = 0.1 )
4040 @named revolute = Planar. Revolute ()
4141
7474
7575 # components
7676 @named body = Planar. Body (; m, I, gy = 0.0 )
77- @named fixed_translation = Planar. FixedTranslation (; rx = 10.0 , ry = 0.0 )
77+ @named fixed_translation = Planar. FixedTranslation (; r = [ 10 , 0 ] )
7878 @named fixed = Planar. Fixed ()
7979 @named revolute = Planar. Revolute ()# constant_ω = ω)
8080
@@ -204,18 +204,18 @@ end
204204 @test SciMLBase. successful_retcode (sol)
205205
206206 # the two bodyies falled the same distance, and so the absolute sensor attached to body1
207- @test sol[abs_pos_sensor. y. u][end ] ≈ sol[body1. ry] [end ] ≈ sol[body2. ry ][end ] ≈
207+ @test sol[abs_pos_sensor. y. u][end ] ≈ sol[body1. r[ 2 ]] [end ] ≈ sol[body2. r[ 2 ] ][end ] ≈
208208 0.5 * g * tspan[end ]^ 2
209209
210210 # sensor1 is attached to body1, so the relative y-position between body1 and the base is
211211 # equal to the absolute y-position of body1
212- @test sol[body1. ry ][end ] ≈ - sol[rel_pos_sensor1. rel_y. u][end ]
212+ @test sol[body1. r[ 2 ] ][end ] ≈ - sol[rel_pos_sensor1. rel_y. u][end ]
213213
214214 # the relative y-position between body1 and body2 is zero
215215 @test sol[rel_pos_sensor2. rel_y. u][end ] == 0
216216
217217 # no displacement in the x-direction
218- @test sol[abs_pos_sensor. x. u][end ] ≈ sol[body1. rx] [end ] ≈ sol[body2. rx ][end ]
218+ @test sol[abs_pos_sensor. x. u][end ] ≈ sol[body1. r[ 1 ]] [end ] ≈ sol[body2. r[ 1 ] ][end ]
219219
220220 # velocity after t seconds v = g * t, so the relative y-velocity between body1 and the base is
221221 # equal to the absolute y-velocity of body1
@@ -238,10 +238,10 @@ end
238238@testset " Measure Demo" begin
239239 # https://github.com/dzimmer/PlanarMechanics/blob/743462f58858a808202be93b708391461cbe2523/PlanarMechanics/Examples/MeasureDemo.mo
240240 @named body = Planar. Body (; m = 1 , I = 0.1 )
241- @named fixed_translation = Planar. FixedTranslation (; rx = 1 , ry = 0 )
241+ @named fixed_translation = Planar. FixedTranslation (;)
242242 @named fixed = Planar. Fixed ()
243243 @named body1 = Planar. Body (; m = 0.4 , I = 0.02 )
244- @named fixed_translation1 = Planar. FixedTranslation (; rx = 0.4 , ry = 0 )
244+ @named fixed_translation1 = Planar. FixedTranslation (; r = [ 0.4 , 0 ] )
245245 @named abs_pos_sensor = Planar. AbsolutePosition (; resolve_in_frame = :world )
246246 @named rel_pos_sensor = Planar. RelativePosition (; resolve_in_frame = :world )
247247 @named revolute1 = Planar. Revolute ()
304304 c_phi = 0 )
305305 @named body = Planar. Body (; I = 0.1 , m = 0.5 , rx = 1 , ry = 1 )
306306 @named fixed = Planar. Fixed ()
307- @named fixed_translation = Planar. FixedTranslation (; rx = - 1 , ry = 0 )
307+ @named fixed_translation = Planar. FixedTranslation (; r = [ - 1 , 0 ] )
308308
309309 connections = [
310310 connect (fixed. frame, fixed_translation. frame_a),
356356 damper,
357357 prismatic
358358 ])
359- sys = structural_simplify ((model)) # Yingbo: fails with JSCompiler
360- unset_vars = setdiff (unknowns (sys), keys (ModelingToolkit. defaults (sys)))
361- prob = ODEProblem (sys, unset_vars .=> 0.0 , (0 , 5 ), [])
362- sol = solve (prob, Rodas5P (), initializealg= BrownFullBasicInit ())
363- @test SciMLBase. successful_retcode (sol)
359+ @test_skip begin
360+ sys = structural_simplify (IRSystem (model)) # Yingbo: fails with JSCompiler
361+ unset_vars = setdiff (unknowns (sys), keys (ModelingToolkit. defaults (sys)))
362+ prob = ODEProblem (sys, unset_vars .=> 0.0 , (0 , 5 ), [])
363+ sol = solve (prob, Rodas5P (), initializealg= BrownFullBasicInit ())
364+ @test SciMLBase. successful_retcode (sol)
365+ end
364366end
0 commit comments