ModiaSim / Modia3D.jl

Modeling and Simulation of 3D systems
MIT License
74 stars 8 forks source link

stability issue with chain model #136

Closed johhell closed 9 months ago

johhell commented 9 months ago

Tried to simulate a multiPendulum problem (to compare the results with an MTK implementation from another project). The model + results: D7xproblem.zip

model description

model of 1 segment:

Segment(;obj1, phi_start1=0.0) =  Model(
    temp1   = Object3D(),
    box     = Object3D(feature=Solid(massProperties=MassProperties(; mass=mass_per_seg, Ixx=0.01, Iyy=0.01, Izz=0.02))),
    frame1  = Object3D(parent=:box, translation=:[ len_per_segment, 0.0, 0.0 ]), # nach unten  z-Richtung
    rev1     = RevoluteWithFlange(obj1=obj1, obj2=:temp1, axis=2, phi=Var(init=phi_start1)),
    prism   = Prismatic(      obj1=:frame1, obj2=:temp1, axis=1 , s=Var(init=0.0), v=Var(init=0.0)),
    spring  = SpringDamperPtP(obj1=:frame1, obj2=:temp1, springForceLaw=:springForce, damperForceLaw=:damping),

    damper1 = Damper | Map(d=19.50),
    fixed  = Fixed,
    connect = :[
                (damper1.flange_b, rev1.flange),
                (damper1.flange_a, fixed.flange)     ]      )

results

In my simulation I used stopTime=3.73.

ticket

Longer duration e.g. stopTime>3.73 results in a stability problem of the solver. Maybe the problem has something to do with angle transformation. Below values of m4.rev.phi short before the simulation becomes unstable.

Full model, PNG and GIF can be found in the attached ZIP

julia> T7test.revPhi[4]
374-element Vector{Float64}:
  0.0
 -2.851810285609827e-7
 -1.8911534161141074e-6
  ⋮
 -0.056001209423869214
 -0.057929861281100024
 -0.04127514251024846
 -6.5751491644538245

ticket

johhell commented 9 months ago

Partly solved. My interpretation of the Prismatic joint was not correct. The answer to my problem I found in the test-examples. Modia3D is great!