Skip to content
LIBRARY
PlanarMechanics.examples.PendulumTest.md

PlanarMechanics.examples.PendulumTest

A free swinging pendulum.

Usage

MultibodyComponents.PlanarMechanics.examples.PendulumTest()

Behavior

[connect(world+frameb,revolute+framea)connect(revolute+frameb,rod+framea)connect(rod+frameb,body+framea)world.frameb.x(t)=0world.frameb.y(t)=0world.frameb.phi(t)=0connect(frameb,framevis+frame_a)world.framevis.phi(t)=world.framevis.frame_a.phi(t)world.framevis.x_shape.r(t)=arrayliteral([3],world.framevis.frame_a.x(t),world.framevis.frame_a.y(t),world.framevis.z_position)world.framevis.x_shape.R(t)=arrayliteral([33],cos(world.framevis.phi(t)),sin(world.framevis.phi(t)),0,sin(world.framevis.phi(t)),cos(world.framevis.phi(t)),0,0,0,1)world.framevis.x_shape.r_shape(t)=[000]world.framevis.x_shape.length_direction(t)=[100]world.framevis.x_shape.width_direction(t)=[001]world.framevis.x_shape.length(t)=world.framevis.axis_lengthworld.framevis.x_shape.width(t)=2world.framevis.axis_radiusworld.framevis.x_shape.height(t)=2world.framevis.axis_radiusworld.framevis.y_shape.r(t)=arrayliteral([3],world.framevis.frame_a.x(t),world.framevis.frame_a.y(t),world.framevis.z_position)world.framevis.y_shape.R(t)=arrayliteral([33],cos(world.framevis.phi(t)),sin(world.framevis.phi(t)),0,sin(world.framevis.phi(t)),cos(world.framevis.phi(t)),0,0,0,1)world.framevis.y_shape.r_shape(t)=[000]world.framevis.y_shape.length_direction(t)=[010]world.framevis.y_shape.width_direction(t)=[001]world.framevis.y_shape.length(t)=world.framevis.axis_lengthworld.framevis.y_shape.width(t)=2world.framevis.axis_radiusworld.framevis.y_shape.height(t)=2world.framevis.axis_radiusworld.framevis.z_shape.r(t)=arrayliteral([3],world.framevis.frame_a.x(t),world.framevis.frame_a.y(t),world.framevis.z_position)world.framevis.z_shape.R(t)=arrayliteral([33],cos(world.framevis.phi(t)),sin(world.framevis.phi(t)),0,sin(world.framevis.phi(t)),cos(world.framevis.phi(t)),0,0,0,1)world.framevis.z_shape.r_shape(t)=[000]world.framevis.z_shape.length_direction(t)=[001]world.framevis.z_shape.width_direction(t)=[100]world.framevis.z_shape.length(t)=world.framevis.axis_lengthworld.framevis.z_shape.width(t)=2world.framevis.axis_radiusworld.framevis.z_shape.height(t)=2world.framevis.axis_radiusrevolute.w(t)=drevolute.phi(t)dtrevolute.alpha(t)=drevolute.w(t)dtrevolute.framea.x(t)=revolute.frameb.x(t)revolute.framea.y(t)=revolute.frameb.y(t)revolute.framea.phi(t)+revolute.phi(t)=revolute.frameb.phi(t)revolute.frameb.fx(t)+revolute.framea.fx(t)=0revolute.framea.fy(t)+revolute.frameb.fy(t)=0revolute.frameb.tau(t)+revolute.framea.tau(t)=0revolute.framea.tau(t)=revolute.tau(t)revolute.flangea.phi(t)=revolute.phi(t)revolute.flangea.tau(t)=revolute.tau(t)revolute.shape.r(t)=arrayliteral([3],revolute.framea.x(t),revolute.framea.y(t),revolute.zposition)revolute.shape.R(t)=arrayliteral([33],cos(revolute.framea.phi(t)),sin(revolute.framea.phi(t)),0,sin(revolute.framea.phi(t)),cos(revolute.framea.phi(t)),0,0,0,1)revolute.shape.rshape(t)=arrayliteral([3],0,0,12revolute.cylinderlength)revolute.shape.lengthdirection(t)=[001]revolute.shape.widthdirection(t)=[100]revolute.shape.length(t)=revolute.cylinderlengthrevolute.shape.width(t)=2revolute.radiusrevolute.shape.height(t)=2revolute.radiusrod.phi(t)=rod.framea.phi(t)rod.w(t)=drod.phi(t)dtrod.r0(t)=arrayliteral([22],cos(rod.phi(t)),sin(rod.phi(t)),sin(rod.phi(t)),cos(rod.phi(t)))rod.rrod.r0(t)=arrayliteral([2],rod.framea.x(t)+rod.frameb.x(t),rod.frameb.y(t)rod.framea.y(t))rod.framea.phi(t)=rod.frameb.phi(t)rod.framea.fx(t)+rod.frameb.fx(t)=0rod.frameb.fy(t)+rod.framea.fy(t)=0rod.framea.tau(t)+rod.frameb.tau(t)+rod.r01(t)rod.frameb.fy(t)rod.r02(t)rod.frameb.fx(t)=0rod.shape.r(t)=arrayliteral([3],rod.framea.x(t),rod.framea.y(t),rod.zposition)rod.shape.R(t)=arrayliteral([33],1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0)rod.shape.rshape(t)=[000]rod.shape.lengthdirection(t)=arrayliteral([3],rod.r01(t)rod.l,rod.r02(t)rod.l,0)rod.shape.widthdirection(t)=[001]rod.shape.length(t)=rod.lrod.shape.width(t)=2rod.radiusrod.shape.height(t)=2rod.radiusbody.r(t)=arrayliteral([2],body.framea.x(t),body.framea.y(t))body.v(t)=dbody.r(t)dtbody.phi(t)=body.framea.phi(t)body.w(t)=dbody.phi(t)dtbody.a(t)=dbody.v(t)dtbody.alpha(t)=dbody.w(t)dtbody.f(t)=arrayliteral([2],body.framea.fx(t),body.framea.fy(t))body.f(t)+arrayliteral([2],body.mgn2d1,body.mgn2d2)=body.mbody.a(t)body.Ibody.alpha(t)=body.framea.tau(t)body.shape.r(t)=arrayliteral([3],body.framea.x(t),body.framea.y(t),body.zposition)body.shape.R(t)=arrayliteral([33],cos(body.phi(t)),sin(body.phi(t)),0,sin(body.phi(t)),cos(body.phi(t)),0,0,0,1)body.shape.rshape(t)=[000]body.shape.lengthdirection(t)=[001]body.shape.widthdirection(t)=[100]body.shape.length(t)=2body.radiusbody.shape.width(t)=2body.radiusbody.shape.height(t)=2body.radius]

