Engee documentation
Notebook

Smith's Predictor

This example develops a control system for an object with a large time delay. To control objects with a delay, the Smith predictor is often used, which can predict what signal should appear at the output of the object before it actually appears there [1].

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

The control object is given by Eq: $P = P_0e^{-sτ}$, where $P_0 = {1 \over s+1}$.

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 varying the delay τ , we can see how the system will behave at 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 structural diagram of the control system with Smith predictor is shown in the figure below. It contains an additional internal feedback loop that contains a model of the control object $P_0$. The additional loop generates a signal identical to that which will eventually appear at the output of the system and feeds it to the input of the controller $C_0$ until a signal from the main feedback loop appears. [2]

image.png

We use a PI controller as a regulator $C_0$.

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 $C$:

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 us construct the transient process.

2.png

The transfer function of the perturbing influence f:

${Y \over F} = {P \over (1+PC)}$ = feedback(P, C).

Transfer function of a closed-loop system :

${Y \over R} ={PC \over (1+PC)}$ = 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 us construct the logarithmic amplitude-phase frequency response of the predictor and compare it with the frequency response of the negative delay $e^{sτ}$, which would be an ideal controller (usually such a controller cannot be realised 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 us construct the 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 when τ > 2.99.

Conclusion

In this case study, we have learnt methods for designing time delayed object control systems using Smith's predictor. We have also looked at various methods of analysing such systems and visualising them.