RelativeAngleSensor
Ideal sensor to measure the relative angle between two splines.
This component computes the difference between the angle of spline_b
(denoted spline_a
(denoted $\phi_a$). This difference is provided as the output signalphi_rel
. It models an ideal sensor, ensuring it does not influence the dynamics of the connected mechanical system. This is achieved by enforcing that the torque exerted onspline_a
(denoted
This component extends from PartialRelativeSensor
Usage
RelativeAngleSensor()
Connectors
spline_a
- (Spline
)spline_b
- (Spline
)phi_rel
- This connector represents a real signal as an output from a component (RealOutput
)
Behavior
Source
# Ideal sensor to measure the relative angle between two splines.
#
# This component computes the difference between the angle of `spline_b` (denoted \$\\phi_b\$)
# and the angle of `spline_a` (denoted \$\\phi_a\$). This difference is provided as the output
# signal `phi_rel`. It models an ideal sensor, ensuring it does not influence the
# dynamics of the connected mechanical system. This is achieved by enforcing that the
# torque exerted on `spline_a` (denoted \$\tau_a\$) is zero.
# The governing equations are:
# ```math
# \\phi_{rel} = \\phi_b - \\phi_a
# ```
# ```math
# \tau_a = 0
# ```
component RelativeAngleSensor
extends PartialRelativeSensor
# Relative angle between two splines as output signal
phi_rel = RealOutput() [{
"Dyad": {
"placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 90}}
}
}]
relations
phi_rel = spline_b.phi-spline_a.phi
0 = spline_a.tau
metadata {
"Dyad": {
"icons": {"default": "dyad://RotationalComponents/RelSensor-Angle-Vel-Acc.svg"}
}
}
end
Flattened Source
# Ideal sensor to measure the relative angle between two splines.
#
# This component computes the difference between the angle of `spline_b` (denoted \$\\phi_b\$)
# and the angle of `spline_a` (denoted \$\\phi_a\$). This difference is provided as the output
# signal `phi_rel`. It models an ideal sensor, ensuring it does not influence the
# dynamics of the connected mechanical system. This is achieved by enforcing that the
# torque exerted on `spline_a` (denoted \$\tau_a\$) is zero.
# The governing equations are:
# ```math
# \\phi_{rel} = \\phi_b - \\phi_a
# ```
# ```math
# \tau_a = 0
# ```
component RelativeAngleSensor
# Left spline connector for the sensor.
spline_a = Spline() [{"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}]
# Right spline connector for the sensor.
spline_b = Spline() [{"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}]
# Relative angle between two splines as output signal
phi_rel = RealOutput() [{
"Dyad": {
"placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 90}}
}
}]
relations
0 = spline_a.tau+spline_b.tau
phi_rel = spline_b.phi-spline_a.phi
0 = spline_a.tau
metadata {
"Dyad": {
"icons": {"default": "dyad://RotationalComponents/RelSensor-Angle-Vel-Acc.svg"}
}
}
end
Test Cases
This is setup code, that must be run before each test case.
using RotationalComponents
using ModelingToolkit, OrdinaryDiffEqDefault
using Plots
using CSV, DataFrames
snapshotsdir = joinpath(dirname(dirname(pathof(RotationalComponents))), "test", "snapshots")
"/home/actions-runner-10/.julia/packages/RotationalComponents/0VPxm/test/snapshots"
Related
Examples
Experiments
Analyses