Source

dyad
"A free swinging pendulum."
example component PendulumTest
  world = MultibodyComponents.PlanarMechanics.World() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 30, "y1": 240, "x2": 230, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  revolute = MultibodyComponents.PlanarMechanics.Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 240, "x2": 490, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  rod = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [1.0, 0.0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 550, "y1": 240, "x2": 750, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  body = MultibodyComponents.PlanarMechanics.Body(m = 1.0, I = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 810, "y1": 240, "x2": 1010, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial revolute.phi = 0.0
  initial revolute.w = 0.0
  connect(world.frame_b, revolute.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(revolute.frame_b, rod.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(rod.frame_b, body.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {"Dyad": {"tests": {"case1": {"stop": 3}}}}
end
Flattened Source
dyad
"A free swinging pendulum."
example component PendulumTest
  world = MultibodyComponents.PlanarMechanics.World() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 30, "y1": 240, "x2": 230, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  revolute = MultibodyComponents.PlanarMechanics.Revolute() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 240, "x2": 490, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  rod = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [1.0, 0.0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 550, "y1": 240, "x2": 750, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  body = MultibodyComponents.PlanarMechanics.Body(m = 1.0, I = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 810, "y1": 240, "x2": 1010, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial revolute.phi = 0.0
  initial revolute.w = 0.0
  connect(world.frame_b, revolute.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(revolute.frame_b, rod.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(rod.frame_b, body.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {"Dyad": {"tests": {"case1": {"stop": 3}}}}
end


Test Cases

Test Case case1

  • Examples

  • Experiments

  • Analyses