Skip to content
ReverseCausality.md

ReverseCausality

Forces equality between two input signals by computing an implicit output.

The way to think about this component is that it computes an output (implicitly) such that the two inputs are equal. To do this, it must be possible for the output to affect at least one of the inputs somehow. This component supports model inversion scenarios where one of the outputs is prescribed and the system works backward to solve for one of the inputs.

This component extends from BlockComponents.SI2SO

Usage

ReverseCausality()

Connectors

  • u1 - This connector represents a real signal as an input to a component (RealInput)

  • u2 - This connector represents a real signal as an input to a component (RealInput)

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

Behavior

u1(t)=u2(t)

Source

dyad
# Forces equality between two input signals by computing an implicit output.
#
# The way to think about this component is that it computes an output (implicitly)
# such that the two inputs are equal.  To do this, it must be possible for the output
# to affect at least one of the inputs somehow.  This component supports model
# inversion scenarios where one of the outputs is prescribed and the system works
# backward to solve for one of the inputs.
component ReverseCausality
  extends BlockComponents.SI2SO
relations
  # Enforces equality between the two input signals
  u1 = u2
end
Flattened Source
dyad
# Forces equality between two input signals by computing an implicit output.
#
# The way to think about this component is that it computes an output (implicitly)
# such that the two inputs are equal.  To do this, it must be possible for the output
# to affect at least one of the inputs somehow.  This component supports model
# inversion scenarios where one of the outputs is prescribed and the system works
# backward to solve for one of the inputs.
component ReverseCausality
  # First real-valued input signal
  u1 = RealInput() [{"Dyad": {"placement": {"icon": {"x1": -50, "y1": 150, "x2": 50, "y2": 250}}}}]
  # Second real-valued input signal
  u2 = RealInput() [{"Dyad": {"placement": {"icon": {"x1": -50, "y1": 750, "x2": 50, "y2": 850}}}}]
  # Real-valued output signal
  y = RealOutput() [{"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}]
relations
  # Enforces equality between the two input signals
  u1 = u2
metadata {}
end


Test Cases

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

julia
using BlockComponents
using ModelingToolkit, OrdinaryDiffEqDefault
using Plots
using CSV, DataFrames

snapshotsdir = joinpath(dirname(dirname(pathof(BlockComponents))), "test", "snapshots")
"/home/actions-runner-10/.julia/packages/BlockComponents/77kIK/test/snapshots"
  • Examples

  • Experiments

  • Analyses