$(instance)MassDamperSpringFixedTest Icon

MassDamperSpringFixedTest

A one-dimensional translational mechanical system composed of a mass, spring, and damper connected to a fixed point.

This component represents a classic damped harmonic oscillator. A mass (body) is attached to one end of a parallel combination of a linear spring (spring) and a viscous damper (damper). The other end of this spring-damper combination is connected to a fixed reference point (ground). The L=0 parameter for the Mass subcomponent, and the initial condition body.flange_b.s = 0 for the mass's second flange (often specified in simulation setup or test metadata), imply that body.flange_a.s directly represents the absolute displacement x of the mass.

Usage

MassDamperSpringFixedTest()

Behavior

\[ \begin{equation} \left[ \begin{array}{c} \mathrm{connect}\left( spring_{+}flange_{a}, body_{+}flange_{a}, damper_{+}flange_{a} \right) \\ \mathrm{connect}\left( spring_{+}flange_{b}, damper_{+}flange_{b}, ground_{+}flange \right) \\ \mathtt{damper.s\_rel}\left( t \right) = \mathtt{damper.flange\_b.s}\left( t \right) - \mathtt{damper.flange\_a.s}\left( t \right) \\ \mathtt{damper.v\_rel}\left( t \right) = \frac{\mathrm{d} \mathtt{damper.s\_rel}\left( t \right)}{\mathrm{d}t} \\ \mathtt{damper.flange\_b.f}\left( t \right) = \mathtt{damper.f}\left( t \right) \\ \mathtt{damper.flange\_a.f}\left( t \right) = - \mathtt{damper.f}\left( t \right) \\ \mathtt{damper.f}\left( t \right) = \mathtt{damper.d} \mathtt{damper.v\_rel}\left( t \right) \\ \mathtt{damper.lossPower}\left( t \right) = \mathtt{damper.f}\left( t \right) \mathtt{damper.v\_rel}\left( t \right) \\ \mathtt{spring.s\_rel}\left( t \right) = - \mathtt{spring.flange\_a.s}\left( t \right) + \mathtt{spring.flange\_b.s}\left( t \right) \\ \mathtt{spring.flange\_b.f}\left( t \right) = \mathtt{spring.f}\left( t \right) \\ \mathtt{spring.flange\_a.f}\left( t \right) = - \mathtt{spring.f}\left( t \right) \\ \mathtt{spring.f}\left( t \right) = \mathtt{spring.c} \left( - \mathtt{spring.s\_rel0} + \mathtt{spring.s\_rel}\left( t \right) \right) \\ \mathtt{body.flange\_a.s}\left( t \right) = - \frac{1}{2} \mathtt{body.L} + \mathtt{body.s}\left( t \right) \\ \mathtt{body.flange\_b.s}\left( t \right) = \frac{1}{2} \mathtt{body.L} + \mathtt{body.s}\left( t \right) \\ \mathtt{body.v}\left( t \right) = \frac{\mathrm{d} \mathtt{body.s}\left( t \right)}{\mathrm{d}t} \\ \mathtt{body.a}\left( t \right) = \frac{\mathrm{d} \mathtt{body.v}\left( t \right)}{\mathrm{d}t} \\ \left( \mathtt{body.a}\left( t \right) + \mathtt{body.g} \sin\left( \mathtt{body.theta} \right) \right) \mathtt{body.m} = \mathtt{body.flange\_b.f}\left( t \right) + \mathtt{body.flange\_a.f}\left( t \right) \\ \mathtt{ground.flange.s}\left( t \right) = \mathtt{ground.s0} \\ \end{array} \right] \end{equation} \]

Source

# A one-dimensional translational mechanical system composed of a mass, spring, and damper connected to a fixed point.
#
# This component represents a classic damped harmonic oscillator. A mass (`body`) is attached to
# one end of a parallel combination of a linear spring (`spring`) and a viscous damper (`damper`).
# The other end of this spring-damper combination is connected to a fixed reference point (`ground`).
# The `L=0` parameter for the `Mass` subcomponent, and the initial condition `body.flange_b.s = 0`
# for the mass's second flange (often specified in simulation setup or test metadata), imply that
# `body.flange_a.s` directly represents the absolute displacement `x` of the mass.
test component MassDamperSpringFixedTest
  # The viscous damper subcomponent.
  damper = Damper(d=1)
  # The linear spring subcomponent.
  spring = Spring(c=1)
  # The translational mass subcomponent.
  body = Mass(m=1, L=0)
  # The fixed mechanical ground subcomponent.
  ground = Fixed()
relations
  connect(spring.flange_a, body.flange_a, damper.flange_a)
  connect(spring.flange_b, damper.flange_b, ground.flange)
metadata {
  "Dyad": {
    "tests": {
      "case1": {
        "stop": 20,
        "initial": {"body.flange_b.s": 0, "damper.flange_b.f": 0},
        "atol": {"body.v": 0.001},
        "expect": {"final": {"body.v": 0}}
      }
    }
  }
}
end
Flattened Source
# A one-dimensional translational mechanical system composed of a mass, spring, and damper connected to a fixed point.
#
# This component represents a classic damped harmonic oscillator. A mass (`body`) is attached to
# one end of a parallel combination of a linear spring (`spring`) and a viscous damper (`damper`).
# The other end of this spring-damper combination is connected to a fixed reference point (`ground`).
# The `L=0` parameter for the `Mass` subcomponent, and the initial condition `body.flange_b.s = 0`
# for the mass's second flange (often specified in simulation setup or test metadata), imply that
# `body.flange_a.s` directly represents the absolute displacement `x` of the mass.
test component MassDamperSpringFixedTest
  # The viscous damper subcomponent.
  damper = Damper(d=1)
  # The linear spring subcomponent.
  spring = Spring(c=1)
  # The translational mass subcomponent.
  body = Mass(m=1, L=0)
  # The fixed mechanical ground subcomponent.
  ground = Fixed()
relations
  connect(spring.flange_a, body.flange_a, damper.flange_a)
  connect(spring.flange_b, damper.flange_b, ground.flange)
metadata {
  "Dyad": {
    "tests": {
      "case1": {
        "stop": 20,
        "initial": {"body.flange_b.s": 0, "damper.flange_b.f": 0},
        "atol": {"body.v": 0.001},
        "expect": {"final": {"body.v": 0}}
      }
    }
  }
}
end


Test Cases

Test Case case1