DynamicSystems
SystemConnect
determine the equivalent system representation of two or more interconnected system objects
Calling Sequence
Parameters
Options
Description
Examples
SystemConnect(systems, opts)
SystemConnect(systems, ui, oi, uy, oy, opts)
systems
-
System; list of System objects
ui
(optional) Matrix; maps the global inputs to the subsystem inputs
oi
(optional) Matrix; maps the subsystem outputs to the subsystem inputs
uy
(optional) Matrix; maps the global inputs to the global outputs
oy
(optional) Matrix; maps the subsystem outputs to the global outputs
opts
(optional) equation(s) of the form option = value; specify options for the SystemConnect command.
outputtype = tf, coeff, zpk, ss, or de
Specifies the subtype of the returned system object. The default return type is based on the type of the system objects specified in the systems parameter. See the Description section for more details on the return type.
connection = serial, parallel, append, negativefeedback, positivefeedback, or feedforward
Automatically creates the required connection matrices for certain canonical system interconnections. When this option is specified, the matrices ui, oi, uy, and oy are not required.
serial : The subsystems are connected in order, matching the outputs of the previous subsystem to the inputs of the next subsystem.
parallel : The subsystems are connected in parallel, each subsystem being fed the same input with their outputs summed to obtain the final output.
append : The subsystems are combined such that each subsystem receives its own inputs from the outside world and its outputs are exposed directly to the outside world.
negativefeedback, positivefeedback : One or two systems may be specified using the systems parameter. The first subsystem is in the forward path, and the second subsystem is placed in the feedback loop. The second system is assumed to be a unity gain if it is not specified. If negativefeedback is specified, the input to the first system is the subtraction of the external input from the output to the second system. If positivefeedback is specified, it is the addition.
feedforward : The input is added to the output of the given system. Only defined for use with one system.
merge = keep, evaluate, or replace
Specifies how parameters from different systems are merged. The default is keep.
keep: keep the original parameters. The value for a parameter is the value assigned by the first system that defines it.
evaluate: replace all parameters in the systems with their assigned values.
replace: replace each parameter in a system with a distinct parameter created by appending an index from the param_indices options. For example, the parameter P of the first system becomes P1.
indices = list
Used when merge is replace. The k-th element of the list is appended, as an index, to each parameter name of the k-th system. The number of elements must match the number of systems. The default is the positive integers, with 1 corresponding to the first subsystem.
The SystemConnect command allows you to create complex interconnections between multiple system objects representing a set of subsystems to produce the equivalent system object in a block diagram simplification type procedure.
The inputs to the subsystems specified in the parameter systems are generated as a linear combination of the external inputs which feed into the equivalent system and the subsystem outputs which are fed back. The mapping of the external inputs to the subsystem inputs is defined by the ui matrix and the mapping of the subsystem output to the subsystem inputs is defined by the oi matrix. The number of rows in the ui matrix is determined by the number of subsystem inputs (the sum of the number of inputs for each system in the systems) and the number of columns by the number of external inputs to the equivalent system. The number of rows in the oi matrix is likewise determined by the number of subsystem inputs and the number of columns is determined by the number of subsystem outputs.
The outputs of the equivalent system are formed in a similar manner to the inputs. The external outputs are a linear combination of the external inputs which feed directly through the equivalent system and the subsystem outputs. The mapping of the external inputs to the external outputs is defined by the uy matrix and the mapping of the subsystem outputs to the external outputs is defined by the oy matrix. The number of rows in the oy matrix is determined by the number of external outputs of the equivalent system and the number of columns by the number of outputs of the subsystems (the sum of the number of outputs on each system in the systems). The number of rows in the uy matrix is likewise determined by the number of external outputs of the equivalent system and the number of columns is determined by the number of external inputs in the equivalent system.
An entry of 1 in the connection matrices represents a simple connection. Non-unity entries represent gains in the connection path. Negative feedback is achieved by setting the appropriate entry or entries to -1.
The type of the system object output by SystemConnect is determined by the type of the system objects specified in the systems parameter. If different types of system objects are passed, the output type is determined based on a precedence list defined as tf < coeff < zpk < ss < de. For example, if a System(ss) and a de system are supplied, the output will be a de system.
Pre-defined Connections
with⁡DynamicSystems:
sys1≔TransferFunction⁡1s2+5⁢s+3:
PrintSystem⁡sys1
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1⁡soutputvariable=y1⁡stf1,1=1s2+5⁢s+3
sys2≔TransferFunction⁡1s3+2⁢s+4:
PrintSystem⁡sys2
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1⁡soutputvariable=y1⁡stf1,1=1s3+2⁢s+4
sys_parallel≔SystemConnect⁡sys1,sys2,connection=parallel:
PrintSystem⁡sys_parallel
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1⁡soutputvariable=y1⁡stf1,1=s3+s2+7⁢s+7s5+5⁢s4+5⁢s3+14⁢s2+26⁢s+12
sys_serial≔SystemConnect⁡sys1,sys2,connection=serial,outputtype=ss:
PrintSystem⁡sys_serial
State Spacecontinuous1 output(s); 1 input(s); 5 state(s)inputvariable=u1⁡toutputvariable=y1⁡tstatevariable=x1⁡t,x2⁡t,x3⁡t,x4⁡t,x5⁡ta=01000−3−5000000100000110−4−20b=01000c=00100d=0
sys_feedback≔SystemConnect⁡sys1,connection=negativefeedback:
PrintSystem⁡sys_feedback
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1⁡soutputvariable=y1⁡stf1,1=1s2+5⁢s+4
sys_append≔SystemConnect⁡sys1,sys2,connection=append:
PrintSystem⁡sys_append
Transfer Functioncontinuous2 output(s); 2 input(s)inputvariable=u1⁡s,u2⁡soutputvariable=y1⁡s,y2⁡stf1,1=1s2+5⁢s+3tf2,1=0tf1,2=0tf2,2=1s3+2⁢s+4
General Connection
Consider the example system given below:
The connections depicted above can be represented as follows
RM≔↦LinearAlgebra:−RandomMatrix⁡args:
a1≔RM⁡2,2:b1≔RM⁡2,2:c1≔RM⁡2,2:d1≔RM⁡2,2:
sys1≔StateSpace⁡a1,b1,c1,d1:
a2≔RM⁡3,3:b2≔RM⁡3,2:c2≔RM⁡2,3:d2≔RM⁡2,2:
sys2≔StateSpace⁡a2,b2,c2,d2:
Mui≔1|0|0,0|0|1,0|0|0,0|3|0
Mui≔100001000030
Moi≔0|0|0|0,0|0|0|−1,0|1|0|0,0|0|0|0
Moi≔0000000−101000000
Muy≔0|0|0,0|0|0,0|0|1
Muy≔000000001
Moy≔0|0|1|0,1|0|0|0,0|0|0|1
Moy≔001010000001
sys_general≔SystemConnect⁡sys1,sys2,Mui,Moi,Muy,Moy:
PrintSystem⁡sys_general
State Spacecontinuous3 output(s); 3 input(s); 5 state(s)inputvariable=u1⁡t,u2⁡t,u3⁡toutputvariable=y1⁡t,y2⁡t,y3⁡tstatevariable=x1⁡t,x2⁡t,x3⁡t,x4⁡t,x5⁡ta=−224422618097261247561118861495061−60914612836061725613486114506174061−27061−544161506761−569761−11846143261−151861239761507761−6666124361−64861−576261254761b=−23275661−2376061−9961−6411561−696061−296176061−4350612061−121661−1170661−3261−68461391561−1861c=66661−24361217361551861−10226116321661−6050861−180061−86461−360061229461−83761−2561−1261−5061d=68461−483061186116395961172806172612356612406112361
Merging Parameters
When systems with parameters are combined, the merge and indices options may be used to affect how parameters are handled.
Create two systems with common parameters.
sys1≔TransferFunction⁡ks+w2,parameters=k=1,w=1:
sys2≔TransferFunction⁡ks+w,parameters=k=2,w=3:
Use merge = keep (the default) to keep the original parameters, but replace the numeric values with those from the first system.
sys_parallel≔SystemConnect⁡sys1,sys2,connection=parallel,merge=keep:
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1⁡soutputvariable=y1⁡stf1,1=k⁢s+w+1⁢ks2+2⁢w⁢s+w2
sys_parallel:-parameters
k=1,w=1
Use merge = evaluate to evaluate all parameters before computing the transfer function.
sys_parallel≔SystemConnect⁡sys1,sys2,connection=parallel,merge=evaluate:
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1⁡soutputvariable=y1⁡stf1,1=2⁢s2+5⁢s+5s3+5⁢s2+7⁢s+3
Use merge = replace to replace all parameters with distinct, indexed names.
sys_parallel≔SystemConnect⁡sys1,sys2,connection=parallel,merge=replace:
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1⁡soutputvariable=y1⁡stf1,1=k2⁢s2+2⁢k2⁢w1+k1⁢s+k2⁢w12+k1⁢w2s3+2⁢w1+w2⁢s2+w12+2⁢w1⁢w2⁢s+w12⁢w2
k1=1,w1=1,k2=2,w2=3
Use the indices option with merge = replace to specify the indices for the new parameter names.
sys_parallel≔SystemConnect⁡sys1,sys2,connection=parallel,merge=replace,indices=a,b:
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1⁡soutputvariable=y1⁡stf1,1=kb⁢s2+2⁢kb⁢wa+ka⁢s+kb⁢wa2+ka⁢wbs3+2⁢wa+wb⁢s2+wa2+2⁢wa⁢wb⁢s+wa2⁢wb
ka=1,wa=1,kb=2,wb=3
See Also
DynamicSystems[Coefficients]
DynamicSystems[DiffEquation]
DynamicSystems[StateSpace]
DynamicSystems[TransferFunction]
DynamicSystems[ZeroPoleGain]
Download Help Document