---
url: /dyad/stable/stdlib/TranslationalComponents/components/Components.Mass.md
description: >-
  Dyad Components.Mass docs.  Represents a sliding mass with inertia, subject to
  external and gravitational forces.
---

# `Components.Mass` {#Components.Mass}

Represents a sliding mass with inertia, subject to external and gravitational forces.

This component models the translational motion of a point mass along a single axis. It considers the mass's inertia, external forces applied through its two mechanical connection flanges (`flange_a` and `flange_b`), and a gravitational effect determined by parameters `g` and `theta`. The position `s`, velocity `v`, and acceleration `a` are related by `v = der(s)` and `a = der(v)`. The core dynamic behavior is defined by Newton's second law, expressed as:

$$m \cdot (a + g \cdot \sin(\theta)) = \text{flange_a.f} + \text{flange_b.f}$$

where `m` is the mass, `a` is its acceleration, `g` is the gravitational acceleration parameter, `\theta` is the angle parameter, and `\text{flange_a.f} + \text{flange_b.f}` represents the sum of external forces applied via the flanges.

This component extends from [`TranslationalComponents.Interfaces.PartialRigid`](../types/Interfaces.PartialRigid.md)

## Usage {#Usage}

`TranslationalComponents.Components.Mass(L=0.0, m, g=-9.80665, theta=0.0)`

## Parameters: {#Parameters:}

|    Name |                                                                                                                              Description | Units | Default value |
| -------:| ----------------------------------------------------------------------------------------------------------------------------------------:| -----:| -------------:|
|     `L` |                                                                                    Length of component, from left flange to right flange |     m |           0.0 |
|     `m` |                                                                                                                 Mass of the sliding body |    kg |               |
|     `g` |                      Acceleration due to gravity; its effect is scaled by sin(theta) using the specified default or user-provided value. |  m/s2 |      -9.80665 |
| `theta` | Angle defining the path of motion relative to how gravity's influence is calculated as per the component's equations (0 for horizontal). |   rad |           0.0 |

## Connectors {#Connectors}

* `flange_a` - This connector represents a mechanical flange with position and force as the potential and flow variables, respectively. ([`Flange`](/stdlib/Dyad/connectors/Flange#Flange))

* `flange_b` - This connector represents a mechanical flange with position and force as the potential and flow variables, respectively. ([`Flange`](/stdlib/Dyad/connectors/Flange#Flange))

## Variables {#Variables}

| Name |                                                Description | Units |
| ----:| ----------------------------------------------------------:| -----:|
|  `s` |                   Absolute position of center of component |     m |
|  `v` |     Absolute velocity of the mass along its path of motion |   m/s |
|  `a` | Absolute acceleration of the mass along its path of motion |  m/s2 |

## Behavior {#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{L}{2} + 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_a.f}\left( t \right) + \mathtt{flange_b.f}\left( t \right)
\end{align}
$$

## Source {#Source}

````dyad
"""
Represents a sliding mass with inertia, subject to external and gravitational forces.

This component models the translational motion of a point mass along a single axis. It considers the mass's inertia, external forces applied through its two mechanical connection flanges (`flange_a` and `flange_b`), and a gravitational effect determined by parameters `g` and `theta`. The position `s`, velocity `v`, and acceleration `a` are related by `v = der(s)` and `a = der(v)`. The core dynamic behavior is defined by Newton's second law, expressed as:
```math
m \cdot (a + g \cdot \sin(\theta)) = \text{flange_a.f} + \text{flange_b.f}
```
where `m` is the mass, `a` is its acceleration, `g` is the gravitational acceleration parameter, `\theta` is the angle parameter, and `\text{flange_a.f} + \text{flange_b.f}` represents the sum of external forces applied via the flanges.
"""
component Mass
  extends TranslationalComponents.Interfaces.PartialRigid
  "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
  v = der(s)
  a = der(v)
  m * (a + g * sin(theta)) = flange_a.f + flange_b.f
metadata {
  "Dyad": {
    "icons": {"default": "dyad://TranslationalComponents/Mass.svg"},
    "labels": [{"label": "$(instance)", "layer": "icon", "x": 500, "y": 990, "rot": 0}]
  }
}
end
````

````dyad
"""
Represents a sliding mass with inertia, subject to external and gravitational forces.

This component models the translational motion of a point mass along a single axis. It considers the mass's inertia, external forces applied through its two mechanical connection flanges (`flange_a` and `flange_b`), and a gravitational effect determined by parameters `g` and `theta`. The position `s`, velocity `v`, and acceleration `a` are related by `v = der(s)` and `a = der(v)`. The core dynamic behavior is defined by Newton's second law, expressed as:
```math
m \cdot (a + g \cdot \sin(\theta)) = \text{flange_a.f} + \text{flange_b.f}
```
where `m` is the mass, `a` is its acceleration, `g` is the gravitational acceleration parameter, `\theta` is the angle parameter, and `\text{flange_a.f} + \text{flange_b.f}` represents the sum of external forces applied via the flanges.
"""
component Mass
  "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
  v = der(s)
  a = der(v)
  m * (a + g * sin(theta)) = flange_a.f + flange_b.f
metadata {
  "Dyad": {
    "icons": {"default": "dyad://TranslationalComponents/Mass.svg"},
    "labels": [{"label": "$(instance)", "layer": "icon", "x": 500, "y": 990, "rot": 0}]
  }
}
end
````

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`AllComponents`](Components.Mass.md)

  * [`MassDamperSpringFixed`](Components.Mass.md)

  * [`Position`](Components.Mass.md)

  * [`RelativeSensors`](Components.Mass.md)

  * [`Sensors`](Components.Mass.md)

  * [`Speed`](Components.Mass.md)

  * [`TestBraking`](Components.Mass.md)
