Skip to content
PowerSensor.md

PowerSensor

Ideal sensor measuring the translational power flowing through a point.

This component measures the instantaneous mechanical translational power. It is intended to measure power calculated at flange_a. The sensor is ideal: it does not dissipate energy or introduce any mechanical impedance beyond its defining equations. A key characteristic is the constraint flangea.s=flangeb.s, which means both flanges share the same position and, consequently, the same velocity. The sensor thus measures the power flowing through the connection point flange_a, while flange_b serves to complete the mechanical path with identical motion. The measured power P is defined as:

P=Fv

math

where F corresponds to the force flange_a.f at flange_a and v corresponds to the velocity der(flange_a.s) of flange_a.

This component extends from PartialRelativeSensor

Usage

PowerSensor()

Connectors

  • flange_a - (Flange)

  • flange_b - (Flange)

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

Behavior

0=flange_b.f(t)+flange_a.f(t)flange_a.s(t)=flange_b.s(t)power(t)=dflange_a.s(t)dtflange_a.f(t)

Source

dyad
# Ideal sensor measuring the translational power flowing through a point.
#
# This component measures the instantaneous mechanical translational power.
# It is intended to measure power calculated at `flange_a`.
# The sensor is ideal: it does not dissipate energy or introduce any mechanical impedance beyond its defining equations.
# A key characteristic is the constraint $flange_a.s = flange_b.s$, which means
# both flanges share the same position and, consequently, the same velocity.
# The sensor thus measures the power flowing through the connection point `flange_a`,
# while `flange_b` serves to complete the mechanical path with identical motion.
# The measured power $P$ is defined as:
#
# ```math
# P = F \cdot v
# ```math
#
# where $F$ corresponds to the force `flange_a.f` at `flange_a` and $v$ corresponds
# to the velocity `der(flange_a.s)` of `flange_a`.
component PowerSensor
  extends PartialRelativeSensor
  # Output signal representing the measured power, calculated as power in flange `flange_a`.
  power = RealOutput() [{
    "Dyad": {
      "placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 90}}
    }
  }]
relations
  flange_a.s = flange_b.s
  power = flange_a.f*der(flange_a.s)
metadata {
  "Dyad": {"icons": {"default": "dyad://TranslationalComponents/RelativeSensor.svg"}}
}
end
Flattened Source
dyad
# Ideal sensor measuring the translational power flowing through a point.
#
# This component measures the instantaneous mechanical translational power.
# It is intended to measure power calculated at `flange_a`.
# The sensor is ideal: it does not dissipate energy or introduce any mechanical impedance beyond its defining equations.
# A key characteristic is the constraint $flange_a.s = flange_b.s$, which means
# both flanges share the same position and, consequently, the same velocity.
# The sensor thus measures the power flowing through the connection point `flange_a`,
# while `flange_b` serves to complete the mechanical path with identical motion.
# The measured power $P$ is defined as:
#
# ```math
# P = F \cdot v
# ```math
#
# where $F$ corresponds to the force `flange_a.f` at `flange_a` and $v$ corresponds
# to the velocity `der(flange_a.s)` of `flange_a`.
component PowerSensor
  # 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}}}}]
  # Output signal representing the measured power, calculated as power in flange `flange_a`.
  power = RealOutput() [{
    "Dyad": {
      "placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 90}}
    }
  }]
relations
  0 = flange_a.f+flange_b.f
  flange_a.s = flange_b.s
  power = flange_a.f*der(flange_a.s)
metadata {
  "Dyad": {"icons": {"default": "dyad://TranslationalComponents/RelativeSensor.svg"}}
}
end


Test Cases

This is setup code, that must be run before each test case.

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

  • Experiments

  • Analyses