Skip to content
LIBRARY
PlanarMechanics.OneDOFRollingWheelJointTest.md

PlanarMechanics.OneDOFRollingWheelJointTest

Test for OneDOFRollingWheelJoint: a body connected to an ideal rolling wheel.

A body (m=0.1, I=0.01) with initial angular velocity w=1 rad/s on a wheel of radius 1. Gravity pulls the body down, constraining it on the ground. Translates the "OneDOFRollingWheelJoint" test from test_PlanarMechanics.jl.

Usage

MultibodyComponents.PlanarMechanics.OneDOFRollingWheelJointTest()

Behavior

julia
using MultibodyComponents #hide
using ModelingToolkit #hide
@named sys = MultibodyComponents.PlanarMechanics.OneDOFRollingWheelJointTest() #hide
full_equations(sys) #hide
<< @example-block not executed in draft mode >>

Source

dyad
"""
Test for OneDOFRollingWheelJoint: a body connected to an ideal rolling wheel.

A body (m=0.1, I=0.01) with initial angular velocity w=1 rad/s on a wheel of radius 1.
Gravity pulls the body down, constraining it on the ground.
Translates the "OneDOFRollingWheelJoint" test from test_PlanarMechanics.jl.
"""
test component OneDOFRollingWheelJointTest
  world = World(g = 9.82) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 10, "y1": 880, "x2": 110, "y2": 980, "rot": 0}
      },
      "tags": []
    }
  }
  body = Body(m = 0.1, I = 0.01) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 400, "y1": 240, "x2": 600, "y2": 440, "rot": 270}
      },
      "tags": []
    }
  }
  wheelJoint = OneDOFRollingWheelJoint(radius = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 400, "y1": 570, "x2": 600, "y2": 770, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial body.phi = 0.0
  initial body.w = 1.0
  connect(wheelJoint.frame_a, body.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {"Dyad": {"tests": {"case1": {"stop": 10}}}}
end
Flattened Source
dyad
"""
Test for OneDOFRollingWheelJoint: a body connected to an ideal rolling wheel.

A body (m=0.1, I=0.01) with initial angular velocity w=1 rad/s on a wheel of radius 1.
Gravity pulls the body down, constraining it on the ground.
Translates the "OneDOFRollingWheelJoint" test from test_PlanarMechanics.jl.
"""
test component OneDOFRollingWheelJointTest
  world = World(g = 9.82) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 10, "y1": 880, "x2": 110, "y2": 980, "rot": 0}
      },
      "tags": []
    }
  }
  body = Body(m = 0.1, I = 0.01) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 400, "y1": 240, "x2": 600, "y2": 440, "rot": 270}
      },
      "tags": []
    }
  }
  wheelJoint = OneDOFRollingWheelJoint(radius = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 400, "y1": 570, "x2": 600, "y2": 770, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial body.phi = 0.0
  initial body.w = 1.0
  connect(wheelJoint.frame_a, body.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {"Dyad": {"tests": {"case1": {"stop": 10}}}}
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.OneDOFRollingWheelJointTest()
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 = 1e+1, abstol=1e-6, reltol=1e-6)
sol_case1 = rebuild_sol(result_case1)
<< @setup-block not executed in draft mode >>