Skip to content
LIBRARY
PlanarMechanics.Damper.md

PlanarMechanics.Damper

Linear velocity-dependent damper.

Damping force acts along the line connecting the two frames. Uses ifelse to prevent zero-division when the distance between frames is very small.

This component extends from PartialTwoFrames

Usage

MultibodyComponents.PlanarMechanics.Damper(d=1, s_small=1e-10)

Parameters:

NameDescriptionUnitsDefault value
dDamping constant1
s_smallPrevent zero-division if distance between frame_a and frame_b is zerom1e-10

Connectors

  • frame_a - Coordinate system (2-dim.) fixed to the component with one cut-force and cut-torque.

All variables are resolved in the planar world frame. (Frame2D)

  • frame_b - Coordinate system (2-dim.) fixed to the component with one cut-force and cut-torque.

All variables are resolved in the planar world frame. (Frame2D)

Variables

NameDescriptionUnits
r0xRelative position x componentm
r0yRelative position y componentm
d0xDirection x component
d0yDirection y component
vxRelative velocity x componentm/s
vyRelative velocity y componentm/s
vRelative velocity magnitudem/s
fDamping forceN

Behavior

r0x(t)+frame_a.x(t)=frame_b.x(t)frame_a.y(t)+r0y(t)=frame_b.y(t)d frame_a.x(t)dt+vx(t)=d frame_b.x(t)dtd frame_a.y(t)dt+vy(t)=d frame_b.y(t)dtv(t)=d0x(t) vx(t)+d0y(t) vy(t)f(t)=d v(t)d0x(t)=ifelse((r0y(t))2+(r0x(t))2<s_small,r0x(t),r0x(t)(r0y(t))2+(r0x(t))2)d0y(t)=ifelse((r0y(t))2+(r0x(t))2<s_small,r0y(t),r0y(t)(r0y(t))2+(r0x(t))2)frame_a.fx(t)=d0x(t) f(t)frame_a.fy(t)=f(t) d0y(t)frame_a.tau(t)=0frame_a.fx(t)+frame_b.fx(t)=0frame_b.fy(t)+frame_a.fy(t)=0frame_b.tau(t)+frame_a.tau(t)=0

Source

dyad
"""
Linear velocity-dependent damper.

Damping force acts along the line connecting the two frames. Uses `ifelse` to prevent
zero-division when the distance between frames is very small.
"""
component Damper
  extends PartialTwoFrames
  "Damping constant"
  parameter d::Real = 1
  "Prevent zero-division if distance between frame_a and frame_b is zero"
  parameter s_small::Length = 1e-10
  "Relative position x component"
  variable r0x::Length
  "Relative position y component"
  variable r0y::Length
  "Direction x component"
  variable d0x::Real
  "Direction y component"
  variable d0y::Real
  "Relative velocity x component"
  variable vx::Velocity
  "Relative velocity y component"
  variable vy::Velocity
  "Relative velocity magnitude"
  variable v::Velocity
  "Damping force"
  variable f::Dyad.Force
relations
  frame_a.x + r0x = frame_b.x
  frame_a.y + r0y = frame_b.y
  der(frame_a.x) + vx = der(frame_b.x)
  der(frame_a.y) + vy = der(frame_b.y)
  v = adjoint([vx, vy]) * [d0x, d0y]
  f = -d * v
  d0x = ifelse(sqrt(r0x ^ 2 + r0y ^ 2) < s_small, r0x, r0x / sqrt(r0x ^ 2 + r0y ^ 2))
  d0y = ifelse(sqrt(r0x ^ 2 + r0y ^ 2) < s_small, r0y, r0y / sqrt(r0x ^ 2 + r0y ^ 2))
  frame_a.fx = d0x * f
  frame_a.fy = d0y * f
  frame_a.tau = 0
  frame_a.fx + frame_b.fx = 0
  frame_a.fy + frame_b.fy = 0
  frame_a.tau + frame_b.tau = 0
metadata {"Dyad": {"icons": {"default": "dyad://MultibodyComponents/Damper.svg"}}}
end
Flattened Source
dyad
"""
Linear velocity-dependent damper.

Damping force acts along the line connecting the two frames. Uses `ifelse` to prevent
zero-division when the distance between frames is very small.
"""
component Damper
  frame_a = Frame2D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 50, "y1": 450, "x2": 150, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  frame_b = Frame2D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 850, "y1": 450, "x2": 950, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Damping constant"
  parameter d::Real = 1
  "Prevent zero-division if distance between frame_a and frame_b is zero"
  parameter s_small::Length = 1e-10
  "Relative position x component"
  variable r0x::Length
  "Relative position y component"
  variable r0y::Length
  "Direction x component"
  variable d0x::Real
  "Direction y component"
  variable d0y::Real
  "Relative velocity x component"
  variable vx::Velocity
  "Relative velocity y component"
  variable vy::Velocity
  "Relative velocity magnitude"
  variable v::Velocity
  "Damping force"
  variable f::Dyad.Force
relations
  frame_a.x + r0x = frame_b.x
  frame_a.y + r0y = frame_b.y
  der(frame_a.x) + vx = der(frame_b.x)
  der(frame_a.y) + vy = der(frame_b.y)
  v = adjoint([vx, vy]) * [d0x, d0y]
  f = -d * v
  d0x = ifelse(sqrt(r0x ^ 2 + r0y ^ 2) < s_small, r0x, r0x / sqrt(r0x ^ 2 + r0y ^ 2))
  d0y = ifelse(sqrt(r0x ^ 2 + r0y ^ 2) < s_small, r0y, r0y / sqrt(r0x ^ 2 + r0y ^ 2))
  frame_a.fx = d0x * f
  frame_a.fy = d0y * f
  frame_a.tau = 0
  frame_a.fx + frame_b.fx = 0
  frame_a.fy + frame_b.fy = 0
  frame_a.tau + frame_b.tau = 0
metadata {"Dyad": {"icons": {"default": "dyad://MultibodyComponents/Damper.svg"}}}
end


Test Cases

No test cases defined.