Skip to content
LIBRARY
PlanarMechanics.examples.SlipBasedWheelTest.md

PlanarMechanics.examples.SlipBasedWheelTest

A slip-based wheel.

Usage

MultibodyComponents.PlanarMechanics.examples.SlipBasedWheelTest()

Behavior

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

Source

dyad
"A slip-based wheel."
example component SlipBasedWheelTest
  slipBasedWheelJoint = MultibodyComponents.PlanarMechanics.SlipBasedWheelJoint(radius = 0.3, r = [1, 0], mu_A = 0.8, mu_S = 0.4, N = 100, sAdhesion = 0.04, sSlide = 0.12, vAdhesion_min = 0.05, vSlide_min = 0.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 940, "y1": 590, "x2": 740, "y2": 790, "rot": 90}
      },
      "tags": []
    }
  }
  prismatic = MultibodyComponents.PlanarMechanics.Prismatic(r = [0, 1]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 550, "y1": 50, "x2": 750, "y2": 250, "rot": 0}
      },
      "tags": []
    }
  }
  revolute = MultibodyComponents.PlanarMechanics.Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 50, "x2": 490, "y2": 250, "rot": 0}
      },
      "tags": []
    }
  }
  world = MultibodyComponents.PlanarMechanics.World(g = 0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 50, "x2": 220, "y2": 250, "rot": 0}
      },
      "tags": []
    }
  }
  body = MultibodyComponents.PlanarMechanics.Body(m = 10, I = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 810, "y1": 50, "x2": 1010, "y2": 250, "rot": 0}
      },
      "tags": []
    }
  }
  inertia = RotationalComponents.Components.Inertia(J = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 550, "y1": 360, "x2": 750, "y2": 560, "rot": 0}
      },
      "tags": []
    }
  }
  engineTorque = RotationalComponents.Sources.TorqueSource() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 360, "x2": 490, "y2": 560, "rot": 0}
      },
      "tags": []
    }
  }
  fixed = RotationalComponents.Components.Fixed()
  constant_torque = BlockComponents.Sources.Constant(k = 2) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 360, "x2": 220, "y2": 560, "rot": 0}
      },
      "tags": []
    }
  }
  constant_load = BlockComponents.Sources.Constant(k = 0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1430, "y1": 800, "x2": 1230, "y2": 1000, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial prismatic.s = 1.0
  initial prismatic.v = 0.0
  initial body.phi = 0.0
  initial body.w = 0.0
  initial inertia.phi = 0.0
  initial inertia.w = 1e-10
  connect(prismatic.frame_a, revolute.frame_b) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(revolute.frame_a, world.frame_b) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(constant_torque.y, engineTorque.tau) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(engineTorque.spline, inertia.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(body.frame_a, prismatic.frame_b, slipBasedWheelJoint.frame_a) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [{"x": 952, "y": 400}, {"x": 780, "y": 400}], "E": -1}
      ],
      "junctions": [{"x": 780, "y": 150}],
      "renderStyle": "standard"
    }
  }
  connect(constant_load.y, slipBasedWheelJoint.dynamicLoad) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 1120, "y": 900}, {"x": 1120, "y": 800}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(engineTorque.support, fixed.spline)
  connect(inertia.spline_b, slipBasedWheelJoint.flange_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 840, "y": 460}], "E": 2}],
      "renderStyle": "standard"
    }
  }
metadata {"Dyad": {"tests": {"case1": {"stop": 20}}}}
end
Flattened Source
dyad
"A slip-based wheel."
example component SlipBasedWheelTest
  slipBasedWheelJoint = MultibodyComponents.PlanarMechanics.SlipBasedWheelJoint(radius = 0.3, r = [1, 0], mu_A = 0.8, mu_S = 0.4, N = 100, sAdhesion = 0.04, sSlide = 0.12, vAdhesion_min = 0.05, vSlide_min = 0.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 940, "y1": 590, "x2": 740, "y2": 790, "rot": 90}
      },
      "tags": []
    }
  }
  prismatic = MultibodyComponents.PlanarMechanics.Prismatic(r = [0, 1]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 550, "y1": 50, "x2": 750, "y2": 250, "rot": 0}
      },
      "tags": []
    }
  }
  revolute = MultibodyComponents.PlanarMechanics.Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 50, "x2": 490, "y2": 250, "rot": 0}
      },
      "tags": []
    }
  }
  world = MultibodyComponents.PlanarMechanics.World(g = 0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 50, "x2": 220, "y2": 250, "rot": 0}
      },
      "tags": []
    }
  }
  body = MultibodyComponents.PlanarMechanics.Body(m = 10, I = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 810, "y1": 50, "x2": 1010, "y2": 250, "rot": 0}
      },
      "tags": []
    }
  }
  inertia = RotationalComponents.Components.Inertia(J = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 550, "y1": 360, "x2": 750, "y2": 560, "rot": 0}
      },
      "tags": []
    }
  }
  engineTorque = RotationalComponents.Sources.TorqueSource() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 360, "x2": 490, "y2": 560, "rot": 0}
      },
      "tags": []
    }
  }
  fixed = RotationalComponents.Components.Fixed()
  constant_torque = BlockComponents.Sources.Constant(k = 2) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 360, "x2": 220, "y2": 560, "rot": 0}
      },
      "tags": []
    }
  }
  constant_load = BlockComponents.Sources.Constant(k = 0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1430, "y1": 800, "x2": 1230, "y2": 1000, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial prismatic.s = 1.0
  initial prismatic.v = 0.0
  initial body.phi = 0.0
  initial body.w = 0.0
  initial inertia.phi = 0.0
  initial inertia.w = 1e-10
  connect(prismatic.frame_a, revolute.frame_b) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(revolute.frame_a, world.frame_b) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(constant_torque.y, engineTorque.tau) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(engineTorque.spline, inertia.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(body.frame_a, prismatic.frame_b, slipBasedWheelJoint.frame_a) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [{"x": 952, "y": 400}, {"x": 780, "y": 400}], "E": -1}
      ],
      "junctions": [{"x": 780, "y": 150}],
      "renderStyle": "standard"
    }
  }
  connect(constant_load.y, slipBasedWheelJoint.dynamicLoad) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 1120, "y": 900}, {"x": 1120, "y": 800}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(engineTorque.support, fixed.spline)
  connect(inertia.spline_b, slipBasedWheelJoint.flange_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 840, "y": 460}], "E": 2}],
      "renderStyle": "standard"
    }
  }
metadata {"Dyad": {"tests": {"case1": {"stop": 20}}}}
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.examples.SlipBasedWheelTest()
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+1, abstol=1e-6, reltol=1e-6)
sol_case1 = rebuild_sol(result_case1)
<< @setup-block not executed in draft mode >>
  • Examples

  • Experiments

  • Analyses