Skip to content
Digital Control

Discretising a controller: Euler, Tustin and prewarping

Three approximations of the derivative, Tustin and backward Euler preserve stability (proved), frequency warping proved with an example, prewarping, a discretised PI.

The most common way to obtain a digital controller is to design it in continuous time, with the tools of Automatic Control, and then translate it into a difference equation. This is called design by emulation. The translation is done by replacing s with a function of z that approximates the derivative, and the choice matters: one method can make a stable controller unstable, another shifts the frequencies. In this lesson we look at the Euler and Tustin methods, the proofs of how they transform the left half-plane, frequency warping with prewarping, and a discretised PI.

Three approximations of the derivative

A derivative can be approximated by the forward difference quotient, the backward one, or by integrating with the trapezoidal rule. In terms of the z-transform, where z is a one-step advance:

MethodSubstitutionInverse
Forward Eulers \approx \dfrac{z - 1}{T}z = 1 + sT
Backward Eulers \approx \dfrac{z - 1}{zT}z = \dfrac{1}{1 - sT}
Tustin (trapezoidal, bilinear)s \approx \dfrac{2}{T}\cdot\dfrac{z - 1}{z + 1}z = \dfrac{1 + sT/2}{1 - sT/2}

Each method carries the poles of the continuous controller to points of the z-plane. The question is: does a stable pole stay stable?

Image of the left half-plane under three methods
With forward Euler the left half-plane becomes the half-plane to the left of z equal to 1, which goes outside the dashed unit circle; with backward Euler it becomes a small circle centred at one half with radius one half, inside the unit circle; with Tustin it becomes exactly the unit disc.

What happens to stability

Theorem. With the Tustin method a point s has negative real part if and only if its image z lies inside the unit circle; the imaginary axis goes onto the circle.

Proof. With s = \sigma + j\omega and a = \sigma T/2, b = \omega T/2:

    \[ |z|^2 = \frac{|1 + a + jb|^2}{|1 - a - jb|^2} = \frac{(1 + a)^2 + b^2}{(1 - a)^2 + b^2} \]

The numerator exceeds the denominator by (1 + a)^2 - (1 - a)^2 = 4a. So |z| \lt  1 if and only if a \lt  0, i.e. \sigma \lt  0, and |z| = 1 if and only if \sigma = 0. ∎

A stable continuous controller thus becomes a stable digital controller, and an unstable one stays unstable: Tustin preserves stability exactly.

Theorem. With backward Euler the left half-plane goes into the circle centred at 1/2 with radius 1/2.

Proof. From z = 1/(1 - sT):

    \[ z - \frac{1}{2} = \frac{2 - (1 - sT)}{2(1 - sT)} = \frac{1 + sT}{2(1 - sT)} \]

and |1 + sT| \lt  |1 - sT| if and only if the point sT is closer to -1 than to +1, i.e. if \sigma \lt  0. In that case |z - 1/2| \lt  1/2. ∎

The small circle lies inside the unit one: a stable controller stays stable, but some unstable controllers become stable too, and the dynamic behaviour is distorted.

With forward Euler, on the other hand, the stable pole s = -a becomes z = 1 - aT, which leaves the circle if aT \gt  2. A controller with a pole that is fast compared with the period becomes unstable: the method should only be used with periods much smaller than all time constants, and this is the same stability limit as explicit numerical integration (Numerical Calculus lesson on differential equations).

Frequency warping

Tustin preserves stability but not frequencies. To see where the imaginary axis ends up, compute the value of s corresponding to z = e^{j\omega T}:

    \[ \frac{2}{T}\cdot\frac{e^{j\omega T} - 1}{e^{j\omega T} + 1} = \frac{2}{T}\cdot\frac{e^{j\omega T/2} - e^{-j\omega T/2}}{e^{j\omega T/2} + e^{-j\omega T/2}} = j\,\frac{2}{T}\tan\frac{\omega T}{2} \]

(factoring e^{j\omega T/2} out of numerator and denominator). The digital controller at frequency \omega behaves like the continuous one at frequency

    \[ \omega_a = \frac{2}{T}\tan\frac{\omega T}{2} \]

For small \omega T, \tan x \approx x and \omega_a \approx \omega; near the Nyquist frequency \pi/T the tangent goes to infinity, and the whole continuous frequency axis is compressed into the interval from 0 to \pi/T. It is the same frequency warping as in IIR filters (Digital Signal Processing lesson on IIR filters and the bilinear transform).

Example. With T = 1 ms, a lead network with its zero at 200 Hz (\omega_a = 1257 rad/s) ends up, in the digital controller, at frequency \omega = (2/T)\arctan(\omega_aT/2) = 2000\arctan(0.628) \approx 1122 rad/s, i.e. about 179 Hz: a 10 % error.

Prewarping eliminates the error at a chosen frequency \omega_0, the most important one (the zero of the network, the crossover frequency, the frequency of a notch filter): 2/T is replaced by \omega_0/\tan(\omega_0T/2). At frequency \omega_0 the two controllers coincide exactly.

Other methods

  • Matched pole-zero: every pole and zero is mapped with z = e^{sT}, and the static gain is adjusted. It preserves pole positions exactly.
  • Step invariance: the controller is discretised as if it were a process preceded by a hold (lesson on sampled-data systems).

Whatever method is used, emulation neglects the T/2 delay of the hold and the computation delay, which reduce the phase margin (lesson on implementation). It works well if sampling is fast, 20 to 30 times the closed-loop bandwidth; with longer periods direct design in the z-plane is preferable.

Example: a PI with Tustin

The controller C(s) = K_p(1 + 1/(T_is)) with the Tustin substitution becomes

    \[ C(z) = K_p\left(1 + \frac{T}{2T_i}\cdot\frac{z + 1}{z - 1}\right) \]

Multiplying by z - 1 and going back to the time domain (z is a one-step advance), we obtain the algorithm

    \[ u(k) = u(k-1) + K_p\left[\left(1 + \frac{T}{2T_i}\right)e(k) - \left(1 - \frac{T}{2T_i}\right)e(k-1)\right] \]

It is already in incremental form (Process Control lesson on digital control): it computes the change of the command, and lends itself well to limiting the integral action against saturation.

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x