Method of mdss.
Connect the signals of one or more mdss models.
Source: src/model/@mdss/connect.m
sys = connect(sys)
sys = connect(sys, stateConnections, algebraicConnections, booleanConnections, similarInputs)
sys = connect(sys1, sys2, ..., sysN)connect wires model inputs to other
signals (states, algebraic or binary variables). Each input can be
connected only once. After connecting, a trivialReduction
removes the equations and variables that have become trivial.
There are three call forms:
| Form | Behaviour |
|---|---|
connect(sys) |
Connect an already-appended
model by signal names — see connectByNames. |
connect(sys, stateConnections, algebraicConnections, booleanConnections, similarInputs) |
Connect an appended model by index matrices — see
connectByIndices. |
connect(sys1, …, sysN) |
Append the models, then connect them by signal names. |
Each connection matrix has one row per connection,
[inputIdx, variableIdx, ...], with the input index first
and the target signal index(es) after:
u = var1 + var2 + ….u = -var1 + var2.similarInputs merges duplicate inputs: each row lists
input positions that are identical, e.g. [2 3 5; 1 4 0]
(input 2≡3≡5, input 1≡4, 0 pads the row).
Set matching names on the signals to be joined, then let
connect append and wire them:
room = stringParser.symbolicToMdss("0 = -m*xp1 + u1 + u2", 0, ...
["xp","x","u","y","z"], "m", 1200);
room.inputName = ["heatSupply", "heatLoss"];
loss = stringParser.symbolicToMdss("y1 = k*(u1 - u2)", 0, ...
["xp","x","u","y","z"], "k", 3);
loss.algebraicName = "heatLoss";
loss.inputName = ["ambientTemp", "roomTemp"];
sys = connect(room, loss); % room input "heatLoss" ↔ loss algebraic "heatLoss"State and algebraic names must be unique; duplicate input names are merged as similar inputs automatically.
After append,
connect by position instead of name:
sys = append(room, loss);
% connect input 2 of the combined model to its algebraic variable 1:
sys = connect(sys, [], [2 1], [], []);| Output | Description |
|---|---|
sys |
The connected model, after wiring the requested signals and running
trivialReduction. |
append · connectByNames
· connectByIndices
· trivialReduction
· mdss
MyToolbox Documentation | Generated automatically by CI/CD pipeline