$(instance)Mass Icon

Mass

Sliding mass with inertia

This component extends from PartialRigid

Usage

Mass(L=0.0, m, g=-9.80665, theta=0.0)

Parameters:

NameDescriptionUnitsDefault value
LLength of component, from left flange to right flangem0
mMass of the sliding masskg
gGravity (defaults to standard acceleration of gravity)m/s2-9.80665
thetaAngle of motion w.r.t. gravity, 0 = horizontal, pi / 2 = vertical with gravity pulling backwardrad0

Connectors

Variables

NameDescriptionUnits
sAbsolute position of center of componentm
vAbsolute velocity of componentm/s
aAbsolute acceleration of componentm/s2

Behavior

\[ \begin{align} \mathtt{flange\_a.s}\left( t \right) &= - \frac{1}{2} L + s\left( t \right) \\ \mathtt{flange\_b.s}\left( t \right) &= \frac{1}{2} L + s\left( t \right) \\ v\left( t \right) &= \frac{\mathrm{d} s\left( t \right)}{\mathrm{d}t} \\ a\left( t \right) &= \frac{\mathrm{d} v\left( t \right)}{\mathrm{d}t} \\ \left( a\left( t \right) + g \sin\left( \mathtt{theta} \right) \right) m &= \mathtt{flange\_b.f}\left( t \right) + \mathtt{flange\_a.f}\left( t \right) \end{align} \]

Source

# Sliding mass with inertia
component Mass
  extends PartialRigid
  # Mass of the sliding mass
  parameter m::JSML.Mass
  # Absolute velocity of component
  variable v::Velocity
  # Absolute acceleration of component
  variable a::Acceleration
  # Gravity (defaults to standard acceleration of gravity)
  parameter g::Acceleration = -9.80665
  # Angle of motion w.r.t. gravity, 0 = horizontal, pi / 2 = vertical with gravity pulling backward
  parameter theta::Angle = 0.0
relations
  v = der(s)
  a = der(v)
  m*(a+g*sin(theta)) = flange_a.f+flange_b.f
metadata {"JuliaSim": {"icons": {"default": "jsml://TranslationalComponents/Mass.svg"}}}
end
Flattened Source
# Sliding mass with inertia
component Mass
  flange_a = Flange() [{
    "JuliaSim": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}
  }]
  flange_b = Flange() [{
    "JuliaSim": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}
  }]
  # Absolute position of center of component
  variable s::JSML.Position
  # Length of component, from left flange to right flange
  parameter L::Length = 0.0
  # Mass of the sliding mass
  parameter m::JSML.Mass
  # Absolute velocity of component
  variable v::Velocity
  # Absolute acceleration of component
  variable a::Acceleration
  # Gravity (defaults to standard acceleration of gravity)
  parameter g::Acceleration = -9.80665
  # Angle of motion w.r.t. gravity, 0 = horizontal, pi / 2 = vertical with gravity pulling backward
  parameter theta::Angle = 0.0
relations
  flange_a.s = s-L/2
  flange_b.s = s+L/2
  v = der(s)
  a = der(v)
  m*(a+g*sin(theta)) = flange_a.f+flange_b.f
metadata {"JuliaSim": {"icons": {"default": "jsml://TranslationalComponents/Mass.svg"}}}
end

Test Cases