Skip to content
PartialRelativeSensor.md

PartialRelativeSensor

Base two-port element for relative sensing, ensuring conservation of flow between its connection points.

This partial component acts as a base for creating sensors that measure a physical quantity at flange_b with respect to flange_a. It includes two Flange connectors: flange_a, typically serving as the negative or reference connection, and flange_b, serving as the positive or measurement connection. The core behavior is defined by the conservation equation in the relations section, which mandates that the sum of flow variables (f) at these flanges is zero:

flangea.f+flangeb.f=0

This is equivalent to math flange_a.f = -flange_b.f, signifying that the sensor does not accumulate or dissipate the quantity represented by f (e.g., current, fluid flow). Sensors derived from this partial model would typically add equations to report a measured potential difference (like voltage or pressure) between flange_b and flange_a.

Usage

PartialRelativeSensor()

Connectors

Source

dyad
# Base two-port element for relative sensing, ensuring conservation of flow between its connection points.
#
# This `partial component` acts as a base for creating sensors that measure a physical quantity at `flange_b` with respect to `flange_a`.
# It includes two `Flange` connectors: `flange_a`, typically serving as the negative or reference connection, and `flange_b`,
# serving as the positive or measurement connection. The core behavior is defined by the conservation equation
# in the `relations` section, which mandates that the sum of flow variables (`f`) at these flanges is zero:
# ```math
# flange_a.f + flange_b.f = 0
# ```
# This is equivalent to ```math flange_a.f = -flange_b.f ```, signifying that the sensor does not accumulate
# or dissipate the quantity represented by `f` (e.g., current, fluid flow). Sensors derived from this
# partial model would typically add equations to report a measured potential difference (like voltage or pressure)
# between `flange_b` and `flange_a`.
partial component PartialRelativeSensor
  # 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}}}}]
relations
  0 = flange_a.f+flange_b.f
end
Flattened Source
dyad
# Base two-port element for relative sensing, ensuring conservation of flow between its connection points.
#
# This `partial component` acts as a base for creating sensors that measure a physical quantity at `flange_b` with respect to `flange_a`.
# It includes two `Flange` connectors: `flange_a`, typically serving as the negative or reference connection, and `flange_b`,
# serving as the positive or measurement connection. The core behavior is defined by the conservation equation
# in the `relations` section, which mandates that the sum of flow variables (`f`) at these flanges is zero:
# ```math
# flange_a.f + flange_b.f = 0
# ```
# This is equivalent to ```math flange_a.f = -flange_b.f ```, signifying that the sensor does not accumulate
# or dissipate the quantity represented by `f` (e.g., current, fluid flow). Sensors derived from this
# partial model would typically add equations to report a measured potential difference (like voltage or pressure)
# between `flange_b` and `flange_a`.
partial component PartialRelativeSensor
  # 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}}}}]
relations
  0 = flange_a.f+flange_b.f
metadata {}
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