Skip to content
RelativeVelocitySensor.md

RelativeVelocitySensor

Ideal sensor for measuring the relative angular velocity between two rotational splines.

This component models an ideal sensor that measures the relative angular velocity between two mechanical rotational splines, named spline_a and spline_b The relative angle, ϕrel, is calculated as the difference between the absolute angles of these two splines:

phirel=phibphia

The primary output, wrel, which represents the relative angular velocity, is then determined by the time derivative of this relative angle:

wrel=dphireldt

The sensor is considered ideal as it does not exert any torque on the splines it measures.

This component extends from PartialRelativeSensor

Usage

RelativeVelocitySensor()

Connectors

  • spline_a - (Spline)

  • spline_b - (Spline)

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

Variables

NameDescriptionUnits
phi_relInternal variable representing the relative angle between spline_b and spline_a.rad

Behavior

0=spline_b.tau(t)+spline_a.tau(t)phi_rel(t)=spline_b.phi(t)spline_a.phi(t)w_rel(t)=dphi_rel(t)dt0=spline_a.tau(t)

Source

dyad
# Ideal sensor for measuring the relative angular velocity between two rotational splines.
#
# This component models an ideal sensor that measures the relative angular velocity
# between two mechanical rotational splines, named `spline_a` and `spline_b`
# The relative angle, \$\\phi_{rel}\$, is calculated as the difference
# between the absolute angles of these two splines:
# ```math
# \\phi_{rel} = \\phi_{b} - \\phi_{a}
# ```
# The primary output, \$w_{rel}\$, which represents the relative angular velocity,
# is then determined by the time derivative of this relative angle:
# ```math
# w_{rel} = \frac{d\\phi_{rel}}{dt}
# ```
# The sensor is considered ideal as it does not exert any torque on the splines
# it measures.
component RelativeVelocitySensor
  extends PartialRelativeSensor
  # Output signal representing the relative angular velocity between spline_b and spline_a.
  w_rel = RealOutput() [{
    "Dyad": {
      "placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 90}}
    }
  }]
  # Internal variable representing the relative angle between spline_b and spline_a.
  variable phi_rel::Angle
relations
  phi_rel = spline_b.phi-spline_a.phi
  w_rel = der(phi_rel)
  0 = spline_a.tau
metadata {
  "Dyad": {
    "icons": {"default": "dyad://RotationalComponents/RelSensor-Angle-Vel-Acc.svg"}
  }
}
end
Flattened Source
dyad
# Ideal sensor for measuring the relative angular velocity between two rotational splines.
#
# This component models an ideal sensor that measures the relative angular velocity
# between two mechanical rotational splines, named `spline_a` and `spline_b`
# The relative angle, \$\\phi_{rel}\$, is calculated as the difference
# between the absolute angles of these two splines:
# ```math
# \\phi_{rel} = \\phi_{b} - \\phi_{a}
# ```
# The primary output, \$w_{rel}\$, which represents the relative angular velocity,
# is then determined by the time derivative of this relative angle:
# ```math
# w_{rel} = \frac{d\\phi_{rel}}{dt}
# ```
# The sensor is considered ideal as it does not exert any torque on the splines
# it measures.
component RelativeVelocitySensor
  # 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}}}}]
  # Output signal representing the relative angular velocity between spline_b and spline_a.
  w_rel = RealOutput() [{
    "Dyad": {
      "placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 90}}
    }
  }]
  # Internal variable representing the relative angle between spline_b and spline_a.
  variable phi_rel::Angle
relations
  0 = spline_a.tau+spline_b.tau
  phi_rel = spline_b.phi-spline_a.phi
  w_rel = der(phi_rel)
  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.

julia
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"
  • Examples

  • Experiments

  • Analyses