Engee documentation
Notebook

Smith's Predictor

In this example, an object management system with a long time delay is being developed. To control objects with a delay, the Smith predictor is often used, which can predict which signal should appear at the output of an object before it actually appears there [1].

In [ ]:
Pkg.add(["ControlSystems", "ControlSystemsBase"])
In [ ]:
using ControlSystemsBase, Plots
using ControlSystems # Библиотека для моделирования системы задержек

The control object is defined by the equation: , where .

In [ ]:
P0 = ss(-1, 1, 1, 0) # Объект управления без задержки
Out[0]:
StateSpace{Continuous, Int64}
A = 
 -1
B = 
 1
C = 
 1
D = 
 0

Continuous-time state-space model

By changing the delay value t, you can see how the system will behave with different delays.

In [ ]:
τ = 8 # Величина задержки
P = delay(τ) * P0 # Объект управления с задержкой
Out[0]:
DelayLtiSystem{Float64, Float64}

P: StateSpace{Continuous, Float64}
A = 
 -1.0
B = 
 1.0  0.0
C = 
 0.0
 1.0
D = 
 0.0  1.0
 0.0  0.0

Continuous-time state-space model

Delays: [8.0]

The block diagram of the Smith predictor control system is shown in the figure below. It contains an additional internal feedback loop, which contains the model of the control object. An additional circuit generates a signal identical to the one that eventually appears at the output of the system and feeds it to the input of the regulator until there is a signal from the main feedback circuit. [2]

image.png

As a regulator we use a PI controller.

In [ ]:
ω0 = 2
ζ  = 0.7
C0, _ = placePI(P0, ω0, ζ) # ПИ-регулятор
Out[0]:
(TransferFunction{Continuous, ControlSystemsBase.SisoRational{Float64}}
1.7999999999999998s + 4.0
-------------------------
          1.0s

Continuous-time transfer function model, 1.7999999999999998, 0.44999999999999996)

Smith's Predictor :

In [ ]:
C = feedback(C0, (1.0 - delay(τ))*P0) # Формирование внутренней обратной связи
Out[0]:
DelayLtiSystem{Float64, Float64}

P: StateSpace{Continuous, Float64}
A = 
 0.0  -2.0
 2.0  -2.8
B = 
 2.0                 -2.0
 1.7999999999999998  -1.7999999999999998
C = 
 2.0  -1.7999999999999998
 0.0  -1.0
D = 
 1.7999999999999998  -1.7999999999999998
 0.0                  0.0

Continuous-time state-space model

Delays: [8.0]

Let's build a transition process.

2.png

Transfer function for disturbing effect f:

= feedback(P, C).

Transfer function of a closed system :

= feedback(P*C, 1)

In [ ]:
G = [feedback(P*C, 1) feedback(P, C)] # Эталонный шаг при t = 0 и шаг возмущения нагрузки при t = 15
fig_timeresp = plot(lsim(G,(_,t) -> [1; t >= 15], 0:0.1:40),  title="τ = ")
Out[0]:

Let's construct a logarithmic amplitude-phase frequency response of the predictor and compare it with the frequency response of the negative delay. which would be an ideal controller (as a rule, such a controller cannot be implemented in practice).

In [ ]:
C_pred = feedback(1, C0*(ss(1.0) - delay(τ))*P0)
fig_bode = bodeplot([C_pred, delay(-τ)], exp10.(-1:0.002:0.4), ls=[:solid :solid :dash :dash], title="", lab=["Предиктор Смита" "" "Идеальный контроллер" ""])
plot!(yticks=[0.1, 1, 10], sp=1)
plot!(yticks=0:180:1080, sp=2)
Out[0]:

Let's build a Nyquist hodograph.

In [ ]:
fig_nyquist = nyquistplot(C * P, exp10.(-1:1e-4:2), title="τ = ")
Out[0]:

You can repeat the script by changing the delay value. τ in line 4. Note that the hodograph describes -1 at τ > 2.99.

Conclusion

In this example, we have studied methods for designing time-delayed object management systems using the Smith predictor. We also reviewed various methods of analyzing such systems and their visualization.