# Connecting Inputs and Outputs of Transfer Function Models

I am trying to use Mathematica's TransferFunctionModel object and SystemsModelFeedbackConnect function to approach the following coupled control problem

A version of the above BFD that looks like the code is below.

I make use of SystemsModelFeedbackConnect. It is not possible to link any output to any input, but that they must be the same index. It also isn't possible to specify the feedback type of the output of system 1 to input of system 2 but it is possible to specify the feedback type of the output of system 2 to the input of system 1. I am under the impression that with the below I get away with the problem, assuming that the output of system 1 to input of system 2 is negative feedback and changing the sign on the matrix accordingly. But the system is divergent.

g11 = 3./(2. s + 1);
g12 = -10.;
g21 = 1/(s^2 + 3. s + 2.);
g22 = 4./((s + 1) (3. s + 1));
gc11 = kc11 (1 + 1/(tI11 s));
gc22 = kc22 (1 + 1/(tI22 s));
kc11 = 0.1; kc22 = 0.1; tI11 = 0.1; tI22 = 0.1;
sys1TF = TransferFunctionModel[{{gc11 g11 , g12}, {-gc11, -0}}, (* negative due to forced negative feed back *)
s]; (* input 1 is e1, input 2 is u2, output 1 is y1, output 2 is u1 *)
sys2TF = TransferFunctionModel[{{gc22 g22, g21}, {gc22, 0}},
s]; (* input 1 is e2, input 2 is u1, output 1 is y2, output 2 is u2 *)
recSys1TF =
SystemsModelFeedbackConnect[
sys1TF, {1, 1,
"Negative"}]; (* only recycle the first output to the first input *)

recSys2TF =
SystemsModelFeedbackConnect[
sys2TF, {1, 1,
"Negative"}]; (* only recycle the first output to the first input *)

totalTF = SystemsModelFeedbackConnect[recSys1TF, recSys2TF,
{2}, (*
connect output 2 of system 1 to input 2 of system 2 by negative
feedback *)
{{2, "Positive"}} (*
connect output 2 of system 2 to input 2 of system 1 by addition*)
];


The current formulation may either be outright incorrect or just extremely unstable due to the high order of the transfer function model. The question I have is, why can only pairs of index corresponding inputs and outputs can be fed? Looking at SystemsModelStateFeedbackConnect it is possible to connect any input to any output. Is this a result of a limitation of the TransferFunctionModel in contrast to the StateSpaceModel?

• For what I understand the help of SystemsModelFeedbackConnectyou're connecting output2 of recSys1 with input1 of recSys2 (positive feedback, as in the image in the detail section, and no further input from outside), and you're connecting output1 of recSys2 with input2 of recSys1, positive feedback. It's like in your picture. I think youre picture does not match your comments in the code. But that's just how I understood the help section.
– Phab
Mar 14, 2017 at 13:48

It's not an answer, but this way I can show with some image, how I unterstood the help of SystemsModelFeedbackConnect.

With

SystemsModelFeedbackConnect[sys1,sys2,{2,1},{{2,"Negative"},{1,"Positive"}}]


I connect my systems like in the following picture:

D to G, C to H (no additional input at G and H, and no choice of feedback),

and F to A (positive) and E to B (negative). There are no additional outputs at E and F.

SystemsModelFeedbackConnect[sys1,sys2,{2},{{2,"Negative"}}]