Salta al contenuto
Note per Studenti Digital Control Systems Report

Digital Control Systems

In questa pagina 9

Analog control systems

In an analog control system the controller operates with analog signals (continuous in time and amplitude). When implemented with electronic circuits it typically relies on operational amplifiers (op-amps). The loop is the usual one: error e(t)=r(t)−y(t)e(t) = r(t) - y(t), analog controller, command u(t)u(t), plant, output y(t)y(t).

Advantages compatible with continuous-time plant dynamics; well-established design methods
Drawbacks sensitive to component tolerances and aging; difficult to diagnose and reconfigure (limited flexibility)

Example: analog PID with op-amps

Parallel implementation. The input viv_i is sent to three op-amp branches whose outputs are summed by a final op-amp (with resistor RR in the feedback and RR in series with each branch output):

  • proportional branch: input resistor RP1R_{P_1}, feedback resistor RP2R_{P_2};
  • integral branch: input resistor RIR_I, feedback capacitor CIC_I;
  • derivative branch: input capacitor CDC_D in series with resistor RD1R_{D_1}, feedback resistor RD2R_{D_2}.

The transfer function is

C(s)=VO(s)VI(s)=KP+KIs+KD s1+TLs,C(s) = \frac{V_O(s)}{V_I(s)} = K_P + \frac{K_I}{s} + \frac{K_D\,s}{1 + T_L s},

with

KP=RP2RP1,KI=1RICI,KD=RD2CD,TL=RD1CD.K_P = \frac{R_{P_2}}{R_{P_1}},\quad K_I = \frac{1}{R_IC_I},\quad K_D = R_{D_2}C_D,\quad T_L = R_{D_1}C_D.

(The derivative is of real form, see PID Controllers and Bode Method DesignPID controllers exist in parallel and series forms, ideal and real (with a pole on the derivative), and are designed with the Bode method by choosing the controller type and gain from the steady-state specifications and then the PID parameters that give the required gain and phase correction at the crossover frequency.PID Controllers and Bode Method Design →; signs from the inverting stages are not discussed on the slide.)

Series implementation. A single op-amp whose input path is the parallel of RDR_D and CDC_D followed by the series resistor RR, and whose feedback path contains CIC_I and RIR_I in series (as drawn on the slide):

VO(s)VI(s)=KC(1+τIsτIs)(1+τDs1+τLs)\frac{V_O(s)}{V_I(s)} = K_C\left(\frac{1 + \tau_I s}{\tau_I s}\right)\left(\frac{1 + \tau_D s}{1 + \tau_L s}\right)

with, as printed on the slide,

KC=RIR+RD,τI=RICI,τD=R RD CDR+RD,τL=R RD CDR+RD.K_C = \frac{R_I}{R + R_D},\quad \tau_I = R_IC_I,\quad \tau_D = \frac{R\,R_D\,C_D}{R + R_D},\quad \tau_L = \frac{R\,R_D\,C_D}{R + R_D}.

Flag: on the slide τD\tau_D and τL\tau_L are printed with the same expression, which would make the lead-lag factor equal to 1, so one of the two is probably a misprint in the original slide (a direct analysis of the circuit as drawn gives τD=RDCD\tau_D = R_DC_D). Check against the source before using it.

Digital control systems

In a digital control system the controller operates on digital signals (discrete in time and amplitude). It consists of a digital processing unit (microcontroller, DSP, FPGA, PLC, ...) properly interfaced with the plant.

                   Digital processing unit
        +-------------------------------------------+
 r[k]   |  e[k]  +-----------+ u[k] +-----+          |  u(t)   +-------+  y(t)
 ------>O------->|  Digital  |----->| D/A |----------|-------->| Plant |---+---> 
        ^ -      | controller|      +-----+          |         +-------+   |
        |        +-----------+                       |                     |
        |  y[k]            +-----+                   |                     |
        +------------------| A/D |<------------------|---------------------+
                           +-----+                   |
        +-------------------------------------------+

Signals: r[k]r[k] reference, e[k]e[k] error, u[k]u[k] digital command (coded values on the vertical axis of the slide: 001 to 101), u(t)u(t) piecewise-constant analog command, y(t)y(t) plant output, y[k]y[k] digital measurement.

Advantages flexible and easy to reconfigure (even during operation); possibility to integrate advanced functionalities (supervision logic, fault management, alarms, etc.); not affected by component tolerances and aging
Drawbacks piecewise-constant control signal; feedback from the output only at the sampling instants; possible instability if the sampling period is large

Sampling

The controller operates on samples y[k]y[k] of the analog signal y(t)y(t), taken at the sampling instants tk=kTst_k = kT_s, where TsT_s is the sampling period and Fs=1/TsF_s = 1/T_s is the sampling frequency:

y[k]≜y(tk)=y(kTs).y[k] \triangleq y(t_k) = y(kT_s).

