Skip to content
Digital Control

Solved digital control exercises: stability, discrete locus, delay and sampling

Eight exercises with solutions and graphs: Jury at third order, first-order process and deadbeat, integrator with delay, bilinear and Routh, sampled motor, computation delay, choice of sampling period, continuous versus discrete.

Exercises on the stability and design of digital control systems of the kind set in Digital Control courses, in three levels: basic, with the Jury criterion and the maximum gains of simple systems; intermediate, with the discrete root locus and the bilinear transformation; exam, with computation delay, the choice of the sampling period and the comparison between continuous and discrete. The result is given straight away; the full solution, with the graph, opens with a click. The proofs and the MATLAB and Python code are in the in-depth study linked at the top.

Basic level

Exercise 1. Jury at third order

Determine whether P(z) = z^3 - 2z^2 + 1.5z - 0.4 has all its roots inside the unit circle, without computing them.

Result: yes: all the Jury conditions are satisfied (the roots have moduli 0.80, 0.80 and 0.62).

Solution

Coefficients: a_3 = 1, a_2 = -2, a_1 = 1.5, a_0 = -0.4.

1. P(1) = 1 - 2 + 1.5 - 0.4 = 0.1 \gt  0.

2. (-1)^3P(-1) = -(-1 - 2 - 1.5 - 0.4) = 4.9 \gt  0.

3. |a_0| = 0.4 \lt  a_3 = 1.

4. |a_0^2 - a_3^2| = |0.16 - 1| = 0.84 \gt  |a_0a_2 - a_3a_1| = |0.8 - 1.5| = 0.7.

Stable. The margin is small (P(1) = 0.1 and condition 4 only just holds): the roots, computed afterwards, are 0.69 \pm 0.41i and 0.62, with maximum modulus 0.80.

The roots of the polynomial in the z plane
The three roots, marked with a cross, lie inside the dashed unit circle, but not far from its edge.

Exercise 2. A first-order process

The process G(s) = \dfrac{1}{s + 1} is controlled by a digital proportional controller with T = 0.5 s and hold. Find the maximum gain, the steady-state step error with K = 2 and the gain that puts the pole at z = 0.

Result: K_{max} = 4.08; error \frac{1}{3}; K = 1.54.

Solution

ZOH: G(z) = \frac{1 - e^{-T}}{z - e^{-T}} = \frac{0.3935}{z - 0.6065}. Closed loop: z - 0.6065 + 0.3935K = 0, pole z = 0.6065 - 0.3935K.

Stability: |z| \lt  1 requires -1 \lt  0.6065 - 0.3935K, i.e. K \lt  \frac{1.6065}{0.3935} = 4.08. In continuous time, for the same process, there is no limit.

Steady-state error: G(1) = 1, so e_\infty = \frac{1}{1 + KG(1)} = \frac{1}{3} with K = 2: the output goes to \frac{2}{3}. Without an integrator the error remains.

Pole at zero: K = \frac{0.6065}{0.3935} = 1.54. The output reaches steady state in a single step (deadbeat response): a behaviour impossible in continuous time.

With K = 2 the pole is -0.18, negative: the response oscillates slightly from sample to sample.

Step response with K equal to 2
The output, held between samples, slightly exceeds the steady-state value two thirds and reaches it in a few steps, with a small oscillation due to the negative pole.

Exercise 3. The period sets the gain

An integrator G(s) = \frac{1}{s} is controlled with a gain K; the controller applies the command with one step of computation delay. With T = 10 ms, what is the maximum gain? And the gain at which the poles break away?

Result: K \lt  100 s^{-1}; breakaway for K = 25 s^{-1}.

Solution

From the lesson, with the delay the polynomial is z^2 - z + KT = 0 and Jury gives 0 \lt  KT \lt  1. With T = 0.01: K \lt  100.

The breakaway is halfway between the poles 0 and 1, where the polynomial has a double root: discriminant 1 - 4KT = 0, KT = \frac{1}{4}, K = 25. For K \lt  25 the response does not oscillate; between 25 and 100 it oscillates more and more; at the limit it has 6 samples per period.

To get more gain without losing stability one must sample faster: K_{max} is inversely proportional to T.

Locus of the integrator with computation delay
The branches meet at 0.5 for KT equal to one quarter and reach the unit circle for KT equal to 1.

Intermediate level

Exercise 4. Bilinear transformation and Routh

For which K \gt  0 is the system with characteristic polynomial z^2 + (K - 1.5)z + 0.5 = 0 stable? Use the bilinear transformation and check with the root locus.

Result: 0 \lt  K \lt  3.

Solution

With a_1 = K - 1.5 and a_0 = 0.5, the transformed polynomial (in-depth study) is

    \[ (1 - a_1 + a_0)w^2 + 2(1 - a_0)w + (1 + a_1 + a_0) = (3 - K)w^2 + w + K \]

Routh for second order: all coefficients positive, 0 \lt  K \lt  3.

Locus. The polynomial is (z - 1)(z - 0.5) + Kz: the locus of \frac{Kz}{(z - 1)(z - 0.5)}, with poles at 1 and 0.5 and a zero at 0. It is a circle centred at the zero with radius \sqrt{1\cdot 0.5} = 0.707 (continuous locus lesson: same geometry). The poles leave the unit circle on the real axis, at z = -1, when P(-1) = 1 - K + 1.5 + 0.5 = 3 - K = 0.

