Skip to content
LIBRARY
PlanarMechanics.examples.TwoTrackModelTest.md

PlanarMechanics.examples.TwoTrackModelTest

A double track model of a car.

Usage

MultibodyComponents.PlanarMechanics.examples.TwoTrackModelTest()

Behavior

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

Source

dyad
"A double track model of a car."
example component TwoTrackModelTest
  world = MultibodyComponents.PlanarMechanics.World(g = 0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  body = MultibodyComponents.PlanarMechanics.Body(m = 100, I = 1, render = false) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 190, "y1": 110, "x2": 290, "y2": 210, "rot": 270}
      },
      "tags": []
    }
  }
  body1 = MultibodyComponents.PlanarMechanics.Body(m = 300, I = 0.1, render = false) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 680, "x2": 350, "y2": 780, "rot": 0}
      },
      "tags": []
    }
  }
  body2 = MultibodyComponents.PlanarMechanics.Body(m = 100, I = 1, render = false) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 840, "y1": 110, "x2": 740, "y2": 210, "rot": 90}
      },
      "tags": []
    }
  }
  wheelJoint1 = MultibodyComponents.PlanarMechanics.SlipBasedWheelJoint(radius = 0.25, r = [0, 1], mu_A = 1, mu_S = 0.7, N = 1000, sAdhesion = 0.04, sSlide = 0.12, vAdhesion_min = 0.05, vSlide_min = 0.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 250, "x2": 190, "y2": 350, "rot": 0}
      },
      "tags": []
    }
  }
  wheelJoint2 = MultibodyComponents.PlanarMechanics.SlipBasedWheelJoint(radius = 0.25, r = [0, 1], mu_A = 1, mu_S = 0.7, N = 1500, sAdhesion = 0.04, sSlide = 0.12, vAdhesion_min = 0.05, vSlide_min = 0.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 270, "y1": 820, "x2": 170, "y2": 920, "rot": 0}
      },
      "tags": []
    }
  }
  wheelJoint3 = MultibodyComponents.PlanarMechanics.SlipBasedWheelJoint(radius = 0.25, r = [0, 1], mu_A = 1, mu_S = 0.7, N = 1500, sAdhesion = 0.04, sSlide = 0.12, vAdhesion_min = 0.05, vSlide_min = 0.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 750, "y1": 820, "x2": 850, "y2": 920, "rot": 0}
      },
      "tags": []
    }
  }
  wheelJoint4 = MultibodyComponents.PlanarMechanics.SlipBasedWheelJoint(radius = 0.25, r = [0, 1], mu_A = 1, mu_S = 0.7, N = 1000, sAdhesion = 0.04, sSlide = 0.12, vAdhesion_min = 0.05, vSlide_min = 0.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 740, "y1": 250, "x2": 840, "y2": 350, "rot": 0}
      },
      "tags": []
    }
  }
  differentialGear = MultibodyComponents.PlanarMechanics.DifferentialGear() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 890, "x2": 550, "y2": 990, "rot": 0}
      },
      "tags": []
    }
  }
  pulse = BlockComponents.Sources.Square(frequency = 0.5, offset = 0, start_time = 1, amplitude = -2) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 650, "y1": 90, "x2": 550, "y2": 190, "rot": 0}
      },
      "tags": []
    }
  }
  torque = RotationalComponents.Sources.TorqueSource() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 460, "y1": 260, "x2": 560, "y2": 360, "rot": 90}
      },
      "tags": []
    }
  }
  fixed = RotationalComponents.Components.Fixed() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 360, "y1": 1180, "x2": 460, "y2": 1280, "rot": 0}
      },
      "tags": []
    }
  }
  constantTorque = BlockComponents.Sources.Constant(k = 25) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 220, "y1": 1030, "x2": 320, "y2": 1130, "rot": 0}
      },
      "tags": []
    }
  }
  engineTorque = RotationalComponents.Sources.TorqueSource() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 360, "y1": 1030, "x2": 460, "y2": 1130, "rot": 0}
      },
      "tags": []
    }
  }
  inertia = RotationalComponents.Components.Inertia(J = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 130, "y1": 250, "x2": 30, "y2": 350, "rot": 0}
      },
      "tags": []
    }
  }
  inertia1 = RotationalComponents.Components.Inertia(J = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 130, "y1": 820, "x2": 30, "y2": 920, "rot": 0}
      },
      "tags": []
    }
  }
  inertia2 = RotationalComponents.Components.Inertia(J = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 890, "y1": 820, "x2": 990, "y2": 920, "rot": 0}
      },
      "tags": []
    }
  }
  inertia3 = RotationalComponents.Components.Inertia(J = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 890, "y1": 250, "x2": 990, "y2": 350, "rot": 0}
      },
      "tags": []
    }
  }
  fixedTranslation1 = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [0, 2]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 620, "x2": 550, "y2": 720, "rot": 270}
      },
      "tags": []
    }
  }
  fixedTranslation2 = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [0.75, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 360, "y1": 760, "x2": 460, "y2": 860, "rot": 0}
      },
      "tags": []
    }
  }
  fixedTranslation3 = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [-0.75, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 640, "y1": 760, "x2": 540, "y2": 860, "rot": 0}
      },
      "tags": []
    }
  }
  fixedTranslation4 = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [0.75, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 400, "y1": 480, "x2": 500, "y2": 580, "rot": 0}
      },
      "tags": []
    }
  }
  fixedTranslation5 = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [-0.75, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 610, "y1": 480, "x2": 510, "y2": 580, "rot": 0}
      },
      "tags": []
    }
  }
  leftTrail = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [0, -0.05]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 440, "y1": 250, "x2": 340, "y2": 350, "rot": 90}
      },
      "tags": []
    }
  }
  rightTrail = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [0, 0.05]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 690, "y1": 250, "x2": 590, "y2": 350, "rot": 270}
      },
      "tags": []
    }
  }
  revolute = MultibodyComponents.PlanarMechanics.Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 590, "y1": 390, "x2": 690, "y2": 490, "rot": 90}
      },
      "tags": []
    }
  }
  revolute2 = MultibodyComponents.PlanarMechanics.Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 440, "y1": 390, "x2": 340, "y2": 490, "rot": 270}
      },
      "tags": []
    }
  }
  dynamic_load = BlockComponents.Sources.Constant(k = 0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 120, "y1": 520, "x2": 220, "y2": 620, "rot": 0}
      },
      "tags": []
    }
  }
  fixed1 = RotationalComponents.Components.Fixed() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 380, "y1": 190, "x2": 480, "y2": 90, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial body1.r = [1.0, 1.0]
  initial body1.v = [0.0, 0.0]
  initial body1.phi = 0.0
  initial body1.w = 0.0
  initial inertia.phi = 0.0
  initial inertia.w = 0.0
  initial inertia1.phi = 0.0
  initial inertia1.w = 0.0
  initial inertia2.phi = 0.0
  initial inertia2.w = 0.0
  initial inertia3.phi = 0.0
  initial inertia3.w = 0.0
  initial revolute2.phi = -0.43633231299858
  initial revolute2.w = 0.0
  connect(inertia.spline_a, wheelJoint1.flange_a) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
  connect(inertia3.spline_a, wheelJoint4.flange_a) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
  connect(body2.frame_a, wheelJoint4.frame_a, rightTrail.frame_a) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [{"x": 640, "y": 230}], "E": -1}
      ],
      "junctions": [{"x": 790, "y": 230}],
      "renderStyle": "standard"
    }
  }
  connect(body.frame_a, wheelJoint1.frame_a, leftTrail.frame_b) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [{"x": 390, "y": 230}], "E": -1}
      ],
      "junctions": [{"x": 240, "y": 230}],
      "renderStyle": "standard"
    }
  }
  connect(pulse.y, torque.tau) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 510, "y": 140}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(rightTrail.frame_b, revolute.frame_a) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
  connect(revolute2.flange_a, revolute.flange_a, torque.spline) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [], "E": -1}
      ],
      "junctions": [{"x": 510, "y": 440}],
      "renderStyle": "standard"
    }
  }
  connect(fixedTranslation5.frame_a, revolute.frame_b) {
    "Dyad": {
      "renderStyle": "standard",
      "edges": [{"S": 1, "M": [{"x": 640, "y": 530}], "E": 2}]
    }
  }
  connect(fixedTranslation5.frame_b, fixedTranslation4.frame_b) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
  connect(fixedTranslation1.frame_b, fixedTranslation4.frame_b) {
    "Dyad": {
      "renderStyle": "standard",
      "edges": [{"S": 1, "M": [{"x": 500, "y": 530}], "E": 2}]
    }
  }
  connect(wheelJoint3.frame_a, fixedTranslation3.frame_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 800, "y": 810}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(wheelJoint2.frame_a, fixedTranslation2.frame_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 220, "y": 810}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(wheelJoint3.flange_a, inertia2.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(wheelJoint2.flange_a, inertia1.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(fixedTranslation2.frame_b, fixedTranslation3.frame_b, fixedTranslation1.frame_a, body1.frame_a) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [], "E": -2},
        {"S": -2, "M": [], "E": -1},
        {"S": 4, "M": [], "E": -2}
      ],
      "junctions": [{"x": 500, "y": 810}, {"x": 500, "y": 730}],
      "renderStyle": "standard"
    }
  }
  connect(differentialGear.flange_left, wheelJoint2.flange_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 170, "y": 940}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(differentialGear.flange_right, wheelJoint3.flange_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 850, "y": 940}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(engineTorque.spline, differentialGear.flange_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 500, "y": 1080}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(constantTorque.y, engineTorque.tau) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(dynamic_load.y, wheelJoint1.dynamicLoad, wheelJoint2.dynamicLoad, wheelJoint4.dynamicLoad, wheelJoint3.dynamicLoad) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [{"x": 310, "y": 300}], "E": 2},
        {"S": 3, "M": [{"x": 310, "y": 870}], "E": -1},
        {"S": 4, "M": [{"x": 710, "y": 300}], "E": -2},
        {"S": -2, "M": [], "E": -1},
        {"S": 5, "M": [{"x": 710, "y": 870}], "E": -2}
      ],
      "junctions": [{"x": 310, "y": 570}, {"x": 710, "y": 570}],
      "renderStyle": "standard"
    }
  }
  connect(fixed1.spline, torque.support) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 430, "y": 310}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(fixed.spline, engineTorque.support) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(revolute2.frame_b, fixedTranslation4.frame_a) {
    "Dyad": {
      "renderStyle": "standard",
      "edges": [{"S": 1, "M": [{"x": 390, "y": 530}], "E": 2}]
    }
  }
  connect(leftTrail.frame_a, revolute2.frame_a) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
