4 min read
On this page

Digital Control

Sampling and Reconstruction

Digital controllers operate on sampled data. The continuous signal x(t) is sampled at period T:

x[k] = x(k*T),  k = 0, 1, 2, ...

Shannon-Nyquist Sampling Theorem

To reconstruct a bandlimited signal with maximum frequency f_max, the sampling frequency must satisfy:

f_s > 2 * f_max    (Nyquist rate)

Aliasing occurs when this condition is violated -- high-frequency content folds into lower frequencies. Use an anti-aliasing filter (analog low-pass) before the ADC.

Reconstruction (DAC)

Zero-Order Hold (ZOH): holds the sample constant for one period:

u(t) = u[k]  for  k*T <= t < (k+1)*T

Transfer function of ZOH:

G_ZOH(s) = (1 - e^(-T*s)) / s

First-Order Hold (FOH): linearly interpolates between samples. Less common in practice.

Practical Rule for Sampling Rate

Choose T <= t_s / 20 to t_s / 40 where t_s is the closed-loop settling time. Equivalently:

omega_s >= 20 * omega_BW    to    40 * omega_BW

Z-Transform

The discrete-time equivalent of the Laplace transform:

X(z) = Z{x[k]} = sum_{k=0}^{inf} x[k] * z^(-k)

Key Z-Transform Pairs

| x[k] | X(z) | |-------|------| | delta[k] | 1 | | u[k] (step) | z / (z - 1) | | ku[k] (ramp) | Tz / (z - 1)^2 | | a^k * u[k] | z / (z - a) | | e^(-akT) | z / (z - e^(-aT)) | | sin(omegakT) | zsin(omegaT) / (z^2 - 2zcos(omegaT) + 1) |

Properties

  • Linearity: Z{a*x + b*y} = a*X(z) + b*Y(z)
  • Time shift: Z{x[k-n]} = z^(-n) * X(z) (with zero initial conditions)
  • Final value: x[inf] = lim(z->1) (z-1)*X(z) (if stable)
  • Initial value: x[0] = lim(z->inf) X(z)

Pulse Transfer Function

For a discrete LTI system:

G(z) = Y(z) / U(z) = (b_m*z^m + ... + b_0) / (z^n + a_{n-1}*z^{n-1} + ... + a_0)

Stability: all poles of G(z) must lie inside the unit circle |z| = 1.

Continuous-to-Discrete Mapping

The mapping z = e^(sT) relates the s-plane to the z-plane:

| s-plane | z-plane | |---------|---------| | Left half plane (stable) | Inside unit circle | | Imaginary axis | Unit circle | | Right half plane (unstable) | Outside unit circle | | Re(s) = -sigma | Circle of radius e^(-sigma*T) |

Discrete State-Space

x[k+1] = A_d * x[k] + B_d * u[k]
y[k]   = C_d * x[k] + D_d * u[k]

Discretization via ZOH

From continuous (A, B, C, D):

A_d = e^(A*T)
B_d = A^(-1) * (e^(A*T) - I) * B    (or integral_0^T e^(A*tau) d_tau * B if A singular)
C_d = C
D_d = D

Controllability/observability are defined analogously to continuous case using C_ctrl = [B_d, A_d*B_d, ..., A_d^{n-1}*B_d].

Digital Controller Design Methods

Direct Digital Design

Design directly in the z-domain. Place closed-loop poles inside the unit circle.

Desired pole locations: map desired s-plane poles via z_i = e^(s_i * T).

Tustin's Method (Bilinear Transform)

Substitute into C(s):

s = (2/T) * (z - 1) / (z + 1)

Maps the entire left half s-plane to inside the unit circle. Preserves stability. Introduces frequency warping:

omega_actual = (2/T) * tan(omega_d * T / 2)

Pre-warping: at a critical frequency omega_c, use s = (omega_c / tan(omega_c*T/2)) * (z-1)/(z+1).

ZOH Equivalent (Step Invariant)

Discretize the plant with ZOH:

G_d(z) = (1 - z^(-1)) * Z{G(s)/s}

Preserves the step response exactly at sample instants.

Matched Pole-Zero Method

Map each pole and zero: z_i = e^(s_i * T). Add zeros at z = -1 for unmatched poles. Adjust gain to match DC or another frequency.

Dead-Beat Control

A unique capability of digital systems: drive the output to the reference in minimum time (n steps for an n-th order system).

For plant G(z), the dead-beat controller:

C(z) = G(z)^(-1) * (z^(-d) / (1 - z^(-d)))

where d = relative degree of G(z).

Properties:

  • Zero steady-state error in d samples
  • Intersample ripple may be large
  • Requires exact plant model (poor robustness)
  • Large control signals

Practical approach: place all closed-loop poles at z = 0 (finite settling time).

Discrete PID

Positional form:

u[k] = Kp*e[k] + Ki*T*sum_{j=0}^{k} e[j] + (Kd/T)*(e[k] - e[k-1])

Velocity (incremental) form -- avoids windup naturally:

delta_u[k] = Kp*(e[k] - e[k-1]) + Ki*T*e[k] + (Kd/T)*(e[k] - 2*e[k-1] + e[k-2])
u[k] = u[k-1] + delta_u[k]

Derivative approximations:

  • Backward difference: s ≈ (z-1)/(T*z) -- always stable mapping
  • Forward difference: s ≈ (z-1)/T -- can map stable poles outside unit circle
  • Tustin: s ≈ (2/T)*(z-1)/(z+1) -- best frequency matching

Implementation Issues

Finite Word Length Effects

Quantization noise: ADC resolution limits measurement precision. For b-bit ADC with range [-V, V]:

quantization step: q = 2V / 2^b
quantization noise power: q^2 / 12

Coefficient quantization: rounding controller coefficients shifts pole/zero locations. Direct form realizations are most sensitive. Cascade or parallel realizations of second-order sections are more robust.

Computational Delay

Processing takes time delta. The control signal arrives late:

u(t) ≈ u[k] for k*T + delta <= t < (k+1)*T + delta

Model as fractional-sample delay. Account for it in design or ensure delta << T.

Multirate Systems

Different signals sampled at different rates. Examples:

  • Fast inner loop (motor current) and slow outer loop (position)
  • Slow sensor with fast actuation

Requires lifting or multirate state-space formulations.

Discrete Stability Tests

Jury's stability test: the discrete equivalent of Routh-Hurwitz. Constructs an array from characteristic polynomial coefficients; stability requires all array entries in the first column to be positive.

Bilinear transformation to s-domain: substitute z = (w+1)/(w-1) to map unit circle to left half plane, then apply Routh-Hurwitz in the w-domain.