Skip to content
LIBRARY
PlanarMechanics.TestPlanarCableEndJoints.md

PlanarMechanics.TestPlanarCableEndJoints

Planar cable test: World → Cable(end_joints=true, n=3) → Body. Tests the n+1 Revolute-joint topology, hanging under gravity.

Usage

MultibodyComponents.PlanarMechanics.TestPlanarCableEndJoints()

Parameters:

NameDescriptionUnitsDefault value
number_of_links3

Behavior

julia
using MultibodyComponents #hide
using ModelingToolkit #hide
@named sys = MultibodyComponents.PlanarMechanics.TestPlanarCableEndJoints() #hide
let eqs = full_equations(sys); Base.length(eqs) > 25 ? nothing : eqs end #hide
<< @example-block not executed in draft mode >>

Source

dyad
"""
Planar cable test: World → Cable(end_joints=true, n=3) → Body.
Tests the n+1 Revolute-joint topology, hanging under gravity.
"""
test component TestPlanarCableEndJoints
  world = World()
  cable = Cable(n = number_of_links, dir = [1, 0], end_joints = true, l = 1, m = 1, radius = 0.02)
  load = Body(m = 0.5, I = 0.01)
  structural parameter number_of_links::Integer = 3
relations
  connect(world.frame_b, cable.frame_a)
  connect(cable.frame_b, load.frame_a)
metadata {"Dyad": {"tests": {"case1": {"stop": 2}}}}
end
Flattened Source
dyad
"""
Planar cable test: World → Cable(end_joints=true, n=3) → Body.
Tests the n+1 Revolute-joint topology, hanging under gravity.
"""
test component TestPlanarCableEndJoints
  world = World()
  cable = Cable(n = number_of_links, dir = [1, 0], end_joints = true, l = 1, m = 1, radius = 0.02)
  load = Body(m = 0.5, I = 0.01)
  structural parameter number_of_links::Integer = 3
relations
  connect(world.frame_b, cable.frame_a)
  connect(cable.frame_b, load.frame_a)
metadata {"Dyad": {"tests": {"case1": {"stop": 2}}}}
end


Test Cases

julia
using MultibodyComponents
using DyadInterface: TransientAnalysis, rebuild_sol, ODEAlg
using ModelingToolkit: toggle_namespacing, get_initial_conditions, @named
using CSV, DataFrames, Plots

snapshotsdir = joinpath(dirname(dirname(pathof(MultibodyComponents))), "test", "snapshots")
<< @setup-block not executed in draft mode >>

Test Case case1

julia
@named model_case1 = MultibodyComponents.PlanarMechanics.TestPlanarCableEndJoints()
model_case1 = toggle_namespacing(model_case1, false)

model_case1 = toggle_namespacing(model_case1, true)
result_case1 = TransientAnalysis(; model = model_case1, alg = ODEAlg.Auto(), start = 0e+0, stop = 2e+0, abstol=1e-6, reltol=1e-6)
sol_case1 = rebuild_sol(result_case1)
<< @setup-block not executed in draft mode >>