---
url: /dyad/stable/stdlib/TranslationalComponents/components/Sensors.RelativeAccelerationSensor.md
description: >-
  Dyad Sensors.RelativeAccelerationSensor docs.  Ideal sensor measuring the
  relative acceleration between two translational flanges.
---

# `Sensors.RelativeAccelerationSensor` {#Sensors.RelativeAccelerationSensor}

Ideal sensor measuring the relative acceleration between two translational flanges.

This sensor determines the acceleration of `flange_b` with respect to `flange_a` (where `s_a` and `s_b` in the equations below refer to `flange_a.s` and `flange_b.s` respectively). It operates by first calculating the relative displacement, $s\_{rel} = s_b - s_a$. This relative displacement is then differentiated with respect to time to obtain the relative velocity, $v\_{rel} = \frac{d(s\_{rel})}{dt}$. Finally, the relative velocity is differentiated with respect to time to yield the relative acceleration, $a\_{rel} = \frac{d(v\_{rel})}{dt}$. The sensor is ideal, meaning it does not exert any force on the connected components; specifically, the force at `flange_a` is defined as zero, ensuring no mechanical load is introduced by the sensor.

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

## Usage {#Usage}

`TranslationalComponents.Sensors.RelativeAccelerationSensor()`

## 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))

* `a_rel` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

## Variables {#Variables}

|    Name |                                            Description | Units |
| -------:| ------------------------------------------------------:| -----:|
| `s_rel` | Relative position of `flange_b` relative to `flange_a` |     m |
| `v_rel` | Relative velocity of `flange_b` relative to `flange_a` |   m/s |

## Behavior {#Behavior}

$$ \begin{align}
0 &= \mathtt{flange_a.f}\left( t \right) + \mathtt{flange_b.f}\left( t \right) \\
\mathtt{s_rel}\left( t \right) &=  - \mathtt{flange_a.s}\left( t \right) + \mathtt{flange_b.s}\left( t \right) \\
\mathtt{v_rel}\left( t \right) &= \frac{\mathrm{d}\mathtt{s_rel}\left( t \right)}{\mathrm{d}t} \\
\mathtt{a_rel}\left( t \right) &= \frac{\mathrm{d}\mathtt{v_rel}\left( t \right)}{\mathrm{d}t} \\
0 &= \mathtt{flange_a.f}\left( t \right)
\end{align}
$$

## Source {#Source}

```dyad
"""
Ideal sensor measuring the relative acceleration between two translational flanges.

This sensor determines the acceleration of `flange_b` with respect to `flange_a`
(where `s_a` and `s_b` in the equations below refer to `flange_a.s` and `flange_b.s`
respectively). It operates by first calculating the relative displacement,
$s_{rel} = s_b - s_a$. This relative displacement is then differentiated with
respect to time to obtain the relative velocity, $v_{rel} = \frac{d(s_{rel})}{dt}$.
Finally, the relative velocity is differentiated with respect to time to yield the
relative acceleration, $a_{rel} = \frac{d(v_{rel})}{dt}$. The sensor is ideal,
meaning it does not exert any force on the connected components; specifically, the force at
`flange_a` is defined as zero, ensuring no mechanical load is introduced by the sensor.
"""
component RelativeAccelerationSensor
  extends TranslationalComponents.Interfaces.PartialRelativeSensor
  "Relative acceleration of `flange_b` relative to `flange_a` as output signal"
  a_rel = RealOutput(units = "m/s^2") {
    "Dyad": {
      "placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 90}}
    }
  }
  "Relative position of `flange_b` relative to `flange_a`"
  variable s_rel::Distance
  "Relative velocity of `flange_b` relative to `flange_a`"
  variable v_rel::Velocity
relations
  s_rel = flange_b.s - flange_a.s
  v_rel = der(s_rel)
  a_rel = der(v_rel)
  0 = flange_a.f
metadata {
  "Dyad": {
    "icons": {"default": "dyad://TranslationalComponents/RelativeSensor.svg"},
    "labels": [{"label": "$(instance)", "layer": "icon", "x": 500, "y": 1198, "rot": 0}]
  }
}
end
```

```dyad
"""
Ideal sensor measuring the relative acceleration between two translational flanges.

This sensor determines the acceleration of `flange_b` with respect to `flange_a`
(where `s_a` and `s_b` in the equations below refer to `flange_a.s` and `flange_b.s`
respectively). It operates by first calculating the relative displacement,
$s_{rel} = s_b - s_a$. This relative displacement is then differentiated with
respect to time to obtain the relative velocity, $v_{rel} = \frac{d(s_{rel})}{dt}$.
Finally, the relative velocity is differentiated with respect to time to yield the
relative acceleration, $a_{rel} = \frac{d(v_{rel})}{dt}$. The sensor is ideal,
meaning it does not exert any force on the connected components; specifically, the force at
`flange_a` is defined as zero, ensuring no mechanical load is introduced by the sensor.
"""
component RelativeAccelerationSensor
  "Negative connection flange of the sensor, often considered the reference point."
  flange_a = Flange() {"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}
  "Positive connection flange of the sensor, where the measurement is taken relative to flange_a."
  flange_b = Flange() {"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}
  "Relative acceleration of `flange_b` relative to `flange_a` as output signal"
  a_rel = RealOutput(units = "m/s^2") {
    "Dyad": {
      "placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 90}}
    }
  }
  "Relative position of `flange_b` relative to `flange_a`"
  variable s_rel::Distance
  "Relative velocity of `flange_b` relative to `flange_a`"
  variable v_rel::Velocity
relations
  0 = flange_a.f + flange_b.f
  s_rel = flange_b.s - flange_a.s
  v_rel = der(s_rel)
  a_rel = der(v_rel)
  0 = flange_a.f
metadata {
  "Dyad": {
    "icons": {"default": "dyad://TranslationalComponents/RelativeSensor.svg"},
    "labels": [{"label": "$(instance)", "layer": "icon", "x": 500, "y": 1198, "rot": 0}]
  }
}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`RelativeSensors`](Sensors.RelativeAccelerationSensor.md)
