Skip to content
PowerSensor.md

PowerSensor

Measures the instantaneous rotational power transmitted between two mechanical rotational splines.

This component acts as an ideal sensor to determine the power flowing through a rotational mechanical connection. Relative angular displacement between its two connectors is zero.

phia=phib

The output signal, power, represents the instantaneous power. It is calculated as the product of the torque at spline_a and the angular velocity of spline_a. The angular velocity is the time derivative of the angle of spline_a (ϕ˙a) which corresponds to der(spline_a.phi) in the model's equations. The power is thus defined by the equation:

P=tauacdotdotphia

where P is the output power, τa is the torque at spline_a, and $\dot{\phi}_a$ is the angular velocity ofspline_a.

This component extends from PartialRelativeSensor

Usage

PowerSensor()

Connectors

  • spline_a - (Spline)

  • spline_b - (Spline)

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

Behavior

0=spline_b.tau(t)+spline_a.tau(t)spline_a.phi(t)=spline_b.phi(t)power(t)=spline_a.tau(t)dspline_a.phi(t)dt

Source

dyad
# Measures the instantaneous rotational power transmitted between two mechanical rotational splines.
#
# This component acts as an ideal sensor to determine the power flowing through a
# rotational mechanical connection. Relative angular displacement between its two
# connectors is zero.
# ```math
# \\phi_a = \\phi_b
# ```
# The output signal, `power`, represents the instantaneous power. It is calculated
# as the product of the torque at `spline_a` and the angular velocity of `spline_a`.
# The angular velocity is the time derivative of the angle of `spline_a`
# (\$\\dot{\\phi}_a\$) which corresponds to `der(spline_a.phi)` in the
# model's equations. The power is thus defined by the equation:
# ```math
# P = \\tau_a \\cdot \\dot{\\phi_a}
# ```
# where `P` is the output power, \$\tau_a\$ is the torque at `spline_a`, and \$\\dot{\\phi}_a\$ is the angular velocity of `spline_a`.
component PowerSensor
  extends PartialRelativeSensor
  # Power in spline `spline_a` as output signal
  power = RealOutput() [{
    "Dyad": {
      "placement": {"icon": {"x1": 100, "y1": 950, "x2": 200, "y2": 1050, "rot": 90}}
    }
  }]
relations
  spline_a.phi = spline_b.phi
  power = spline_a.tau*der(spline_a.phi)
metadata {
  "Dyad": {"icons": {"default": "dyad://RotationalComponents/Sensor-Power-Torque.svg"}}
}
end
Flattened Source
dyad
# Measures the instantaneous rotational power transmitted between two mechanical rotational splines.
#
# This component acts as an ideal sensor to determine the power flowing through a
# rotational mechanical connection. Relative angular displacement between its two
# connectors is zero.
# ```math
# \\phi_a = \\phi_b
# ```
# The output signal, `power`, represents the instantaneous power. It is calculated
# as the product of the torque at `spline_a` and the angular velocity of `spline_a`.
# The angular velocity is the time derivative of the angle of `spline_a`
# (\$\\dot{\\phi}_a\$) which corresponds to `der(spline_a.phi)` in the
# model's equations. The power is thus defined by the equation:
# ```math
# P = \\tau_a \\cdot \\dot{\\phi_a}
# ```
# where `P` is the output power, \$\tau_a\$ is the torque at `spline_a`, and \$\\dot{\\phi}_a\$ is the angular velocity of `spline_a`.
component PowerSensor
  # 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}}}}]
  # Power in spline `spline_a` as output signal
  power = RealOutput() [{
    "Dyad": {
      "placement": {"icon": {"x1": 100, "y1": 950, "x2": 200, "y2": 1050, "rot": 90}}
    }
  }]
relations
  0 = spline_a.tau+spline_b.tau
  spline_a.phi = spline_b.phi
  power = spline_a.tau*der(spline_a.phi)
metadata {
  "Dyad": {"icons": {"default": "dyad://RotationalComponents/Sensor-Power-Torque.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