Skip to content
AccelerationSensor.md

AccelerationSensor

Ideal sensor measuring the absolute translational acceleration of a flange.

This component measures the absolute acceleration of its connected flange. It first determines the absolute velocity of the flange by taking the time derivative of the flange's absolute position (flange.s). The absolute acceleration is then computed as the time derivative of this velocity. The governing equations are:

v=d(flange.s)dta=dvdt=d2(flange.s)dt2

where v is the internal absolute velocity variable and a is the output signal representing the absolute acceleration. The position flange.s is accessed via the flange.s variable, with the flange itself being inherited from PartialAbsoluteSensor.

This component extends from PartialAbsoluteSensor

Usage

AccelerationSensor()

Connectors

  • flange - (Flange)

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

Variables

NameDescriptionUnits
vInternal variable representing the absolute velocity of the flangem/s

Behavior

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

Source

dyad
# Ideal sensor measuring the absolute translational acceleration of a flange.
#
# This component measures the absolute acceleration of its connected flange.
# It first determines the absolute velocity of the flange by taking the time derivative
# of the flange's absolute position ($\text{flange.s}$). The absolute acceleration
# is then computed as the time derivative of this velocity.
# The governing equations are:
# ```math
# \begin{align*}
# v &= \frac{d(\text{flange.s})}{dt} \\
# a = \frac{dv}{dt} &= \frac{d^2({\text{flange.s}})}{dt^2}
# \end{align*}
# ```
# where $v$ is the internal absolute velocity variable and $a$ is the
# output signal representing the absolute acceleration. The position $\text{flange.s}$
# is accessed via the `flange.s` variable, with the `flange` itself being inherited from `PartialAbsoluteSensor`.
component AccelerationSensor
  extends PartialAbsoluteSensor
  # Output signal representing the absolute acceleration of the flange
  a = RealOutput() [{"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}]
  # Internal variable representing the absolute velocity of the flange
  variable v::Velocity
relations
  v = der(flange.s)
  a = der(v)
metadata {
  "Dyad": {"icons": {"default": "dyad://TranslationalComponents/AbsoluteSensor.svg"}}
}
end
Flattened Source
dyad
# Ideal sensor measuring the absolute translational acceleration of a flange.
#
# This component measures the absolute acceleration of its connected flange.
# It first determines the absolute velocity of the flange by taking the time derivative
# of the flange's absolute position ($\text{flange.s}$). The absolute acceleration
# is then computed as the time derivative of this velocity.
# The governing equations are:
# ```math
# \begin{align*}
# v &= \frac{d(\text{flange.s})}{dt} \\
# a = \frac{dv}{dt} &= \frac{d^2({\text{flange.s}})}{dt^2}
# \end{align*}
# ```
# where $v$ is the internal absolute velocity variable and $a$ is the
# output signal representing the absolute acceleration. The position $\text{flange.s}$
# is accessed via the `flange.s` variable, with the `flange` itself being inherited from `PartialAbsoluteSensor`.
component AccelerationSensor
  # 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 absolute acceleration of the flange
  a = RealOutput() [{"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}]
  # Internal variable representing the absolute velocity of the flange
  variable v::Velocity
relations
  0 = flange.f
  v = der(flange.s)
  a = der(v)
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"