RelativeAccelerationSensor
Ideal sensor measuring the relative acceleration between two translational flanges.
This sensor determines the acceleration of flange_b
with respect to flange_a
(where s_a
and s_b
in the equations below refer to flange_a.s
and flange_b.s
respectively). It operates by first calculating the relative displacement, flange_a
is defined as zero, ensuring no mechanical load is introduced by the sensor.
This component extends from PartialRelativeSensor
Usage
RelativeAccelerationSensor()
Connectors
flange_a
- (Flange
)flange_b
- (Flange
)a_rel
- This connector represents a real signal as an output from a component (RealOutput
)
Variables
Name | Description | Units |
---|---|---|
s_rel | Relative position of flange_b relative to flange_a | m |
v_rel | Relative velocity of flange_b relative to flange_a | m/s |
Behavior
Source
# Ideal sensor measuring the relative acceleration between two translational flanges.
#
# This sensor determines the acceleration of `flange_b` with respect to `flange_a`
# (where `s_a` and `s_b` in the equations below refer to `flange_a.s` and `flange_b.s`
# respectively). It operates by first calculating the relative displacement,
# $s_{rel} = s_b - s_a$. This relative displacement is then differentiated with
# respect to time to obtain the relative velocity, $v_{rel} = \frac{d(s_{rel})}{dt}$.
# Finally, the relative velocity is differentiated with respect to time to yield the
# relative acceleration, $a_{rel} = \frac{d(v_{rel})}{dt}$. The sensor is ideal,
# meaning it does not exert any force on the connected components; specifically, the force at
# `flange_a` is defined as zero, ensuring no mechanical load is introduced by the sensor.
component RelativeAccelerationSensor
extends PartialRelativeSensor
# Relative acceleration of `flange_b` relative to `flange_a` as output signal
a_rel = RealOutput() [{
"Dyad": {
"placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 90}}
}
}]
# Relative position of `flange_b` relative to `flange_a`
variable s_rel::Distance
# Relative velocity of `flange_b` relative to `flange_a`
variable v_rel::Velocity
relations
s_rel = flange_b.s-flange_a.s
v_rel = der(s_rel)
a_rel = der(v_rel)
0 = flange_a.f
metadata {
"Dyad": {"icons": {"default": "dyad://TranslationalComponents/RelativeSensor.svg"}}
}
end
Flattened Source
# Ideal sensor measuring the relative acceleration between two translational flanges.
#
# This sensor determines the acceleration of `flange_b` with respect to `flange_a`
# (where `s_a` and `s_b` in the equations below refer to `flange_a.s` and `flange_b.s`
# respectively). It operates by first calculating the relative displacement,
# $s_{rel} = s_b - s_a$. This relative displacement is then differentiated with
# respect to time to obtain the relative velocity, $v_{rel} = \frac{d(s_{rel})}{dt}$.
# Finally, the relative velocity is differentiated with respect to time to yield the
# relative acceleration, $a_{rel} = \frac{d(v_{rel})}{dt}$. The sensor is ideal,
# meaning it does not exert any force on the connected components; specifically, the force at
# `flange_a` is defined as zero, ensuring no mechanical load is introduced by the sensor.
component RelativeAccelerationSensor
# Negative connection flange of the sensor, often considered the reference point.
flange_a = Flange() [{"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}]
# Positive connection flange of the sensor, where the measurement is taken relative to flange_a.
flange_b = Flange() [{"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}]
# Relative acceleration of `flange_b` relative to `flange_a` as output signal
a_rel = RealOutput() [{
"Dyad": {
"placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 90}}
}
}]
# Relative position of `flange_b` relative to `flange_a`
variable s_rel::Distance
# Relative velocity of `flange_b` relative to `flange_a`
variable v_rel::Velocity
relations
0 = flange_a.f+flange_b.f
s_rel = flange_b.s-flange_a.s
v_rel = der(s_rel)
a_rel = der(v_rel)
0 = flange_a.f
metadata {
"Dyad": {"icons": {"default": "dyad://TranslationalComponents/RelativeSensor.svg"}}
}
end
Test Cases
This is setup code, that must be run before each test case.
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"
Related
Examples
Experiments
Analyses
Tests