Skip to content
LIBRARY
Components.RelativeStates.md

Components.RelativeStates

Definition of relative state variables.

This component defines relative position and relative velocity between two flanges as preferred state variables. It transmits zero force and is used purely for state selection purposes.

Connect an instance of this model between two flange connectors to use the relative position s_rel and relative velocity v_rel as state variables instead of the default absolute quantities.

The equations are:

srel=flange_b.sflange_a.svrel=fracd(srel)dtarel=fracd(vrel)dtflange_a.f=0flange_b.f=0

This component extends from TranslationalComponents.Interfaces.PartialTwoFlanges

Usage

TranslationalComponents.Components.RelativeStates()

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
s_relRelative position used as state variablem
v_relRelative velocity used as state variablem/s
a_relRelative accelerationm/s2

Behavior

julia
using TranslationalComponents #hide
using ModelingToolkit #hide
@named sys = TranslationalComponents.Components.RelativeStates() #hide
full_equations(sys) #hide
<< @example-block not executed in draft mode >>

Source

dyad
"""
Definition of relative state variables.

This component defines **relative position** and **relative velocity** between two
flanges as preferred state variables. It transmits zero force and is used purely
for state selection purposes.

Connect an instance of this model between two flange connectors to use
the relative position `s_rel` and relative velocity `v_rel` as state variables
instead of the default absolute quantities.

The equations are:
```math
s_{rel} = flange\_b.s - flange\_a.s
```
```math
v_{rel} = \\frac{d(s_{rel})}{dt}
```
```math
a_{rel} = \\frac{d(v_{rel})}{dt}
```
```math
flange\_a.f = 0
```
```math
flange\_b.f = 0
```
"""
component RelativeStates
  extends TranslationalComponents.Interfaces.PartialTwoFlanges
  "Relative position used as state variable"
  variable s_rel::Distance(statePriority = 50)
  "Relative velocity used as state variable"
  variable v_rel::Velocity(statePriority = 50)
  "Relative acceleration"
  variable a_rel::Acceleration
relations
  s_rel = flange_b.s - flange_a.s
  v_rel = der(s_rel)
  a_rel = der(v_rel)
  flange_a.f = 0
  flange_b.f = 0
metadata {
  "Dyad": {"icons": {"default": "dyad://TranslationalComponents/RelativeStates.svg"}}
}
end
Flattened Source
dyad
"""
Definition of relative state variables.

This component defines **relative position** and **relative velocity** between two
flanges as preferred state variables. It transmits zero force and is used purely
for state selection purposes.

Connect an instance of this model between two flange connectors to use
the relative position `s_rel` and relative velocity `v_rel` as state variables
instead of the default absolute quantities.

The equations are:
```math
s_{rel} = flange\_b.s - flange\_a.s
```
```math
v_{rel} = \\frac{d(s_{rel})}{dt}
```
```math
a_{rel} = \\frac{d(v_{rel})}{dt}
```
```math
flange\_a.f = 0
```
```math
flange\_b.f = 0
```
"""
component RelativeStates
  "Left mechanical translational flange (connector)"
  flange_a = Flange() {"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}
  "Right mechanical translational flange (connector)"
  flange_b = Flange() {"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}
  "Relative position used as state variable"
  variable s_rel::Distance(statePriority = 50)
  "Relative velocity used as state variable"
  variable v_rel::Velocity(statePriority = 50)
  "Relative acceleration"
  variable a_rel::Acceleration
relations
  s_rel = flange_b.s - flange_a.s
  v_rel = der(s_rel)
  a_rel = der(v_rel)
  flange_a.f = 0
  flange_b.f = 0
metadata {
  "Dyad": {"icons": {"default": "dyad://TranslationalComponents/RelativeStates.svg"}}
}
end


Test Cases

No test cases defined.