Root locus of the exercise
The branches start from 1 and 0.5, describe a circle of radius 0.707 around the zero at the origin, return to the real axis and one leaves the unit circle at minus 1 for K equal to 3.

Exercise 5. The sampled motor

For the motor G(s) = \frac{1}{s(s + 1)} sampled with T = 0.5 s (in-depth study), check K_{max} = 4.36 with Jury and find the frequency of the oscillation at the limit.

Result: K_{max} = 4.36; oscillation with period 3.3 s (6.5 samples).

Solution

Polynomial z^2 + (0.1065K - 1.6065)z + (0.6065 + 0.0902K). The binding Jury condition is |a_0| \lt  1: 0.0902K \lt  0.3935, K \lt  4.36 (the others give K \gt  0 and K \lt  197).

For K = 4.36: z^2 - 1.142z + 1 = 0, z = 0.571 \pm 0.821i, angle \theta = 55.2° = 0.963 rad. The angular frequency of the oscillation is \theta/T = 1.93 rad/s, the period 2\pi T/\theta = 3.3 s, i.e. 6.5 samples.

It is the same frequency \omega_\pi = 1.93 rad/s at which the phase of the discrete Bode plot is -180°: Jury, locus and Nyquist give the same information.

Locus of the sampled motor
The locus crosses the unit circle at the points 0.57 plus or minus 0.82 i for K equal to 4.36.

Exam level

Exercise 6. The price of computation delay

One step of computation delay is added to the sampled motor of exercise 5: L(z) = \frac{K\,G(z)}{z}. How do the maximum gain and the phase margin with K = 1 change?

Result: K_{max} falls from 4.36 to 1.49; the phase margin from 40.8° to 18.3°.

Solution

The characteristic polynomial becomes third order: z^3 - 1.6065z^2 + 0.6065z + K(0.1065z + 0.0902). With Jury, or by computing the roots as K varies (code of the in-depth study with G_d/z), one finds K_{max} = 1.49.

In frequency, z^{-1} has magnitude 1 and phase -\omega T: at the crossover frequency (about 0.78 rad/s) it removes 0.78\cdot 0.5 = 0.39 rad, i.e. 22.4°. The margin falls from 40.8° to 18.3°.

Remedies: sample faster (the delay, in seconds, gets shorter), or apply the command as soon as it is computed instead of at the next step, keeping the code between the A/D read and the D/A write to a minimum (lesson on implementation).

Locus with computation delay
The extra pole at the origin pushes the branches out of the unit circle much earlier: the crossing happens for K equal to about 1.5.

Exercise 7. Choosing the sampling period

A continuous control loop has crossover frequency \omega_c = 10 rad/s and a phase margin of 60°. Which sampling period guarantees losing no more than 5° of margin because of the hold? And if there is also one step of computation delay?

Result: T \le 17.5 ms; with the computation delay T \le 5.8 ms.

Solution

The hold is equivalent to a delay of T/2: phase loss \omega_c\frac{T}{2}. Requiring \omega_c\frac{T}{2} \le 5° = 0.0873 rad: T \le \frac{2\cdot 0.0873}{10} = 17.5 ms.

With one more step of delay the total delay is \frac{3T}{2}: T \le \frac{2\cdot 0.0873}{3\cdot 10} = 5.8 ms.

Equivalent rule of thumb: sample 20-40 times faster than the loop bandwidth (\omega_c/2\pi = 1.6 Hz, so at least 30-60 Hz; at 170 Hz one is well on the safe side). In car ECUs fast controllers run at 1-10 ms, slow ones (temperature, level) at 100 ms.

Continuous and discrete phase
The hold lowers the phase by an amount that grows with frequency: at the crossover frequency the loss is about omega times T over 2.

Exercise 8. Continuous versus discrete with the same gain

The motor \frac{1}{s(s + 1)} is controlled with K = 2: compare the overshoot of the continuous system and of the one sampled with T = 0.5 s. Write the commands to check it.

Result: continuous 30.5 %; sampled 55.6 %.

Solution

Continuous: s^2 + s + 2, \omega_n = \sqrt 2, \zeta = \frac{1}{2\sqrt 2} = 0.354, overshoot e^{-\pi\zeta/\sqrt{1 - \zeta^2}} = 30.5 %.

Sampled: polynomial z^2 - 1.393z + 0.787, roots 0.697 \pm 0.548i, modulus 0.887, angle 38.2°. The equivalent continuous pole s = \frac{\ln z}{T} has \zeta \approx 0.18: much less damped, overshoot about 56 %.

MATLAB: G = tf(1,[1 1 0]); stepinfo(feedback(2*G,1)), stepinfo(feedback(2*c2d(G,0.5),1)). Python: ct.step_info(ct.feedback(2*G, 1)) and ct.step_info(ct.feedback(2*ct.sample_system(G, 0.5), 1)), which give 30.5 % and 55.6 %.

The lesson is general: a controller tuned in continuous time and placed in a slow processor loses damping. Either sample faster, or design directly in discrete time.

Continuous and sampled step responses
With the same gain the sampled system, in blue, oscillates much more than the continuous one, dashed.
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x