Skip to content
LIBRARY
Examples.Mux.md

Examples.Mux ​

Concatenation of two signal vectors: the output y is u1 followed by u2. The race-car examples join the two track tables of the plant with it into the parameter input p of the controller.

Usage ​

MPCComponents.Examples.Mux()

Parameters: ​

NameDescriptionUnitsDefault value
n1Length of u1–1
n2Length of u2–1
nLength of y (derived)–n1 + n2

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 ​

Behavior of this component cannot be rendered because it includes path variables.

Source ​

dyad
"""
Concatenation of two signal vectors: the output `y` is `u1` followed by `u2`. The race-car examples
join the two track tables of the plant with it into the parameter input `p` of the controller.
"""
component Mux
  "First signal vector"
  u1 = [RealInput() for i in 1:n1] {
    "Dyad": {"placement": {"diagram": {"x1": -100, "x2": 0, "y1": 200, "y2": 300}}}
  }
  "Second signal vector"
  u2 = [RealInput() for i in 1:n2] {
    "Dyad": {"placement": {"diagram": {"x1": -100, "x2": 0, "y1": 700, "y2": 800}}}
  }
  "The concatenation of u1 and u2"
  y = [RealOutput() for i in 1:n] {
    "Dyad": {"placement": {"diagram": {"x1": 1000, "x2": 1100, "y1": 450, "y2": 550}}}
  }
  "Length of u1"
  structural parameter n1::Integer = 1
  "Length of u2"
  structural parameter n2::Integer = 1
  "Length of y (derived)"
  final structural parameter n::Integer = n1 + n2
relations
  for i in 1:n1
    y[i] = u1[i]
  end
  for i in 1:n2
    y[n1 + i] = u2[i]
  end
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MPCComponents/Mux.svg"},
    "doc": {"behavior": false}
  }
}
end
Flattened Source
dyad
"""
Concatenation of two signal vectors: the output `y` is `u1` followed by `u2`. The race-car examples
join the two track tables of the plant with it into the parameter input `p` of the controller.
"""
component Mux
  "First signal vector"
  u1 = [RealInput() for i in 1:n1] {
    "Dyad": {"placement": {"diagram": {"x1": -100, "x2": 0, "y1": 200, "y2": 300}}}
  }
  "Second signal vector"
  u2 = [RealInput() for i in 1:n2] {
    "Dyad": {"placement": {"diagram": {"x1": -100, "x2": 0, "y1": 700, "y2": 800}}}
  }
  "The concatenation of u1 and u2"
  y = [RealOutput() for i in 1:n] {
    "Dyad": {"placement": {"diagram": {"x1": 1000, "x2": 1100, "y1": 450, "y2": 550}}}
  }
  "Length of u1"
  structural parameter n1::Integer = 1
  "Length of u2"
  structural parameter n2::Integer = 1
  "Length of y (derived)"
  final structural parameter n::Integer = n1 + n2
relations
  for i in 1:n1
    y[i] = u1[i]
  end
  for i in 1:n2
    y[n1 + i] = u2[i]
  end
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MPCComponents/Mux.svg"},
    "doc": {"behavior": false}
  }
}
end


Test Cases ​

No test cases defined.

  • Examples

  • Experiments

  • Analyses