PositionSensor
Measures the absolute linear position of a mechanical translational flange.
This sensor provides the absolute translational position of its connection point. It inherits from PartialAbsoluteSensor
, which defines a mechanical translational flange
. The sensor's RealOutput
signal, named s
, directly reflects the position variable s
associated with this flange
. The fundamental behavior is captured by the equation:
Here, the s
on the left side of the equation is the sensor's output signal, and flange.s
is the position variable of the connector inherited from PartialAbsoluteSensor
.
This component extends from PartialAbsoluteSensor
Usage
PositionSensor()
Connectors
flange
- (Flange
)s
- This connector represents a real signal as an output from a component (RealOutput
)
Behavior
Source
# Measures the absolute linear position of a mechanical translational flange.
#
# This sensor provides the absolute translational position of its connection point.
# It inherits from `PartialAbsoluteSensor`, which defines a mechanical
# translational `flange`. The sensor's `RealOutput` signal, named `s`, directly
# reflects the position variable `s` associated with this `flange`.
# The fundamental behavior is captured by the equation:
# ```math
# s = flange.s
# ```
# Here, the `s` on the left side of the equation is the sensor's output signal,
# and `flange.s` is the position variable of the connector inherited from
# `PartialAbsoluteSensor`.
component PositionSensor
extends PartialAbsoluteSensor
# Output signal representing the measured absolute position
s = RealOutput() [{"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}]
relations
flange.s = s
metadata {
"Dyad": {"icons": {"default": "dyad://TranslationalComponents/AbsoluteSensor.svg"}}
}
end
Flattened Source
# Measures the absolute linear position of a mechanical translational flange.
#
# This sensor provides the absolute translational position of its connection point.
# It inherits from `PartialAbsoluteSensor`, which defines a mechanical
# translational `flange`. The sensor's `RealOutput` signal, named `s`, directly
# reflects the position variable `s` associated with this `flange`.
# The fundamental behavior is captured by the equation:
# ```math
# s = flange.s
# ```
# Here, the `s` on the left side of the equation is the sensor's output signal,
# and `flange.s` is the position variable of the connector inherited from
# `PartialAbsoluteSensor`.
component PositionSensor
# 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 measured absolute position
s = RealOutput() [{"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}]
relations
0 = flange.f
flange.s = s
metadata {
"Dyad": {"icons": {"default": "dyad://TranslationalComponents/AbsoluteSensor.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