s_rel$(instance)RelativePositionSensor Icon

RelativePositionSensor

Ideal sensor to measure the position of flange_b relative to flange_a

This component extends from PartialRelativeSensor

Usage

RelativePositionSensor()

Connectors

  • flange_a - (Flange)
  • flange_b - (Flange)
  • s_rel - This connector represents a real signal as an output from a component (RealOutput)

Behavior

\[ \begin{align} 0 &= \mathtt{flange\_b.f}\left( t \right) + \mathtt{flange\_a.f}\left( t \right) \\ \mathtt{s\_rel}\left( t \right) &= \mathtt{flange\_b.s}\left( t \right) - \mathtt{flange\_a.s}\left( t \right) \\ 0 &= \mathtt{flange\_a.f}\left( t \right) \end{align} \]

Source

# Ideal sensor to measure the position of `flange_b` relative to `flange_a`
component RelativePositionSensor
  extends PartialRelativeSensor
  # Relative position of `flange_b` relative to `flange_a` as output signal
  s_rel = RealOutput() [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 90}}
    }
  }]
relations
  s_rel = flange_b.s-flange_a.s
  0 = flange_a.f
metadata {
  "JuliaSim": {"icons": {"default": "jsml://TranslationalComponents/RelativeSensor.svg"}}
}
end
Flattened Source
# Ideal sensor to measure the position of `flange_b` relative to `flange_a`
component RelativePositionSensor
  flange_a = Flange() [{
    "JuliaSim": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}
  }]
  flange_b = Flange() [{
    "JuliaSim": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}
  }]
  # Relative position of `flange_b` relative to `flange_a` as output signal
  s_rel = RealOutput() [{
    "JuliaSim": {
      "placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 90}}
    }
  }]
relations
  0 = flange_a.f+flange_b.f
  s_rel = flange_b.s-flange_a.s
  0 = flange_a.f
metadata {
  "JuliaSim": {"icons": {"default": "jsml://TranslationalComponents/RelativeSensor.svg"}}
}
end

Test Cases