---
url: /dyad/stable/stdlib/TranslationalComponents/components/Sensors.PositionSensor.md
description: >-
  Dyad Sensors.PositionSensor docs.  Measures the absolute linear position of a
  mechanical translational flange.
---

# `Sensors.PositionSensor` {#Sensors.PositionSensor}

Measures the absolute linear position of a mechanical translational flange.

This sensor provides the absolute translational position of its connection point. It inherits from `PartialAbsoluteSensor`, which defines a mechanical translational `flange`. The sensor's `RealOutput` signal, named `s`, directly reflects the position variable `s` associated with this `flange`. The fundamental behavior is captured by the equation:

$$s = flange.s$$

Here, the `s` on the left side of the equation is the sensor's output signal, and `flange.s` is the position variable of the connector inherited from `PartialAbsoluteSensor`.

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

## Usage {#Usage}

`TranslationalComponents.Sensors.PositionSensor()`

## Connectors {#Connectors}

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

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

## Behavior {#Behavior}

$$ \begin{align}
0 &= \mathtt{flange.f}\left( t \right) \\
\mathtt{flange.s}\left( t \right) &= s\left( t \right)
\end{align}
$$

## Source {#Source}

````dyad
"""
Measures the absolute linear position of a mechanical translational flange.

This sensor provides the absolute translational position of its connection point.
It inherits from `PartialAbsoluteSensor`, which defines a mechanical
translational `flange`. The sensor's `RealOutput` signal, named `s`, directly
reflects the position variable `s` associated with this `flange`.
The fundamental behavior is captured by the equation:
```math
s = flange.s
```
Here, the `s` on the left side of the equation is the sensor's output signal,
and `flange.s` is the position variable of the connector inherited from
`PartialAbsoluteSensor`.
"""
component PositionSensor
  extends TranslationalComponents.Interfaces.PartialAbsoluteSensor
  "Output signal representing the measured absolute position"
  s = RealOutput(units = "m") {"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}
relations
  flange.s = s
metadata {
  "Dyad": {
    "icons": {"default": "dyad://TranslationalComponents/AbsoluteSensor.svg"},
    "labels": [{"label": "$(instance)", "layer": "icon", "x": 500, "y": 1085, "rot": 0}]
  }
}
end
````

````dyad
"""
Measures the absolute linear position of a mechanical translational flange.

This sensor provides the absolute translational position of its connection point.
It inherits from `PartialAbsoluteSensor`, which defines a mechanical
translational `flange`. The sensor's `RealOutput` signal, named `s`, directly
reflects the position variable `s` associated with this `flange`.
The fundamental behavior is captured by the equation:
```math
s = flange.s
```
Here, the `s` on the left side of the equation is the sensor's output signal,
and `flange.s` is the position variable of the connector inherited from
`PartialAbsoluteSensor`.
"""
component PositionSensor
  "Mechanical flange connector through which the variable is sensed."
  flange = Flange() {"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}
  "Output signal representing the measured absolute position"
  s = RealOutput(units = "m") {"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}
relations
  0 = flange.f
  flange.s = s
metadata {
  "Dyad": {
    "icons": {"default": "dyad://TranslationalComponents/AbsoluteSensor.svg"},
    "labels": [{"label": "$(instance)", "layer": "icon", "x": 500, "y": 1085, "rot": 0}]
  }
}
end
````

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`Sensors`](Sensors.PositionSensor.md)
