Skip to content
ForceSensor.md

ForceSensor

Ideal sensor measuring the translational force transmitted between two flanges.

This component models an ideal sensor that measures the translational force acting between its two mechanical flanges, flange_a and flange_b. It ensures the sensor body is perfectly rigid, meaning no relative displacement between the flanges. This is expressed by the equation:

flangea.s=flangeb.s

The force exerted at flange_a is directly measured and provided as the output signal f:

flangea.f=f

By Newton's third law, the force at flange_b is equal and opposite to the force at flange_a:

flangeb.f=flangea.f

This component extends from PartialRelativeSensor

Usage

ForceSensor()

Connectors

  • flange_a - (Flange)

  • flange_b - (Flange)

  • f - 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)flange_a.f(t)=f(t)

Source

dyad
# Ideal sensor measuring the translational force transmitted between two flanges.
#
# This component models an ideal sensor that measures the translational force acting between its two mechanical flanges, `flange_a` and `flange_b`.
# It ensures the sensor body is perfectly rigid, meaning no relative displacement between the flanges.
# This is expressed by the equation:
#
# ```math
# flange_a.s = flange_b.s
# ```
#
# The force exerted at `flange_a` is directly measured and provided as the output signal `f`:
#
# ```math
# flange_a.f = f
# ```
#
# By Newton's third law, the force at `flange_b` is equal and opposite to the force at `flange_a`:
#
# ```math
# flange_b.f = -flange_a.f
# ```
component ForceSensor
  extends PartialRelativeSensor
  # Force transmitted from `flange_a` to `flange_b` as output signal
  f = RealOutput() [{
    "Dyad": {
      "placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 90}}
    }
  }]
relations
  flange_a.s = flange_b.s
  flange_a.f = f
metadata {
  "Dyad": {"icons": {"default": "dyad://TranslationalComponents/RelativeSensor.svg"}}
}
end
Flattened Source
dyad
# Ideal sensor measuring the translational force transmitted between two flanges.
#
# This component models an ideal sensor that measures the translational force acting between its two mechanical flanges, `flange_a` and `flange_b`.
# It ensures the sensor body is perfectly rigid, meaning no relative displacement between the flanges.
# This is expressed by the equation:
#
# ```math
# flange_a.s = flange_b.s
# ```
#
# The force exerted at `flange_a` is directly measured and provided as the output signal `f`:
#
# ```math
# flange_a.f = f
# ```
#
# By Newton's third law, the force at `flange_b` is equal and opposite to the force at `flange_a`:
#
# ```math
# flange_b.f = -flange_a.f
# ```
component ForceSensor
  # 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}}}}]
  # Force transmitted from `flange_a` to `flange_b` as output signal
  f = 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
  flange_a.f = f
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