Note: uniform sampling is assumed, i.e. TsT_s is constant. See Sampling and the Sampling TheoremSampling multiplies a continuous-time signal by a pulse train, which replicates its spectrum every omega_s; if the signal is band-limited with maximum angular frequency omega_M and omega_s exceeds 2 omega_M, an ideal low-pass filter recovers it exactly (Shannon theorem and sinc interpolation formula).Sampling and the Sampling Theorem → and Aliasing and Anti-Aliasing FiltersAliasing is the overlap of spectral replicas that occurs when the band-limited or Nyquist assumptions of the sampling theorem fail; an anti-aliasing low-pass filter with cut-off omega_s/2 applied before sampling removes it at the price of losing the high frequencies; two worked exercises.Aliasing and Anti-Aliasing Filters → for the theory.

Analog-to-digital conversion (A/D)

A/D conversion consists of sampling the signal y(t)y(t) at the instants tk=kTst_k = kT_s, followed by encoding the samples y(tk)y(t_k) into numerical values y[k]y[k]. These operations are performed by an analog-to-digital converter (ADC); however, there are cases in which the sensor directly provides a numerical value (for example a position encoder).

The A/D chain of the slides is

y(t)→ideal sampler, Tsy[k]→quantizer Q(⋅)y^[k]→encodery^B[k].y(t) \xrightarrow{\text{ideal sampler, } T_s} y[k] \xrightarrow{\text{quantizer } Q(\cdot)} \hat y[k] \xrightarrow{\text{encoder}} \hat y_B[k].

  • Ideal sampler: provides the samples y[k]=y(kTs)y[k] = y(kT_s) of the input analog signal.
  • Quantizer: discretizes ("quantizes") the amplitudes of the samples y[k]y[k] into a finite number of possible levels.
  • Encoder: assigns a numerical code (for example binary) to each output level of the quantizer.

Rounding quantization and binary coding

The slide shows a rounding quantizer with quantization step qq:

Q(x)=n qfor (n−12)q≤x<(n+12)q.Q(x) = n\,q\qquad \text{for } \left(n - \tfrac{1}{2}\right)q \le x < \left(n + \tfrac{1}{2}\right)q.

The staircase has transitions at ±q/2, ±3q/2, ±5q/2,…\pm q/2,\ \pm 3q/2,\ \pm 5q/2,\dots and output levels …,−2q,−q,0,q,2q,3q,…\dots, -2q, -q, 0, q, 2q, 3q,\dots. The example in the slide has eight levels, from −4q-4q to 3q3q, and two binary codings:

Level Two's complement Offset binary
3q3q 011 111
2q2q 010 110
qq 001 101
00 000 100
−q-q 111 011
−2q-2q 110 010
−3q-3q 101 001
−4q-4q 100 000

Digital-to-analog conversion (D/A)

D/A conversion typically consists of holding the control signal u[k]u[k] constant over the entire sampling interval [kTs,(k+1)Ts][kT_s, (k+1)T_s]. It is performed by a digital-to-analog converter (DAC); however, there are cases in which the actuator directly accepts a numerical value (for example a stepper motor).

The D/A chain of the slides is

u^B[k]→decoderu^[k]→quantizer Q(⋅)u[k]→ZOHu(t).\hat u_B[k] \xrightarrow{\text{decoder}} \hat u[k] \xrightarrow{\text{quantizer } Q(\cdot)} u[k] \xrightarrow{\text{ZOH}} u(t).

  • Decoder: assigns an output level to each numerical input code (for example binary).
  • Quantizer: discretizes the amplitudes of the samples u^[k]\hat u[k] into a finite number of levels (which may differ from those of the ADC).
  • Zero-Order Hold (ZOH): holds the value u[k]u[k] constant over the entire sampling interval [kTs,(k+1)Ts][kT_s, (k+1)T_s].

The control routine

The digital controller runs a control routine at regular time intervals. The execution is typically triggered by an interrupt generated by a hardware timer (real-time clock).

 real-time clock interrupt
          |
          v
 start of control routine
 1. acquire the reference r[k] and the output y[k]
 2. compute the control error e[k]
 3. compute the control input u[k]  (typically by a difference equation relating e[k] with u[k])
 4. send the control signal to the actuator
 end of control routine

The difference equation is the discrete-time model of the controller, see Difference EquationsRecursive constant-coefficient linear difference equations (ARMA models) are the discrete-time counterpart of ODEs: the delay operator replaces the derivative, the modes are k^m lambda^k with lambda a root of the characteristic polynomial, and the solution splits into a natural and a forced response.Difference Equations →.

Nature of a digital control system

A digital control system is:

  • time-varying, due to sampling;
  • nonlinear, due to quantization in the A/D and D/A conversions, and in the execution of the control routine (fixed-point versus floating-point arithmetic).

Sampled-data systems

For simplicity, quantization effects are neglected from now on. The resulting control system is called sampled-data or hybrid-time system.

  • The A/D and D/A blocks are replaced by an ideal sampler and a ZOH.
  • Continuous-time and discrete-time signals coexist.
  • Signals are not discretized in amplitude (no quantization).

The discrete-time control unit contains the discrete-time controller (input e[k]=r[k]−y[k]e[k] = r[k] - y[k], output u[k]u[k]); the ZOH produces u(t)u(t) for the plant; the output y(t)y(t) is sampled with period TsT_s to give y[k]y[k].

