Todo: derivation and visuals of different approx orders and their accuracy, elaborate on explainations, intuition on the mathematical form
Time delays are very common in process control. For example, they arise from delays in (1) measuring a process variable, because the sensor is physically located some distance away from the point of interest or (2) controlling a process variable, because instantaneous movement of valves and other physical devices is practically impossible.
The time delay of a transfer function is:
$$ H(s) = e^{-\theta s} $$Most transfer functions we encounter are rational functions, given as a ratio of 2 polynomials, $P$ and $Q$:
$$ H(s) = \frac{P(s)}{Q(s)} = \frac{a_ps^p + a_{p-1}s^{p-1} + \dots + a_0}{b_qs^q + b_{q-1}s^{q-1} + \dots + b_0} $$Rational transfer functions have some nice properties. It is easy to find their poles and zeros and inverse Laplace transform. However, with a time delay, $e^{-\theta s}$ term in the transfer function, it is no longer rational and we lose those convenient properties.
In these situations, we use a Padé approximation to find a rational approximation to $e^{-\theta s}$.
TODO: [content here]
Given a transfer function with a 2-second delay:
$$ H(s) = \frac{1}{5s+1} e^{-2s} $$We can define this system in python.control
by doing the following
import control
The control.pade
function takes in 3 arguments:
n
numdeg
and returns the numerator and denominator coefficients in a tuple.
theta = 10
n=1
numdeg=1
coeffs = control.pade(theta, n, numdeg)
coeffs
([-1.0, 0.2], [1.0, 0.2])
We can create our approximation of the delay by doing:
sys_delay = control.tf(coeffs[0],coeffs[1])
sys_delay
-s + 0.2 -------- s + 0.2
The system transfer function is
sys = control.tf([1],[5,1])
sys
1 ------- 5 s + 1
The combined transfer function is
g = sys * sys_delay
g
-s + 0.2 ----------------- 5 s^2 + 2 s + 0.2
Notice that the control.pade
returns a tuple of 2 items, the numerator and denominator coefficients. Instead of storing the tuple in g_delay
, we can unpack the tuple and improve code readibility by doing:
(num, deg) = control.pade(theta, n, numdeg)
control.tf(num, deg)
-s + 0.2 -------- s + 0.2
Alternatively, we can also use the asterisk(*)
method to unpack the tuple in the function argument:
coeffs = control.pade(theta, n, numdeg)
control.tf(*coeffs) # Equivalent to control.tf(g_delay[0],g_delay[1])
-s + 0.2 -------- s + 0.2
Further reading: