Skip to content
SpeedSensor.md

SpeedSensor

Ideal sensor that measures the absolute translational velocity of a mechanical flange.

This sensor provides the absolute velocity of its connected flange. The velocity v is determined by taking the time derivative of the flange's absolute position s. The governing equation is:

v=dflange.sdt

This component extends from PartialAbsoluteSensor

Usage

SpeedSensor()

Connectors

  • flange - (Flange)

  • v - This connector represents a real signal as an output from a component (RealOutput)

Behavior

0=flange.f(t)v(t)=dflange.s(t)dt

Source

dyad
# Ideal sensor that measures the absolute translational velocity of a mechanical flange.
#
# This sensor provides the absolute velocity of its connected `flange`.
# The velocity `v` is determined by taking the time derivative of the `flange`'s
# absolute position `s`. The governing equation is:
# ```math
# v = \frac{d flange.s}{dt}
# ```
component SpeedSensor
  extends PartialAbsoluteSensor
  # Absolute velocity of flange as output signal
  v = RealOutput() [{"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}]
relations
  v = der(flange.s)
metadata {
  "Dyad": {"icons": {"default": "dyad://TranslationalComponents/AbsoluteSensor.svg"}}
}
end
Flattened Source
dyad
# Ideal sensor that measures the absolute translational velocity of a mechanical flange.
#
# This sensor provides the absolute velocity of its connected `flange`.
# The velocity `v` is determined by taking the time derivative of the `flange`'s
# absolute position `s`. The governing equation is:
# ```math
# v = \frac{d flange.s}{dt}
# ```
component SpeedSensor
  # Mechanical flange connector through which the variable is sensed.
  flange = Flange() [{"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}]
  # Absolute velocity of flange as output signal
  v = RealOutput() [{"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}]
relations
  0 = flange.f
  v = der(flange.s)
metadata {
  "Dyad": {"icons": {"default": "dyad://TranslationalComponents/AbsoluteSensor.svg"}}
}
end


Test Cases

This is setup code, that must be run before each test case.

julia
using TranslationalComponents
using ModelingToolkit, OrdinaryDiffEqDefault
using Plots
using CSV, DataFrames

snapshotsdir = joinpath(dirname(dirname(pathof(TranslationalComponents))), "test", "snapshots")
"/home/actions-runner-10/.julia/packages/TranslationalComponents/khJb7/test/snapshots"