Note on quantization: quantization generally affects steady-state accuracy (it may induce persistent oscillations, known as limit cycles). It can be neglected if the quantization step is sufficiently small compared to the full scale of the signals.

Error-sampled control system

Rather than sampling the reference and the output, one may sample the tracking error e(t)=r(t)−y(t)e(t) = r(t) - y(t). The resulting sampled-data control system is known as an error-sampled control system: e(t)e(t) is sampled at TsT_s to give e[k]e[k], then discrete-time controller, ZOH, plant.

Design of a sampled-data control system

  1. Continuous-time design (design by emulation): the controller is designed in continuous time and then converted to discrete time using a discretization procedure. The part replaced is: sampler, discrete-time controller, ZOH. The methods are in Discretization Methods for ControllersDesign by emulation discretizes a continuous-time controller with impulse or step invariance or with numerical integration rules (forward Euler, backward Euler, Tustin), choosing the sampling frequency 10 to 20 times or more above the bandwidth, and accounting for the half-sample delay of the zero-order hold.Discretization Methods for Controllers →.
  2. Discrete-time design (direct digital design): the controller is designed directly in the discrete-time domain, using a discrete-time equivalent model of the plant (the ZOH, the plant and the sampler together, seen from u[k]u[k] to y[k]y[k]).

Versione ripasso

Analog control: continuous signals, op-amp circuits; compatible with continuous plants and well-known design, but sensitive to tolerances and aging and hard to reconfigure.

Op-amp PID (parallel): C=KP+KI/s+KDs/(1+TLs)C = K_P + K_I/s + K_Ds/(1 + T_Ls), KP=RP2/RP1K_P = R_{P_2}/R_{P_1}, KI=1/(RICI)K_I = 1/(R_IC_I), KD=RD2CDK_D = R_{D_2}C_D, TL=RD1CDT_L = R_{D_1}C_D. Series form: KC=RI/(R+RD)K_C = R_I/(R + R_D), τI=RICI\tau_I = R_IC_I (the printed τD\tau_D and τL\tau_L coincide: probable misprint).

Digital control: processing unit (microcontroller, DSP, FPGA, PLC) + A/D + D/A. Flexible, reconfigurable, immune to aging; but piecewise-constant command, feedback only at sampling instants, possible instability for large TsT_s.

Sampling: tk=kTst_k = kT_s, Fs=1/TsF_s = 1/T_s, y[k]=y(kTs)y[k] = y(kT_s), uniform.

A/D: ideal sampler, quantizer, encoder. Rounding quantizer: Q(x)=nqQ(x) = nq for (n−12)q≤x<(n+12)q(n - \tfrac12)q \le x < (n + \tfrac12)q. Codings: two's complement, offset binary.

D/A: decoder, quantizer, ZOH (holds u[k]u[k] over [kTs,(k+1)Ts][kT_s, (k+1)T_s]).

Control routine (timer interrupt): acquire r[k]r[k], y[k]y[k]; compute e[k]e[k]; compute u[k]u[k] with a difference equation; send to actuator.

Nature: time-varying (sampling), nonlinear (quantization, fixed vs floating point).

Sampled-data system: no quantization; ideal sampler + ZOH; mixed continuous/discrete signals. Quantization may cause limit cycles; negligible for a small step. Variant: error-sampled system.

Design: (1) emulation: design in continuous time, then discretize; (2) direct digital design: design in discrete time on the discrete-time equivalent of the plant.

Quantizzatore arrotondato: soglie a ±q/2, ±3q/2, ±5q/2,…\pm q/2,\ \pm 3q/2,\ \pm 5q/2,\dots e livelli …,−q,0,q,2q,…\dots, -q, 0, q, 2q, \dots. Esempio a 8 livelli da −4q-4q a 3q3q:

  • complemento a due: 3q→0113q \to 011, 0→0000 \to 000, −4q→100-4q \to 100;
  • binario con offset: 3q→1113q \to 111, 0→1000 \to 100, −4q→000-4q \to 000.

Routine di controllo (ad ogni interrupt del timer):

  1. acquisizione di r[k]r[k] e y[k]y[k];
  2. calcolo di e[k]=r[k]−y[k]e[k] = r[k] - y[k];
  3. calcolo di u[k]u[k] con l'equazione alle differenze;
  4. invio di u[k]u[k] all'attuatore.

Natura del sistema digitale: tempo variante per il campionamento, non lineare per la quantizzazione (aritmetica in virgola fissa o mobile).

Sistema campionato (senza quantizzazione): A/D e D/A diventano campionatore ideale e ZOH; u(t)u(t) è costante a tratti; y(t)y(t) viene campionato con TsT_s. Variante: si campiona l'errore e(t)e(t) invece di rr e yy.

Due vie di progetto:

Errori tipici:

  • Confondere campionamento (discretizza il tempo) con quantizzazione (discretizza l'ampiezza).
  • Ritenere il sistema digitale lineare: la quantizzazione lo rende non lineare.
  • Dimenticare lo ZOH nel modello discreto equivalente dell'impianto.
  • Ignorare i limit cycle con quantizzazione grossolana.

Teoria collegata