Function Repository Resource:

SystemsModelConnect

Source Notebook

Connect systems together using any inputs and outputs

Contributed by: Bob Sandheinrich

ResourceFunction["SystemsModelConnect"][{sys1,sys2,}]

merges the systems without creating any interconnections.

ResourceFunction["SystemsModelConnect"][{sys1,sys2,},connections]

gives a single systems model including the specified connections.

ResourceFunction["SystemsModelConnect"][{sys1,sys2,},connections,inputs,output]

includes only the specified inputs and outputs in the resulting systems model.

Details and Options

All systems models must share a common SamplingPeriod.
The result is a single systems model.
The resulting systems model will be the simplest type compatible with all the connected systems.
The connections are specified in a list {con1,con2,}, where each coni is given as {soi, outi}{sii,ini} where all the s, in and out values are integer indices based on the following table:
soi source system of the connection
outi output of soi to connect
sii target system of the connection
ini input of sii to connect
The inputs are each specified as a list {{s1,in1},}.
The outputs are each specified as a list {{s1,out1},}.
All can be used for inputs or outputs to include all inputs or outputs in the resulting system.

Examples

Basic Examples (2) 

A merged system connect like SystemsModelMerge:

In[1]:=
ResourceFunction[
 "SystemsModelConnect"][{TransferFunctionModel[{{{1}}, s \[Alpha]}, s], TransferFunctionModel[{{{b + s}}, a + s}, s]}]
Out[1]=

A series connection like SystemsModelSeriesConnect:

In[2]:=
ResourceFunction[
 "SystemsModelConnect"][{TransferFunctionModel[{{{1}}, s \[Alpha]}, s], TransferFunctionModel[{{{b + s}}, a + s}, s]}, {{1, 1} -> {2, 1}}, {{1, 1}}, {{2, 1}}]
Out[2]=

Scope (1) 

Connect several different types of systems:

In[3]:=
ResourceFunction[
 "SystemsModelConnect"][{StateSpaceModel[{{{Subscript[a, 11], Subscript[a, 12]}, {Subscript[a, 21], Subscript[a, 22]}}, {{Subscript[b, 11], Subscript[b, 12]}, {Subscript[b, 21],
       Subscript[b, 22]}}, {{Subscript[c, 11], Subscript[c, 12]}, {Subscript[c, 21], Subscript[c, 22]}}, {{0, 0}, {0, 0}}}, SamplingPeriod ->None, SystemsModelLabels -> None], TransferFunctionModel[{{{b + s}}, a + s}, s], NonlinearStateSpaceModel[ {{Subscript[f, 2][Subscript[x, 2], Subscript[u, 2]]}, {Subscript[x, 2]}}, {Subscript[x, 2]}, {Subscript[u, 2]}, {Automatic}, Automatic , SamplingPeriod -> None , SystemsModelLabels ->  {
{}, None, None}]}, {{1, 1} -> {2, 1}, {3, 1} -> {1, 2}, {2, 1} -> {3, 1}}, {{1, 1}}, {{3, 1}}]
Out[3]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 10 October 2018

License Information