Method of mdss.
Connect signals of an mdss model using index
matrices.
Source: src/model/@mdss/connectByIndices.m
sys = connectByIndices(sys, stateConnections, algebraicConnections, booleanConnections, similarInputs)connectByIndices wires inputs of a (previously appended)
mdss model to its states, algebraic variables and binaries.
Submodels must already be combined with append before
connecting.
Each connection is a row of an index matrix whose first entry is the input index and whose remaining entries are the target signal indices:
Every input index may be connected at most once across all three connection matrices; a repeated input raises an error.
similarInputs merges inputs that should be identical
into a single input: each row lists a primary input followed by the
inputs to merge into it, padded with zeros. For example
[2, 3, 5; 1, 4, 0] makes inputs 3 and 5 identical to input
2, and input 4 identical to input 1. An input cannot be both merged as
similar and directly connected.
After all connections are applied, input rows that have become
entirely empty are removed from the structure matrix, and the index
vectors, names, units and input-role vectors
(manipulatedVariable, measuredDisturbance,
unmeasuredDisturbance) are reindexed accordingly.
| Argument | Description |
|---|---|
sys |
The appended mdss model to connect. |
stateConnections |
(or wider) matrix of input-to-state connections; each row
[inputIdx, stateIdx, ...]. Use [] for
none. |
algebraicConnections |
Matrix of input-to-algebraic connections; each row
[inputIdx, algebraicIdx, ...]. Use [] for
none. |
booleanConnections |
Matrix of input-to-binary connections; each row
[inputIdx, binaryIdx, ...]. Use [] for
none. |
similarInputs |
Matrix of identical-input groups, each row
[primaryInput, dup1, dup2, ...] zero-padded. Use
[] for none. |
| Output | Description |
|---|---|
sys |
The model with the requested signals connected and emptied inputs removed. |
sys = connectByIndices(sys, [1, 1; 2, 3], [3, 1], [], [3, 4]);Input 1 is substituted into state 1, input 2 into state 3, input 3 into algebraic 1, and input 4 is merged as identical to input 3.
mdss · connectByNames
· connect · append · inputToAlgebraic
MyToolbox Documentation | Generated automatically by CI/CD pipeline