metadata {"Dyad": {"tests": {"case1": {"stop": 20}}}}
end
Flattened Source
dyad
"A double track model of a car."
example component TwoTrackModelTest
  world = MultibodyComponents.PlanarMechanics.World(g = 0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  body = MultibodyComponents.PlanarMechanics.Body(m = 100, I = 1, render = false) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 190, "y1": 110, "x2": 290, "y2": 210, "rot": 270}
      },
      "tags": []
    }
  }
  body1 = MultibodyComponents.PlanarMechanics.Body(m = 300, I = 0.1, render = false) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 680, "x2": 350, "y2": 780, "rot": 0}
      },
      "tags": []
    }
  }
  body2 = MultibodyComponents.PlanarMechanics.Body(m = 100, I = 1, render = false) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 840, "y1": 110, "x2": 740, "y2": 210, "rot": 90}
      },
      "tags": []
    }
  }
  wheelJoint1 = MultibodyComponents.PlanarMechanics.SlipBasedWheelJoint(radius = 0.25, r = [0, 1], mu_A = 1, mu_S = 0.7, N = 1000, sAdhesion = 0.04, sSlide = 0.12, vAdhesion_min = 0.05, vSlide_min = 0.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 250, "x2": 190, "y2": 350, "rot": 0}
      },
      "tags": []
    }
  }
  wheelJoint2 = MultibodyComponents.PlanarMechanics.SlipBasedWheelJoint(radius = 0.25, r = [0, 1], mu_A = 1, mu_S = 0.7, N = 1500, sAdhesion = 0.04, sSlide = 0.12, vAdhesion_min = 0.05, vSlide_min = 0.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 270, "y1": 820, "x2": 170, "y2": 920, "rot": 0}
      },
      "tags": []
    }
  }
  wheelJoint3 = MultibodyComponents.PlanarMechanics.SlipBasedWheelJoint(radius = 0.25, r = [0, 1], mu_A = 1, mu_S = 0.7, N = 1500, sAdhesion = 0.04, sSlide = 0.12, vAdhesion_min = 0.05, vSlide_min = 0.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 750, "y1": 820, "x2": 850, "y2": 920, "rot": 0}
      },
      "tags": []
    }
  }
  wheelJoint4 = MultibodyComponents.PlanarMechanics.SlipBasedWheelJoint(radius = 0.25, r = [0, 1], mu_A = 1, mu_S = 0.7, N = 1000, sAdhesion = 0.04, sSlide = 0.12, vAdhesion_min = 0.05, vSlide_min = 0.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 740, "y1": 250, "x2": 840, "y2": 350, "rot": 0}
      },
      "tags": []
    }
  }
  differentialGear = MultibodyComponents.PlanarMechanics.DifferentialGear() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 890, "x2": 550, "y2": 990, "rot": 0}
      },
      "tags": []
    }
  }
  pulse = BlockComponents.Sources.Square(frequency = 0.5, offset = 0, start_time = 1, amplitude = -2) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 650, "y1": 90, "x2": 550, "y2": 190, "rot": 0}
      },
      "tags": []
    }
  }
  torque = RotationalComponents.Sources.TorqueSource() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 460, "y1": 260, "x2": 560, "y2": 360, "rot": 90}
      },
      "tags": []
    }
  }
  fixed = RotationalComponents.Components.Fixed() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 360, "y1": 1180, "x2": 460, "y2": 1280, "rot": 0}
      },
      "tags": []
    }
  }
  constantTorque = BlockComponents.Sources.Constant(k = 25) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 220, "y1": 1030, "x2": 320, "y2": 1130, "rot": 0}
      },
      "tags": []
    }
  }
  engineTorque = RotationalComponents.Sources.TorqueSource() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 360, "y1": 1030, "x2": 460, "y2": 1130, "rot": 0}
      },
      "tags": []
    }
  }
  inertia = RotationalComponents.Components.Inertia(J = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 130, "y1": 250, "x2": 30, "y2": 350, "rot": 0}
      },
      "tags": []
    }
  }
  inertia1 = RotationalComponents.Components.Inertia(J = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 130, "y1": 820, "x2": 30, "y2": 920, "rot": 0}
      },
      "tags": []
    }
  }
  inertia2 = RotationalComponents.Components.Inertia(J = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 890, "y1": 820, "x2": 990, "y2": 920, "rot": 0}
      },
      "tags": []
    }
  }
  inertia3 = RotationalComponents.Components.Inertia(J = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 890, "y1": 250, "x2": 990, "y2": 350, "rot": 0}
      },
      "tags": []
    }
  }
  fixedTranslation1 = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [0, 2]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 620, "x2": 550, "y2": 720, "rot": 270}
      },
      "tags": []
    }
  }
  fixedTranslation2 = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [0.75, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 360, "y1": 760, "x2": 460, "y2": 860, "rot": 0}
      },
      "tags": []
    }
  }
  fixedTranslation3 = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [-0.75, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 640, "y1": 760, "x2": 540, "y2": 860, "rot": 0}
      },
      "tags": []
    }
  }
  fixedTranslation4 = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [0.75, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 400, "y1": 480, "x2": 500, "y2": 580, "rot": 0}
      },
      "tags": []
    }
  }
  fixedTranslation5 = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [-0.75, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 610, "y1": 480, "x2": 510, "y2": 580, "rot": 0}
      },
      "tags": []
    }
  }
  leftTrail = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [0, -0.05]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 440, "y1": 250, "x2": 340, "y2": 350, "rot": 90}
      },
      "tags": []
    }
  }
  rightTrail = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [0, 0.05]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 690, "y1": 250, "x2": 590, "y2": 350, "rot": 270}
      },
      "tags": []
    }
  }
  revolute = MultibodyComponents.PlanarMechanics.Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 590, "y1": 390, "x2": 690, "y2": 490, "rot": 90}
      },
      "tags": []
    }
  }
  revolute2 = MultibodyComponents.PlanarMechanics.Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 440, "y1": 390, "x2": 340, "y2": 490, "rot": 270}
      },
      "tags": []
    }
  }
  dynamic_load = BlockComponents.Sources.Constant(k = 0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 120, "y1": 520, "x2": 220, "y2": 620, "rot": 0}
      },
      "tags": []
    }
  }
  fixed1 = RotationalComponents.Components.Fixed() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 380, "y1": 190, "x2": 480, "y2": 90, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial body1.r = [1.0, 1.0]
  initial body1.v = [0.0, 0.0]
  initial body1.phi = 0.0
  initial body1.w = 0.0
  initial inertia.phi = 0.0
  initial inertia.w = 0.0
  initial inertia1.phi = 0.0
  initial inertia1.w = 0.0
  initial inertia2.phi = 0.0
  initial inertia2.w = 0.0
  initial inertia3.phi = 0.0
  initial inertia3.w = 0.0
  initial revolute2.phi = -0.43633231299858
  initial revolute2.w = 0.0
  connect(inertia.spline_a, wheelJoint1.flange_a) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
  connect(inertia3.spline_a, wheelJoint4.flange_a) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
  connect(body2.frame_a, wheelJoint4.frame_a, rightTrail.frame_a) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [{"x": 640, "y": 230}], "E": -1}
      ],
      "junctions": [{"x": 790, "y": 230}],
      "renderStyle": "standard"
    }
  }
  connect(body.frame_a, wheelJoint1.frame_a, leftTrail.frame_b) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [{"x": 390, "y": 230}], "E": -1}
      ],
      "junctions": [{"x": 240, "y": 230}],
      "renderStyle": "standard"
    }
  }
  connect(pulse.y, torque.tau) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 510, "y": 140}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(rightTrail.frame_b, revolute.frame_a) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
  connect(revolute2.flange_a, revolute.flange_a, torque.spline) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [], "E": -1}
      ],
      "junctions": [{"x": 510, "y": 440}],
      "renderStyle": "standard"
    }
  }
  connect(fixedTranslation5.frame_a, revolute.frame_b) {
    "Dyad": {
      "renderStyle": "standard",
      "edges": [{"S": 1, "M": [{"x": 640, "y": 530}], "E": 2}]
    }
  }
  connect(fixedTranslation5.frame_b, fixedTranslation4.frame_b) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
  connect(fixedTranslation1.frame_b, fixedTranslation4.frame_b) {
    "Dyad": {
      "renderStyle": "standard",
      "edges": [{"S": 1, "M": [{"x": 500, "y": 530}], "E": 2}]
    }
  }
  connect(wheelJoint3.frame_a, fixedTranslation3.frame_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 800, "y": 810}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(wheelJoint2.frame_a, fixedTranslation2.frame_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 220, "y": 810}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(wheelJoint3.flange_a, inertia2.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(wheelJoint2.flange_a, inertia1.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(fixedTranslation2.frame_b, fixedTranslation3.frame_b, fixedTranslation1.frame_a, body1.frame_a) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [], "E": -2},
        {"S": -2, "M": [], "E": -1},
        {"S": 4, "M": [], "E": -2}
      ],
      "junctions": [{"x": 500, "y": 810}, {"x": 500, "y": 730}],
      "renderStyle": "standard"
    }
  }
  connect(differentialGear.flange_left, wheelJoint2.flange_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 170, "y": 940}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(differentialGear.flange_right, wheelJoint3.flange_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 850, "y": 940}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(engineTorque.spline, differentialGear.flange_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 500, "y": 1080}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(constantTorque.y, engineTorque.tau) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(dynamic_load.y, wheelJoint1.dynamicLoad, wheelJoint2.dynamicLoad, wheelJoint4.dynamicLoad, wheelJoint3.dynamicLoad) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [{"x": 310, "y": 300}], "E": 2},
        {"S": 3, "M": [{"x": 310, "y": 870}], "E": -1},
        {"S": 4, "M": [{"x": 710, "y": 300}], "E": -2},
        {"S": -2, "M": [], "E": -1},
        {"S": 5, "M": [{"x": 710, "y": 870}], "E": -2}
      ],
      "junctions": [{"x": 310, "y": 570}, {"x": 710, "y": 570}],
      "renderStyle": "standard"
    }
  }
  connect(fixed1.spline, torque.support) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 430, "y": 310}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(fixed.spline, engineTorque.support) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(revolute2.frame_b, fixedTranslation4.frame_a) {
    "Dyad": {
      "renderStyle": "standard",
      "edges": [{"S": 1, "M": [{"x": 390, "y": 530}], "E": 2}]
    }
  }
  connect(leftTrail.frame_a, revolute2.frame_a) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
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.TwoTrackModelTest()
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