---
url: /dyad/dev/stdlib/TranslationalComponents/components/Sources.Position.md
description: >-
  Dyad Sources.Position docs.  Forced movement of a flange according to a
  reference position.
---

# `Sources.Position` {#Sources.Position}

Forced movement of a flange according to a reference position.

The input signal `s_ref` defines the reference position in \[m]. The flange is forced to move relative to the support connector according to this reference motion. The parameter `ref_type` selects between two modes:

1. **Exact**: The reference position is treated exactly. This is only possible if the input signal is defined by an analytical function which can be differentiated at least twice.

2. **Filtered** (default): The reference position is filtered and the second derivative of the filtered curve is used to compute the reference acceleration of the flange. For filtering, a second order Bessel filter is used. The critical frequency `f_crit` in \[Hz] should be selected higher than the essential low frequencies in the signal.
   `math  \\frac{bf}{w_{crit}^2} \\frac{d^2s}{dt^2} + \\frac{af}{w_{crit}} \\frac{ds}{dt} + s = s_{ref}`

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

## Usage {#Usage}

`TranslationalComponents.Sources.Position(a_f=1.3617, b_f=0.6180)`

## Parameters: {#Parameters:}

|       Name |                       Description | Units |             Default value |
| ----------:| ---------------------------------:| -----:| -------------------------:|
| `ref_type` | Type of reference signal handling |     – | Translation....Filtered() |

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

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

* `s_ref` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

## Variables {#Variables}

| Name |                                                  Description | Units |
| ----:| ------------------------------------------------------------:| -----:|
|  `s` | Distance between flange and support (= flange.s - support.s) |     m |
|  `v` |                   Velocity of flange with respect to support |   m/s |
|  `a` |               Acceleration of flange with respect to support |  m/s2 |

## Behavior {#Behavior}

$$ \begin{align}
s\left( t \right) &= \mathtt{flange.s}\left( t \right) - \mathtt{support.s}\left( t \right) \\
\mathtt{support.f}\left( t \right) &=  - \mathtt{flange.f}\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} \\
a\left( t \right) &= \frac{314.16 ~ \left(  - \mathtt{a_f} ~ v\left( t \right) + 100 ~ \pi ~ \left(  - s\left( t \right) + \mathtt{s_ref}\left( t \right) \right) \right)}{\mathtt{b_f}}
\end{align}
$$

## Source {#Source}

````dyad
"""
Forced movement of a flange according to a reference position.

The input signal `s_ref` defines the reference position in [m]. The flange is forced to move
relative to the support connector according to this reference motion. The parameter `ref_type`
selects between two modes:

1. **Exact**: The reference position is treated exactly. This is only possible if
   the input signal is defined by an analytical function which can be differentiated at
   least twice.
2. **Filtered** (default): The reference position is filtered and the second derivative of the
   filtered curve is used to compute the reference acceleration of the flange. For filtering,
   a second order Bessel filter is used. The critical frequency `f_crit` in [Hz] should be
   selected higher than the essential low frequencies in the signal.

   ```math
   \\frac{bf}{w_{crit}^2} \\frac{d^2s}{dt^2} + \\frac{af}{w_{crit}} \\frac{ds}{dt} + s = s_{ref}
````

"""
component Position
extends TranslationalComponents.Interfaces.PartialElementaryOneFlangeAndSupport2(s(statePriority = 50) = missing)
"Reference position of flange as input signal"
s_ref = RealInput(units = "m") {"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}
"Type of reference signal handling"
structural parameter ref_type::TranslationalComponents.Sources.ReferenceType = TranslationalComponents.Sources.ReferenceType.Filtered()
"s-coefficient of the Bessel filter"
final parameter a_f::Real = 1.3617
"s²-coefficient of the Bessel filter"
final parameter b_f::Real = 0.6180
"Velocity of flange with respect to support"
variable v::Velocity(statePriority = 50)
"Acceleration of flange with respect to support"
variable a::Acceleration
relations
switch ref_type
case Exact
s = s_ref
v = 0
a = 0
case Filtered
initial s = s_ref
v = der(s)
a = der(v)
a = ((s_ref - s) \* 2 \* π \* getproperty(ref_type, Symbol("f_crit")) - a_f \* v) \* (2 \* π \* getproperty(ref_type, Symbol("f_crit")) / b_f)
end
metadata {
"Dyad": {
"icons": {"default": "dyad://TranslationalComponents/Position.svg"},
"labels": \[{"label": "$(instance)", "layer": "icon", "x": 500, "y": 1204, "rot": 0}]
}
}
end

````


<details>
<summary>Flattened Source</summary>



```dyad
"""
Forced movement of a flange according to a reference position.

The input signal `s_ref` defines the reference position in [m]. The flange is forced to move
relative to the support connector according to this reference motion. The parameter `ref_type`
selects between two modes:

1. **Exact**: The reference position is treated exactly. This is only possible if
   the input signal is defined by an analytical function which can be differentiated at
   least twice.
2. **Filtered** (default): The reference position is filtered and the second derivative of the
   filtered curve is used to compute the reference acceleration of the flange. For filtering,
   a second order Bessel filter is used. The critical frequency `f_crit` in [Hz] should be
   selected higher than the essential low frequencies in the signal.

   ```math
   \\frac{bf}{w_{crit}^2} \\frac{d^2s}{dt^2} + \\frac{af}{w_{crit}} \\frac{ds}{dt} + s = s_{ref}
````

"""
component Position
"Flange of component"
flange = Flange() {"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}
"Support/housing of component"
support = Flange() {"Dyad": {"placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050}}}}
"Distance between flange and support (= flange.s - support.s)"
variable s::Length
"Reference position of flange as input signal"
s_ref = RealInput(units = "m") {"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}
"Type of reference signal handling"
structural parameter ref_type::TranslationalComponents.Sources.ReferenceType = TranslationalComponents.Sources.ReferenceType.Filtered()
"s-coefficient of the Bessel filter"
final parameter a_f::Real = 1.3617
"s²-coefficient of the Bessel filter"
final parameter b_f::Real = 0.6180
"Velocity of flange with respect to support"
variable v::Velocity(statePriority = 50)
"Acceleration of flange with respect to support"
variable a::Acceleration
relations
s = flange.s - support.s
support.f = -flange.f
switch ref_type
case Exact
s = s_ref
v = 0
a = 0
case Filtered
initial s = s_ref
v = der(s)
a = der(v)
a = ((s_ref - s) \* 2 \* π \* getproperty(ref_type, Symbol("f_crit")) - a_f \* v) \* (2 \* π \* getproperty(ref_type, Symbol("f_crit")) / b_f)
end
metadata {
"Dyad": {
"icons": {"default": "dyad://TranslationalComponents/Position.svg"},
"labels": \[{"label": "$(instance)", "layer": "icon", "x": 500, "y": 1204, "rot": 0}]
}
}
end

```

</details>


<br></br>



## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}
- Examples
    
- Experiments
    
- Analyses
    
- Tests
    - [`AllComponents`](Sources.Position.md)
        
    - [`Fixed`](Sources.Position.md)
        
    - [`Mass`](Sources.Position.md)
        
    - [`Position`](Sources.Position.md)
        
    - [`Position`](Sources.Position.md)
        
    - [`Sine`](Sources.Position.md)
        
    
```
