Connecting models
In this example, we will learn how to model the connection of LTI systems in Engee. From simple serial and parallel connections to complex flowcharts.
Review
Engee provides a number of functions to help you create LTI model unions. These include functions:
- Serial and parallel connection (
series
,parallel
) - Connection with feedback (
feedback
,feedback2dof
) - Input and output concatenation (
[ , ]
,[ ; ]
,append
,array2mimo
) - General construction of flowcharts (
connect
)
To illustrate the examples, we will connect the necessary libraries and create two systems with the following transfer functions:
Pkg.add(["RobustAndOptimalControl", "ControlSystems"])
using ControlSystems
H1 = tf(2,[1, 3, 0])
H2 = zpk([],[-5],5)
Serial connection
Use the operator *
or a function series
for serial connection of LTI models, for example:

H = H2 * H1
H = series(H1,H2)
Parallel connection
Use the operator +
or a function parallel
for parallel connection of LTI models, for example:

H = H1 + H2
H = parallel(H1,H2)
Connection with feedback
The standard view of the structural scheme of a system with a negative feedback loop:

To identify a closed system, use the function feedback
.
H = feedback(H1,H2)
Please note that feedback is negative by default. To give positive feedback, use the following syntax:
H = feedback(H1, H2, pos_feedback = true)
Combining inputs and outputs
You can combine the input data of the two models H1 and H2 by entering:
H = [H1 H2]
The resulting model has two inputs and one output, which corresponds to the following scheme:

Similarly, you can combine the output of H1 and H2 by entering:
H = [ H1 ; H2 ]
The resulting model H has two outputs and one input and corresponds to the following flow chart:

Finally, you can combine the input and output of the two models using:
H = append(H1,H2)
The resulting model H has two inputs and two outputs and follows the block diagram:
You can use concatenation to build MIMO models from elementary SISO models, for example:
[H1 -tf(10,[1, 10]); 0 H2]
You can also use the function array2mimo
. For example,
P = ss(-1,1,1,0);
sys_array = fill(P, 2, 2) # Создает массив систем
mimo_sys = array2mimo(sys_array)
Building models based on flowcharts
You can use combinations of functions and operations to build models of simple flowcharts. For example, consider the following flow chart:

s = tf('s');
F = 1/(s + 1);
G = 100/(s^2 + 5*s + 100);
C = 20*(s^2 + s + 60)/s/(s^2 + 40*s + 400);
S = 10/(s + 10);
You can define the transfer function of a closed system from r to y as follows:
T = F * feedback(G*C,S)
plot(step(T,10))
But for more complex flowcharts, use the function connect
libraries RobustAndOptimalControl.jl
. To use connect
, follow these steps:
- Identify all the blocks in the diagram, including the summation blocks;
- Name all the input and output channels of the blocks;
- Match the outputs of the system blocks with the corresponding inputs of the blocks.
Let's look at an example of using the function using the example of the following block diagram.
Import and connect the library RobustAndOptimalControl.jl
.
import Pkg
Pkg.add("RobustAndOptimalControl")
using RobustAndOptimalControl
Use the function named_ss
, in order to set the names of the input and output signals for each block.
F1 = named_ss(F, x=:xF, u=:r, y=:u_f)
G1 = named_ss(G, x=:xG, u=:u, y=:y_m)
C1 = named_ss(C, x=:xC, u=:e, y=:u_c)
S1 = named_ss(S, x=:xS, u=:y_m, y=:y)
Denote the adders using the function sumblock
.
Sum1 = sumblock("e = r - y")
Sum2 = sumblock("u = u_f + u_c")
It is important to mark the connections carefully. Connections are formed according to the principles that the output of one block is connected to the input of another. For example, the signal е
is the output Sum1
, but it is also the input for the block C
.
connections = [
:e => :e # output e Sum1 to input C
:y => :y # output y S to input Sum1
:u => :u # output u Sum2 to input G
:u_f => :u_f # output u_f F to input Sum2
:u_c => :u_c # output u_c C to input Sum2
:y_m => :y_m # output G to input S
]
It is also important to identify the input signal w1
and a day off z1
.
w1 = [:r]
z1 = [:y_m]
All calculated data is submitted to the input connect
. You can learn more about all the function parameters in the Julia documentation Unification систем.
P = connect([F1, C1, G1, S1, Sum1, Sum2], connections; w1,z1,unique = false)
Let us construct the transition process of the resulting closed system.
plot(stepinfo(step(P,5)))
Conclusion
In this article, we looked at ways to connect models. You can study the functions for converting structural diagrams in more detail in the section [Building systems] (https://engee.com/helpcenter/stable/julia/ControlSystems/lib/constructors.html ).