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

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

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