Skip to content
LIBRARY
examples.FourBar.md

examples.FourBar

Planar four-bar linkage closed with a RevolutePlanarLoopConstraint.

Five revolute joints form the loop; j4 is replaced with a RevolutePlanarLoopConstraint because the cut forces along the parallel joint axes cannot be uniquely computed. Two of the revolute joints are damped through rotational dampers on their axis splines. The first joint gets a small non-zero initial angle to start the motion.

Usage

MultibodyComponents.examples.FourBar()

Behavior

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

Source

dyad
"""
Planar four-bar linkage closed with a `RevolutePlanarLoopConstraint`.

Five revolute joints form the loop; `j4` is replaced with a
`RevolutePlanarLoopConstraint` because the cut forces along the parallel
joint axes cannot be uniquely computed. Two of the revolute joints are
damped through rotational dampers on their axis splines. The first joint
gets a small non-zero initial angle to start the motion.
"""
example component FourBar
  world = MultibodyComponents.World(default_body_diameter = 0.06, axis_radius = 0.01) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 660, "y1": 190, "x2": 760, "y2": 290, "rot": 0}
      },
      "tags": []
    }
  }
  j1 = MultibodyComponents.Revolute(phi(initial = 0.1)) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 810, "y1": 190, "x2": 910, "y2": 290, "rot": 0}
      },
      "tags": []
    }
  }
  j2 = MultibodyComponents.Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1080, "y1": 190, "x2": 1180, "y2": 290, "rot": 0}
      },
      "tags": []
    }
  }
  j3 = MultibodyComponents.Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 35, "y1": 90, "x2": 135, "y2": 190, "rot": 0}
      },
      "tags": []
    }
  }
  j4 = MultibodyComponents.RevolutePlanarLoopConstraint() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 285, "y1": 90, "x2": 385, "y2": 190, "rot": 0}
      },
      "tags": []
    }
  }
  j5 = MultibodyComponents.Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 535, "y1": 90, "x2": 635, "y2": 190, "rot": 0}
      },
      "tags": []
    }
  }
  b1 = MultibodyComponents.BodyShape(m = 1, r = [1.5, 0, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 940, "y1": 190, "x2": 1040, "y2": 290, "rot": 0}
      },
      "tags": []
    }
  }
  b2 = MultibodyComponents.BodyShape(m = 1, r = [0, 1.5, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1210, "y1": 190, "x2": 1310, "y2": 290, "rot": 0}
      },
      "tags": []
    }
  }
  b3 = MultibodyComponents.BodyShape(m = 1, r = [-1.5, 0, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 160, "y1": 90, "x2": 260, "y2": 190, "rot": 0}
      },
      "tags": []
    }
  }
  b4 = MultibodyComponents.BodyShape(m = 1, r = [0, -1.5, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 410, "y1": 90, "x2": 510, "y2": 190, "rot": 0}
      },
      "tags": []
    }
  }
  damper1 = RotationalComponents.Components.Damper(d = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 920, "y1": 80, "x2": 870, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  damper2 = RotationalComponents.Components.Damper(d = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {
          "iconName": "default",
          "x1": 1080,
          "y1": 330,
          "x2": 1120,
          "y2": 370,
          "rot": 180
        }
      },
      "tags": []
    }
  }
relations
  connect(world.frame_b, j1.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(j1.frame_b, b1.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(b1.frame_b, j2.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(j2.frame_b, b2.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(b2.frame_b, j3.frame_a) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [
            {"x": 1335, "y": 240},
            {"x": 1335, "y": 470},
            {"x": 20, "y": 470},
            {"x": 20, "y": 140}
          ],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
  connect(j3.frame_b, b3.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(b3.frame_b, j4.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(j4.frame_b, b4.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(b4.frame_b, j5.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(j5.frame_b, world.frame_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 775, "y": 140}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 775, "y": 240}],
      "renderStyle": "standard"
    }
  }
  connect(j1.axis, damper1.spline_a) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 860, "y": 200}, {"x": 1040, "y": 200}, {"x": 1040, "y": 100}],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
  connect(j1.support, damper1.spline_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 825, "y": 100}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(j2.axis, damper2.spline_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 1130, "y": 350}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(j2.support, damper2.spline_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 1060, "y": 240}, {"x": 1060, "y": 350}], "E": 2}],
      "renderStyle": "standard"
    }
  }
