Engee documentation
Notebook

Time delay approximation in a continuous open loop model

This example shows how to approximate delays in an open loop continuous-time system using pade.

The Pade approximation is useful when using analysis or design tools that do not support time delays. Using too high an approximation order can lead to numerical errors and possibly unstable poles. Therefore, avoid Pade approximations with an order of $n>10$.

Problem statement

Design a sample open loop system with output delay.

timedelayapproximationincontinuoustimeopenloopmodelexample_01.png

In [ ]:
Pkg.add(["ControlSystems"])
In [ ]:
using ControlSystems

By default, the delay is 2.6, but you can set your own parameter. As a result, you will get P - object in the form of state space (ss) with time delay 2.6 c.

In [ ]:
s = tf('s');

L = 2.6 # @param {type:"slider", min:0, max:9, step:0.1}
P = exp(-L*s)/(s^2+0.9*s+1)
Out[0]:
DelayLtiSystem{Float64, Float64}

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

Continuous-time state-space model

Delays: [2.6]

First order approximation

Compute the first-order Pade approximation for P.

In [ ]:
Pnd1 = pade(P,1)
Out[0]:
StateSpace{Continuous, Float64}
A = 
  0.0   1.0   0.0
 -1.0  -0.9   0.0
  1.0   0.0  -0.7692307692307692
B = 
 0.0
 1.0
 0.0
C = 
 -1.0  0.0  1.5384615384615383
D = 
 0.0

Continuous-time state-space model

This command replaces all time delays in P with a first-order approximation. Thus, Pnd1 is a third-order system with no delays.

Compare the frequency response of the original and approximate models using bodeplot.

In [ ]:
bodeplot([P, Pnd1], label = ["P" "Pnd1"])
Out[0]:

The amplitude characteristics of P and Pnd1 match exactly. However, the phase of Pnd1 differs from the phase of P by about 1 rad/s.

Third order approximation

Increase the order of the Padé approximation to expand the range of frequencies for which the phase approximation is good.

In [ ]:
Pnd3 = pade(P,3);

Compare the frequency responses of P, Pnd1 and Pnd3.

In [ ]:
bodeplot([P, Pnd1, Pnd3], label = ["P" "Pnd1" "Pnd3"])
Out[0]:

The phase response error decreases when the third-order Pade approximation is used.

Compare the transient characteristics of the original and approximated systems in the time domain using step.

In [ ]:
plot(
    [step(P), step(Pnd1), step(Pnd3)], 
    label = ["P" "Pnd1" "Pnd3"]
)
Out[0]:

Conclusions

The use of the Padé approximation leads to a non-minimal phase in the initial transient. This effect is quite pronounced in the first order approximation, which drops significantly below zero before the change of direction. In the higher order approximation this effect is reduced and it better matches the exact response of the system.