@@ -26,16 +26,16 @@ g = -9.807
26
26
@test SciMLBase. successful_retcode (sol)
27
27
28
28
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
31
31
@test all (sol[body. phi] .== 0 )
32
- # plot(sol, idxs = [body.rx , body.ry ])
32
+ # plot(sol, idxs = [body.r[1] , body.r[2] ])
33
33
end
34
34
35
35
@testset " Pendulum" begin
36
36
# https://github.com/dzimmer/PlanarMechanics/blob/743462f58858a808202be93b708391461cbe2523/PlanarMechanics/Examples/Pendulum.mo
37
37
@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 ] )
39
39
@named body = Planar. Body (m = 1 , I = 0.1 )
40
40
@named revolute = Planar. Revolute ()
41
41
74
74
75
75
# components
76
76
@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 ] )
78
78
@named fixed = Planar. Fixed ()
79
79
@named revolute = Planar. Revolute ()# constant_ω = ω)
80
80
@@ -204,18 +204,18 @@ end
204
204
@test SciMLBase. successful_retcode (sol)
205
205
206
206
# 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 ] ≈
208
208
0.5 * g * tspan[end ]^ 2
209
209
210
210
# sensor1 is attached to body1, so the relative y-position between body1 and the base is
211
211
# 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 ]
213
213
214
214
# the relative y-position between body1 and body2 is zero
215
215
@test sol[rel_pos_sensor2. rel_y. u][end ] == 0
216
216
217
217
# 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 ]
219
219
220
220
# velocity after t seconds v = g * t, so the relative y-velocity between body1 and the base is
221
221
# equal to the absolute y-velocity of body1
@@ -238,10 +238,10 @@ end
238
238
@testset " Measure Demo" begin
239
239
# https://github.com/dzimmer/PlanarMechanics/blob/743462f58858a808202be93b708391461cbe2523/PlanarMechanics/Examples/MeasureDemo.mo
240
240
@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 (;)
242
242
@named fixed = Planar. Fixed ()
243
243
@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 ] )
245
245
@named abs_pos_sensor = Planar. AbsolutePosition (; resolve_in_frame = :world )
246
246
@named rel_pos_sensor = Planar. RelativePosition (; resolve_in_frame = :world )
247
247
@named revolute1 = Planar. Revolute ()
304
304
c_phi = 0 )
305
305
@named body = Planar. Body (; I = 0.1 , m = 0.5 , rx = 1 , ry = 1 )
306
306
@named fixed = Planar. Fixed ()
307
- @named fixed_translation = Planar. FixedTranslation (; rx = - 1 , ry = 0 )
307
+ @named fixed_translation = Planar. FixedTranslation (; r = [ - 1 , 0 ] )
308
308
309
309
connections = [
310
310
connect (fixed. frame, fixed_translation. frame_a),
356
356
damper,
357
357
prismatic
358
358
])
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
364
366
end
0 commit comments