end
Flattened Source
dyad
"""
Planar four-bar linkage closed with a `RevolutePlanarLoopConstraint`.

Five revolute joints form the loop; `j4` is replaced with a
`RevolutePlanarLoopConstraint` because the cut forces along the parallel
joint axes cannot be uniquely computed. Two of the revolute joints are
damped through rotational dampers on their axis splines. The first joint
gets a small non-zero initial angle to start the motion.
"""
example component FourBar
  world = MultibodyComponents.World(default_body_diameter = 0.06, axis_radius = 0.01) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 660, "y1": 190, "x2": 760, "y2": 290, "rot": 0}
      },
      "tags": []
    }
  }
  j1 = MultibodyComponents.Revolute(phi(initial = 0.1)) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 810, "y1": 190, "x2": 910, "y2": 290, "rot": 0}
      },
      "tags": []
    }
  }
  j2 = MultibodyComponents.Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1080, "y1": 190, "x2": 1180, "y2": 290, "rot": 0}
      },
      "tags": []
    }
  }
  j3 = MultibodyComponents.Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 35, "y1": 90, "x2": 135, "y2": 190, "rot": 0}
      },
      "tags": []
    }
  }
  j4 = MultibodyComponents.RevolutePlanarLoopConstraint() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 285, "y1": 90, "x2": 385, "y2": 190, "rot": 0}
      },
      "tags": []
    }
  }
  j5 = MultibodyComponents.Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 535, "y1": 90, "x2": 635, "y2": 190, "rot": 0}
      },
      "tags": []
    }
  }
  b1 = MultibodyComponents.BodyShape(m = 1, r = [1.5, 0, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 940, "y1": 190, "x2": 1040, "y2": 290, "rot": 0}
      },
      "tags": []
    }
  }
  b2 = MultibodyComponents.BodyShape(m = 1, r = [0, 1.5, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1210, "y1": 190, "x2": 1310, "y2": 290, "rot": 0}
      },
      "tags": []
    }
  }
  b3 = MultibodyComponents.BodyShape(m = 1, r = [-1.5, 0, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 160, "y1": 90, "x2": 260, "y2": 190, "rot": 0}
      },
      "tags": []
    }
  }
  b4 = MultibodyComponents.BodyShape(m = 1, r = [0, -1.5, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 410, "y1": 90, "x2": 510, "y2": 190, "rot": 0}
      },
      "tags": []
    }
  }
  damper1 = RotationalComponents.Components.Damper(d = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 920, "y1": 80, "x2": 870, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  damper2 = RotationalComponents.Components.Damper(d = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {
          "iconName": "default",
          "x1": 1080,
          "y1": 330,
          "x2": 1120,
          "y2": 370,
          "rot": 180
        }
      },
      "tags": []
    }
  }
relations
  connect(world.frame_b, j1.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(j1.frame_b, b1.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(b1.frame_b, j2.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(j2.frame_b, b2.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(b2.frame_b, j3.frame_a) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [
            {"x": 1335, "y": 240},
            {"x": 1335, "y": 470},
            {"x": 20, "y": 470},
            {"x": 20, "y": 140}
          ],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
  connect(j3.frame_b, b3.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(b3.frame_b, j4.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(j4.frame_b, b4.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(b4.frame_b, j5.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(j5.frame_b, world.frame_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 775, "y": 140}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 775, "y": 240}],
      "renderStyle": "standard"
    }
  }
  connect(j1.axis, damper1.spline_a) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 860, "y": 200}, {"x": 1040, "y": 200}, {"x": 1040, "y": 100}],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
  connect(j1.support, damper1.spline_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 825, "y": 100}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(j2.axis, damper2.spline_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 1130, "y": 350}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(j2.support, damper2.spline_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 1060, "y": 240}, {"x": 1060, "y": 350}], "E": 2}],
      "renderStyle": "standard"
    }
  }
metadata {}
end


Test Cases

No test cases defined.

  • Examples

  • Experiments

  • Analyses

julia
<< @example-block not executed in draft mode >>