Skip to content
LIBRARY
PlanarMechanics.examples.SpringDamperSystemTest.md

PlanarMechanics.examples.SpringDamperSystemTest

This example shows how to use a spring and a damper in combination. The motion of the body is not constrained.

Usage

MultibodyComponents.PlanarMechanics.examples.SpringDamperSystemTest()

Behavior

[connect(world+frameb,fixedtranslation+frame_a)connect(fixedtranslation+frame_b,springdamper+frame_a)connect(springdamper+frame_b,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_radiusfixedtranslation.phi(t)=fixedtranslation.frame_a.phi(t)fixedtranslation.w(t)=dfixedtranslation.phi(t)dtfixedtranslation.r0(t)=arrayliteral([22],cos(fixedtranslation.phi(t)),sin(fixedtranslation.phi(t)),sin(fixedtranslation.phi(t)),cos(fixedtranslation.phi(t)))fixedtranslation.rfixedtranslation.r0(t)=arrayliteral([2],fixedtranslation.frame_a.x(t)+fixedtranslation.frame_b.x(t),fixedtranslation.frame_b.y(t)fixedtranslation.frame_a.y(t))fixedtranslation.frame_a.phi(t)=fixedtranslation.frame_b.phi(t)fixedtranslation.frame_a.fx(t)+fixedtranslation.frame_b.fx(t)=0fixedtranslation.frame_b.fy(t)+fixedtranslation.frame_a.fy(t)=0fixedtranslation.frame_a.tau(t)+fixedtranslation.frame_b.tau(t)+fixedtranslation.frame_b.fy(t)fixedtranslation.r0_1(t)fixedtranslation.frame_b.fx(t)fixedtranslation.r0_2(t)=0fixedtranslation.shape.r(t)=arrayliteral([3],fixedtranslation.frame_a.x(t),fixedtranslation.frame_a.y(t),fixedtranslation.z_position)fixedtranslation.shape.R(t)=arrayliteral([33],1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0)fixedtranslation.shape.r_shape(t)=[000]fixedtranslation.shape.length_direction(t)=arrayliteral([3],fixedtranslation.r0_1(t)fixedtranslation.l,fixedtranslation.r0_2(t)fixedtranslation.l,0)fixedtranslation.shape.width_direction(t)=[001]fixedtranslation.shape.length(t)=fixedtranslation.lfixedtranslation.shape.width(t)=2fixedtranslation.radiusfixedtranslation.shape.height(t)=2fixedtranslation.radiusspringdamper.s_relx(t)=springdamper.frame_a.x(t)+springdamper.frame_b.x(t)springdamper.s_rely(t)=springdamper.frame_a.y(t)+springdamper.frame_b.y(t)springdamper.phi_rel(t)=springdamper.frame_a.phi(t)+springdamper.frame_b.phi(t)springdamper.v_relx(t)=dspringdamper.s_relx(t)dtspringdamper.v_rely(t)=dspringdamper.s_rely(t)dtspringdamper.w_rel(t)=dspringdamper.phi_rel(t)dtspringdamper.tau(t)=springdamper.c_phi(springdamper.phi_rel0+springdamper.phi_rel(t))+springdamper.d_phispringdamper.w_rel(t)springdamper.frame_a.tau(t)=springdamper.tau(t)springdamper.frame_b.tau(t)=springdamper.tau(t)springdamper.f_x(t)=springdamper.c_x(springdamper.s_relx0+springdamper.s_relx(t))+springdamper.d_xspringdamper.v_relx(t)springdamper.f_y(t)=springdamper.c_y(springdamper.s_rely0+springdamper.s_rely(t))+springdamper.d_yspringdamper.v_rely(t)springdamper.frame_a.fx(t)=springdamper.f_x(t)springdamper.frame_b.fx(t)=springdamper.f_x(t)springdamper.frame_a.fy(t)=springdamper.f_y(t)springdamper.frame_b.fy(t)=springdamper.f_y(t)springdamper.shape.r(t)=arrayliteral([3],springdamper.frame_a.x(t),springdamper.frame_a.y(t),springdamper.z_position)springdamper.shape.R(t)=arrayliteral([33],1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0)springdamper.shape.r_shape(t)=[000]springdamper.shape.length_direction(t)=arrayliteral([3],springdamper.s_relx(t),springdamper.s_rely(t),0)springdamper.shape.width_direction(t)=[001]springdamper.shape.length(t)=(springdamper.s_relx(t))2+(springdamper.s_rely(t))2springdamper.shape.width(t)=springdamper.radiusspringdamper.shape.height(t)=0body.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
"This example shows how to use a spring and a damper in combination. The motion of the body is not constrained."
example component SpringDamperSystemTest
  world = MultibodyComponents.PlanarMechanics.World() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 30, "y1": 240, "x2": 230, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  fixed_translation = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [-1.0, 0.0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 280, "y1": 240, "x2": 480, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  spring_damper = MultibodyComponents.PlanarMechanics.SpringDamper(c_x = 5.0, c_y = 5.0, c_phi = 0.0, d_x = 1.0, d_y = 1.0, d_phi = 0.0, s_relx0 = 0.0, s_rely0 = 0.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 550, "y1": 240, "x2": 750, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  body = MultibodyComponents.PlanarMechanics.Body(m = 0.5, I = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 800, "y1": 240, "x2": 1000, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial body.r = [1.0, 1.0]
  initial body.v = [0.0, 0.0]
  initial body.phi = 0.0
  initial body.w = 0.0
  connect(world.frame_b, fixed_translation.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(fixed_translation.frame_b, spring_damper.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(spring_damper.frame_b, body.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
end
Flattened Source
dyad
"This example shows how to use a spring and a damper in combination. The motion of the body is not constrained."
example component SpringDamperSystemTest
  world = MultibodyComponents.PlanarMechanics.World() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 30, "y1": 240, "x2": 230, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  fixed_translation = MultibodyComponents.PlanarMechanics.FixedTranslation(r = [-1.0, 0.0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 280, "y1": 240, "x2": 480, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  spring_damper = MultibodyComponents.PlanarMechanics.SpringDamper(c_x = 5.0, c_y = 5.0, c_phi = 0.0, d_x = 1.0, d_y = 1.0, d_phi = 0.0, s_relx0 = 0.0, s_rely0 = 0.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 550, "y1": 240, "x2": 750, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  body = MultibodyComponents.PlanarMechanics.Body(m = 0.5, I = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 800, "y1": 240, "x2": 1000, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial body.r = [1.0, 1.0]
  initial body.v = [0.0, 0.0]
  initial body.phi = 0.0
  initial body.w = 0.0
  connect(world.frame_b, fixed_translation.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(fixed_translation.frame_b, spring_damper.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(spring_damper.frame_b, body.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {}
end


Test Cases

No test cases defined.

  • Examples

  • Experiments

  • Analyses