Skip to content
LIBRARY
Concat3.md

Concat3

Three-way array concatenation. Takes three array inputs of structural sizes n1, n2, n3 and produces a single output array of size n1 + n2 + n3 whose elements are [u1; u2; u3] in order. Used in LQRControlledRotorCraft to assemble the 13-element measurement vector.

Usage

MultibodyComponents.Concat3()

Parameters:

NameDescriptionUnitsDefault value
n1Length of the first input array1
n2Length of the second input array1
n3Length of the third input array1
nsumTotal output length (= n1 + n2 + n3); named because Dyad array sizes can't be compound expressionsn1 + n2 + n3

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)

  • u3 - 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

Source

dyad
"""
Three-way array concatenation. Takes three array inputs of structural sizes
`n1`, `n2`, `n3` and produces a single output array of size `n1 + n2 + n3`
whose elements are `[u1; u2; u3]` in order. Used in `LQRControlledRotorCraft`
to assemble the 13-element measurement vector.
"""
component Concat3
  "First input array (occupies indices 1..n1 of `y`)"
  u1 = [RealInput() for i in 1:n1] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 170, "x2": 0, "y2": 270, "rot": 0}
      },
      "tags": []
    }
  }
  "Second input array (occupies indices n1+1..n1+n2 of `y`)"
  u2 = [RealInput() for i in 1:n2] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Third input array (occupies indices n1+n2+1..n1+n2+n3 of `y`)"
  u3 = [RealInput() for i in 1:n3] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 730, "x2": 0, "y2": 830, "rot": 0}
      },
      "tags": []
    }
  }
  "Concatenated output array of length nsum"
  y = [RealOutput() for i in 1:nsum] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Length of the first input array"
  structural parameter n1::Integer = 1
  "Length of the second input array"
  structural parameter n2::Integer = 1
  "Length of the third input array"
  structural parameter n3::Integer = 1
  "Total output length (= n1 + n2 + n3); named because Dyad array sizes can't be compound expressions"
  final structural parameter nsum::Integer = n1 + n2 + n3
relations
  for i in 1:n1
    y[i] = u1[i]
  end
  for i in 1:n2
    y[n1 + i] = u2[i]
  end
  for i in 1:n3
    y[n1 + n2 + i] = u3[i]
  end
end
Flattened Source
dyad
"""
Three-way array concatenation. Takes three array inputs of structural sizes
`n1`, `n2`, `n3` and produces a single output array of size `n1 + n2 + n3`
whose elements are `[u1; u2; u3]` in order. Used in `LQRControlledRotorCraft`
to assemble the 13-element measurement vector.
"""
component Concat3
  "First input array (occupies indices 1..n1 of `y`)"
  u1 = [RealInput() for i in 1:n1] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 170, "x2": 0, "y2": 270, "rot": 0}
      },
      "tags": []
    }
  }
  "Second input array (occupies indices n1+1..n1+n2 of `y`)"
  u2 = [RealInput() for i in 1:n2] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Third input array (occupies indices n1+n2+1..n1+n2+n3 of `y`)"
  u3 = [RealInput() for i in 1:n3] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 730, "x2": 0, "y2": 830, "rot": 0}
      },
      "tags": []
    }
  }
  "Concatenated output array of length nsum"
  y = [RealOutput() for i in 1:nsum] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Length of the first input array"
  structural parameter n1::Integer = 1
  "Length of the second input array"
  structural parameter n2::Integer = 1
  "Length of the third input array"
  structural parameter n3::Integer = 1
  "Total output length (= n1 + n2 + n3); named because Dyad array sizes can't be compound expressions"
  final structural parameter nsum::Integer = n1 + n2 + n3
relations
  for i in 1:n1
    y[i] = u1[i]
  end
  for i in 1:n2
    y[n1 + i] = u2[i]
  end
  for i in 1:n3
    y[n1 + n2 + i] = u3[i]
  end
metadata {}
end


Test Cases

No test cases defined.

  • Examples

  • Experiments

  • Analyses