TrainCarTrainCar Icon

TrainCar

This component extends from TranslationalComponents.Mass

Usage

TrainCar(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 bodykg
gAcceleration due to gravity; its effect is scaled by sin(theta) using the specified default or user-provided value.m/s2-9.80665
thetaAngle defining the path of motion relative to how gravity's influence is calculated as per the component's equations (0 for horizontal).rad0

Connectors

  • flange_a - This connector represents a mechanical flange with position and force as the potential and flow variables, respectively. (Flange)
  • flange_b - This connector represents a mechanical flange with position and force as the potential and flow variables, respectively. (Flange)

Variables

NameDescriptionUnits
sAbsolute position of center of componentm
vAbsolute velocity of the mass along its path of motionm/s
aAbsolute acceleration of the mass along its path of motionm/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

component TrainCar
  extends TranslationalComponents.Mass
metadata {"Dyad": {"icons": {"default": "dyad://DyadExampleComponents/mass.svg"}}}
end
Flattened Source
component TrainCar
  # Left translational 1D flange
  flange_a = Flange() [{"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}]
  # Right translational 1D flange
  flange_b = Flange() [{"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}]
  # Absolute position of center of component
  variable s::Dyad.Position
  # Length of component, from left flange to right flange
  parameter L::Length = 0.0
  # Mass of the sliding body
  parameter m::Dyad.Mass
  # Absolute velocity of the mass along its path of motion
  variable v::Velocity
  # Absolute acceleration of the mass along its path of motion
  variable a::Acceleration
  # Acceleration due to gravity; its effect is scaled by sin(theta) using the specified default or user-provided value.
  parameter g::Acceleration = -9.80665
  # Angle defining the path of motion relative to how gravity's influence is calculated as per the component's equations (0 for horizontal).
  parameter theta::Angle = 0.0
relations
  flange_a.s = s - L / 2
  flange_b.s = s + L / 2
  # Velocity is the time derivative of absolute position 's' (likely inherited from PartialRigid)
  v = der(s)
  # Acceleration is the time derivative of velocity 'v'
  a = der(v)
  # Newton's second law: relates inertial forces, gravitational effects (per g, theta), and forces from flanges
  m * (a + g * sin(theta)) = flange_a.f + flange_b.f
metadata {"Dyad": {"icons": {"default": "dyad://DyadExampleComponents/mass.svg"}}}
end


Test Cases

No test cases defined.

  • Examples
  • Experiments
  • Analyses