Salta al contenuto
Note per Studenti Sampled-Data Control Design - Emulation and Direct Design Report

Sampled-Data Control Design - Emulation and Direct Design

In questa pagina 6

This note collects the slides of lab activity 5 (digital speed PI control of a DC servomotor). It complements Digital Control SystemsA digital control system replaces the analog controller with a processing unit interfaced to the plant through an A/D converter (sampling plus quantization) and a D/A converter (zero-order hold), and neglecting quantization it becomes a sampled-data system that can be designed by emulation or directly in discrete time.Digital Control Systems → and 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 →; the controller to be designed is the speed PI of Lab Activity - Speed P and PI Control Loop SimulationSimulation tasks to close a speed loop around the Simulink servomotor model, first with a proportional controller that cannot give zero steady-state error and then with a PI controller that does, using a square-wave speed reference of plus and minus 250 rpm and the three speed filters.Lab Activity - Speed P and PI Control Loop Simulation →, and a numerical exercise on the same loop is in Numerical Lab - Simulation with Noise and QuantizationNumerical lab session on a sampled-data speed controller for a DC motor: discrete-time derivative filters compared on Bode plots and on a noisy ramp, then a P and a PI speed loop simulated first with the Control System Toolbox and then in Simulink with DAC and encoder quantization and actuator saturation.Numerical Lab - Simulation with Noise and Quantization →.

1. Sampled-data and digital control systems

  • Sampled-data system: a system where continuous-time and discrete-time signals coexist.
  • Digital control system: a closed-loop control system where a continuous-time plant is controlled by a digital controller.
 r[k]  e[k]            u[k]            u(t)             y(t)
 ---->(+)---> C(z) ---> DAC ---> ZOH-like staircase ---> P(s) ---+------>
       ^ -                                                       |
       |            y[k]                                         |
       +------------- ADC <--------------------------------------+
 |<---- digital controller ---->|<----------- continuous-time plant ----------->|

The digital controller works on the sequences r[k]r[k], e[k]e[k], u[k]u[k], y[k]y[k]; the DAC turns the sequence u[k]u[k] into a piecewise-constant signal u(t)u(t), the plant P(s)P(s) produces the continuous output y(t)y(t), and the ADC samples it into y[k]y[k]. Seen from the digital controller, the part DAC + P(s)P(s) + ADC is a discrete-time plant P(z)P(z). The handwritten remark stresses that the continuous-time controller C(s)C(s) and its digital counterpart C~(s)\tilde C(s) are not the same system: C(s)≠C~(s)C(s)\ne\tilde C(s), which is why the discretization has to be designed.

2. Two design routes

  1. Design by emulation (design in continuous time). The design is done in the continuous-time domain, with classical methods (Bode's method, root locus, ...) or modern methods (state space). Then a discrete-time controller approximating the response of the original continuous-time controller is obtained by a discretization procedure.
  2. Direct digital design (design in discrete time). The design is done directly in the discrete-time domain, after having obtained a discrete-time model of the plant (exact discretization of the continuous-time plant model).

The overview diagram of the lectures (labels in Italian in the original) is a cycle with four nodes: P(s)P(s) continuous plant, P(z)P(z) discrete plant, C(s)C(s) continuous controller, C(z)C(z) discrete controller.

  • P(s)→P(z)P(s)\to P(z): discretization of period TT, either approximate (Euler, trapezoidal: s≈s\approx a rational function of zz, Ad=I+TAA_d=I+TA, Bd=TBB_d=TB) or exact (P(z)=(1−z−1) Z ⁣[P(s)s]P(z)=(1-z^{-1})\,\mathcal Z\!\left[\frac{P(s)}{s}\right], Ad=eATA_d=e^{AT}, Bd=∫0TeAtB dtB_d=\int_0^T e^{At}B\,dt).
  • P(s)→C(s)P(s)\to C(s) (continuous design): from the transfer function, PID design C(s)=kP+kI1s+kDsC(s)=k_P+k_I\frac1s+k_Ds by dominant poles (root locus) or in frequency (phase margin, Bode); from the state-space model, pole placement (closed chain ≈s2+2ξωs+ω2\approx s^2+2\xi\omega s+\omega^2) or a linear quadratic regulator (LQR, treated in the Systems Theory course).
  • P(z)→C(z)P(z)\to C(z) (direct design): digital PID (a different course), pole placement (poles from the continuous ones as pz=epsTp_z=e^{p_sT}) or discrete LQR.
  • C(s)→C(z)C(s)\to C(z): discretization of the controller with the same two families (approximate with Euler or trapezoidal, or exact).

The slides highlight the emulation path as P(s)→C(s)→C(z)P(s)\to C(s)\to C(z) and the direct design path as P(s)→P(z)→C(z)P(s)\to P(z)\to C(z).

3. Design by emulation

Let C0(s)C_0(s) be the transfer function of the controller designed in continuous time with classical or modern methods. The discretization problem consists in finding a discrete-time controller C(z)C(z) such that the input-output transfer function of the sampled-data controller approximates (in some sense) the transfer function C0(s)C_0(s).

All the usual methods are obtained from one substitution with a parameter α\alpha:

s=1T z−1αz+1−αC0(s) →discretization C(z)s=\frac1T\,\frac{z-1}{\alpha z+1-\alpha}\qquad C_0(s)\ \xrightarrow{\text{discretization}}\ C(z)

The meaning of α\alpha is the rule used to approximate the area under the curve ff between kTkT and (k+1)T(k+1)T in a numerical integration (the controller integral action):

  • α=0\alpha=0: rectangle with height f(kT)f(kT) (left value);
  • α=1\alpha=1: rectangle with height f((k+1)T)f((k+1)T) (right value);
  • α=1/2\alpha=1/2: trapezoid with vertices f(kT)f(kT) and f((k+1)T)f((k+1)T).
Discretization method α\alpha Variable substitution
Forward Euler 00 s=z−1Ts=\dfrac{z-1}{T}
Backward Euler 11 s=z−1T zs=\dfrac{z-1}{T\,z}
Trapezoidal / Tustin 1/21/2 s=2T z−1z+1s=\dfrac{2}{T}\,\dfrac{z-1}{z+1}

Image of the stable region

Which part of the zz-plane receives the left half plane Re(s)<0\text{Re}(s)<0 under each substitution (figures of the slides, in the zz-plane, with the unit circle drawn):

  • Forward Euler: the whole half plane Re(z)<1\text{Re}(z)<1 (a stable continuous pole can land outside the unit circle, so stability may be lost);
  • Backward Euler: the disc of radius 1/21/2 centred at z=1/2z=1/2 (inside the unit circle, so stability is always preserved, but the stable region is shrunk);
  • Trapezoidal (Tustin): exactly the unit disc (the left half plane is mapped onto the stable region of discrete systems).

(These regions are checked directly on the substitutions: for s=z−1Ts=\frac{z-1}{T}, z=1+Tsz=1+Ts; for s=z−1Tzs=\frac{z-1}{Tz}, z=11−Tsz=\frac{1}{1-Ts}; for the trapezoidal rule, z=1+Ts/21−Ts/2z=\frac{1+Ts/2}{1-Ts/2}.)

4. Direct design: exact discretization of P(s)P(s)

Place a zero-order hold H0H_0 and a sampler of period TT around P(s)P(s): the discrete plant P(z)P(z) must give the same samples as the continuous plant, y(k)=y~(k)y(k)=\tilde y(k).

          +----------------------------> [ P(z) ] -----------> y(k)
 u(k) ----+                                                        ||
          +--> [ H0 ] --> [ P(s) ] --> ( sampler T ) -----------> y~(k)

Start from the state-space form of P(s)P(s):

P(s)=C(sI−A)−1B+D  ⟺  {x˙(t)=Ax(t)+Bu(t)y(t)=Cx(t)+Du(t)P(s)=C(sI-A)^{-1}B+D\iff\begin{cases}\dot x(t)=Ax(t)+Bu(t)\\ y(t)=Cx(t)+Du(t)\end{cases}

With the ZOH, u(t)=u(kT)u(t)=u(kT) for kT≤t≤(k+1)TkT\le t\le(k+1)T, and the variation-of-constants formula gives

x((k+1)T)=eATx(kT)+∫kT(k+1)TeA((k+1)T−τ)B u(τ) dτ=eATx(kT)+(∫0TeAτB dτ)u(kT).x((k+1)T)=e^{AT}x(kT)+\int_{kT}^{(k+1)T}e^{A((k+1)T-\tau)}B\,u(\tau)\,d\tau=e^{AT}x(kT)+\left(\int_0^T e^{A\tau}B\,d\tau\right)u(kT).

(The slide writes the exponent as A(t−τ)A(t-\tau) and the upper limit as (K+1)T(K+1)T; the second line shows the result after the change of variable and with uu constant over the interval.) Hence the exact discrete-time model

{xk+1=Adxk+Bdukyk=Cdxk+DdukAd=eAT,Bd=∫0TeAτB dτ,Cd=C,Dd=D\begin{cases}x_{k+1}=A_dx_k+B_du_k\\ y_k=C_dx_k+D_du_k\end{cases}\qquad A_d=e^{AT},\quad B_d=\int_0^Te^{A\tau}B\,d\tau,\quad C_d=C,\quad D_d=D

with transfer function

P(z)=Cd(zI−Ad)−1Bd+Dd.P(z)=C_d(zI-A_d)^{-1}B_d+D_d .

In MATLAB this is the c2d routine with the 'zoh' method, as used in Numerical Lab - Simulation with Noise and QuantizationNumerical lab session on a sampled-data speed controller for a DC motor: discrete-time derivative filters compared on Bode plots and on a noisy ramp, then a P and a PI speed loop simulated first with the Control System Toolbox and then in Simulink with DAC and encoder quantization and actuator saturation.Numerical Lab - Simulation with Noise and Quantization →. See also 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 → and Bilateral Z-TransformThe bilateral Z-transform X_B(z) = sum x(k) z^{-k} is the discrete-time counterpart of the Laplace transform; it converges only on a region of convergence (an annulus-type region), extends the DTFT when the unit circle is in the ROC, has an inversion formula and properties such as linearity, shift, time reversal and convolution.Bilateral Z-Transform → for the discrete-time side.

5. Eigenvalue (pole) mapping

Fact (relationship between continuous- and discrete-time plant eigenvalues). The eigenvalues si∈Cs_i\in\mathbb C, i=1,…,ni=1,\dots,n, of AA are related to the eigenvalues zi∈Cz_i\in\mathbb C of Φ=eAT\Phi=e^{AT} by

zi=esiT,i=1,…,n.z_i=e^{s_iT},\qquad i=1,\dots,n.

In particular:

  1. the imaginary axis s=jωs=j\omega is mapped into the unit circle ∣z∣=1|z|=1;
  2. the point s=0s=0 is mapped into z=1z=1;
  3. the left half plane of the ss-plane is mapped into the region within the unit circle in the zz-plane.

For a pair of complex poles characterised by natural frequency ωn\omega_n and damping δ\delta:

s=σ+jω≈−δωn±jωn1−δ2 ⟶ z=esT.s=\sigma+j\omega\approx-\delta\omega_n\pm j\omega_n\sqrt{1-\delta^2}\ \longrightarrow\ z=e^{sT}.

Links with the continuous-time specifications (Second-Order System Step ResponseThe unit step response of a BIBO stable second-order system with complex conjugate poles is W(0) times one minus an exponentially decaying sinusoid, and its rise time, settling time and overshoot are approximately 1.8 over the natural frequency, 4.6 over the real part of the pole magnitude, and exp of minus pi times the damping ratio over the square root of one minus its square.Second-Order System Step Response →, Stability of Dynamical SystemsFor an LTI system the response to a perturbation of an equilibrium does not depend on the equilibrium or on the perturbation amplitude, so stability reduces to the free evolution being bounded (stable) or vanishing (asymptotically stable), decided by the roots of the characteristic polynomial, and is related to BIBO stability.Stability of Dynamical Systems →):

  • Isodecay curves (σ\sigma constant, vertical lines in the ss-plane) map into circles of radius eσTe^{\sigma T} centred at the origin. The region of eigenvalues associated with modes decaying faster than eσ0te^{\sigma_0t} is Sσ={s=σ+jω∈C: σ<σ0, ω∈R},S_\sigma=\{s=\sigma+j\omega\in\mathbb C:\ \sigma<\sigma_0,\ \omega\in\mathbb R\}, which is a half plane in the ss-plane and a disc centred at 00 in the zz-plane (radius eσ0Te^{\sigma_0T}).
  • Isodamping curves (δ\delta constant, rays from the origin in the ss-plane) map into spirals in the zz-plane. The region of eigenvalues with damping ratio greater than δ0\delta_0 is a wedge in the ss-plane and, in the zz-plane, a heart-shaped region touching the unit circle at z=1z=1. (The slide writes the set as Sδ={s=−δωn±jωn1−δ2:0≤δ≤δ0<1, ωn>0}S_\delta=\{s=-\delta\omega_n\pm j\omega_n\sqrt{1-\delta^2}:0\le\delta\le\delta_0<1,\ \omega_n>0\}, while the caption and the picture shade the region with damping ratio greater than δ0\delta_0: the inequality printed on the slide appears reversed.)
  • The zz-plane figures also carry the grid of constant ωn\omega_n (labels like 0.1π/T,…,π/T0.1\pi/T,\dots,\pi/T) and constant δ\delta (labels 0.1,…,0.90.1,\dots,0.9), which allows reading ωn\omega_n and δ\delta from the position of a discrete pole for a given TT.

6. Direct digital design with the Control System Designer

The slide shows the Control System Designer (sisotool) of the Control System Toolbox, used with the root locus method (Bode editor and root locus editor open on the loop transfer function LoopTransfer_C). In the architecture the blocks are F, C, G, H; the available responses are LoopTransfer_C, IOTransfer_r2y, IOTransfer_r2u, IOTransfer_du2y, IOTransfer_dy2y, IOTransfer_n2y. The tunable block CC in the example has sample time 0.020.02 and value 0.22857 (z−0.3)z−1\dfrac{0.22857\,(z-0.3)}{z-1}: a discrete PI controller with a zero at z=0.3z=0.3 and a pole at z=1z=1. The root locus editor shows the locus on the zz-plane together with the unit circle and the regions of constant damping and natural frequency, so the poles can be placed with the specifications of Section 5. (Controller structure in The Root LocusThe positive root locus is the set of closed-loop poles of the loop with a proportional controller C(s)=K, K>=0, as K varies; it consists of n branches that start at the poles of G(s) and end at its zeros or at infinity along asymptotes, and four sketching rules (real-axis rule, asymptotes with centroid, multiple points) let one draw it and read off stability and transient requirements.The Root Locus →.)

Versione ripasso

Definitions

  • Sampled-data system: continuous and discrete signals coexist. Digital control system: continuous plant, digital controller (DAC, ADC); C(s)≠C~(s)C(s)\ne\tilde C(s).

Two routes

  • Emulation: design C0(s)C_0(s) in continuous time, then discretize to get C(z)C(z).
  • Direct digital design: exactly discretize P(s)P(s) to P(z)P(z), design C(z)C(z) in discrete time.

Emulation: s=1Tz−1αz+1−αs=\dfrac1T\dfrac{z-1}{\alpha z+1-\alpha}

Method α\alpha ss
Forward Euler 00 z−1T\dfrac{z-1}{T}
Backward Euler 11 z−1Tz\dfrac{z-1}{Tz}
Tustin 1/21/2 2Tz−1z+1\dfrac2T\dfrac{z-1}{z+1}
  • Stable region image: FE gives the half plane Re(z)<1\text{Re}(z)<1 (can destabilise); BE gives the disc of radius 1/21/2 centred at 1/21/2 (always stable); Tustin gives exactly the unit disc.

Exact discretization (ZOH) Ad=eAT,Bd=∫0TeAτB dτ,Cd=C,Dd=D,P(z)=Cd(zI−Ad)−1Bd+DdA_d=e^{AT},\quad B_d=\int_0^Te^{A\tau}B\,d\tau,\quad C_d=C,\quad D_d=D,\quad P(z)=C_d(zI-A_d)^{-1}B_d+D_d (c2d with 'zoh').

Pole mapping: zi=esiTz_i=e^{s_iT}. Imaginary axis to unit circle; s=0s=0 to z=1z=1; left half plane to the interior of the unit circle. s≈−δωn±jωn1−δ2→z=esTs\approx-\delta\omega_n\pm j\omega_n\sqrt{1-\delta^2}\to z=e^{sT}.

  • Isodecay σ\sigma: vertical lines to circles (radius eσTe^{\sigma T}); σ<σ0\sigma<\sigma_0 gives a disc.
  • Isodamping δ\delta: rays to spirals; damping greater than δ0\delta_0 gives a heart-shaped region touching z=1z=1.

Tool: sisotool (Control System Designer), root locus on zz-plane; example PI with sample time 0.020.02: 0.22857(z−0.3)z−1\dfrac{0.22857(z-0.3)}{z-1}.

Typical error: placing discrete poles by reading the ss-plane specifications directly, without mapping them through z=esTz=e^{sT}.

Percorsi di progetto:

  • Emulazione: P(s)→C(s)→C(z)P(s) \to C(s) \to C(z), cioè progetto continuo (Bode, luogo delle radici o stato) poi discretizzazione del controllore.
  • Progetto diretto: P(s)→P(z)→C(z)P(s) \to P(z) \to C(z), cioè discretizzazione esatta dell'impianto poi progetto in zz.

Significato di α\alpha: la regola per l'area sotto ff tra kTkT e (k+1)T(k+1)T: α=0\alpha = 0 rettangolo con il valore a sinistra; α=1\alpha = 1 rettangolo con il valore a destra; α=1/2\alpha = 1/2 trapezio.

Controlli sulla regione stabile (dalle sostituzioni):

  • FE: z=1+Tsz = 1 + Ts, con Re(s)<0\text{Re}(s)<0 che dà Re(z)<1\text{Re}(z)<1.
  • BE: z=11−Tsz = \dfrac{1}{1-Ts}, cioè il disco di centro 1/21/2 e raggio 1/21/2.
  • Tustin: z=1+Ts/21−Ts/2z = \dfrac{1+Ts/2}{1-Ts/2}, cioè il disco unitario.

Discretizzazione esatta, passi:

  1. Stato: x˙=Ax+Bu\dot x = Ax + Bu, y=Cx+Duy = Cx + Du.
  2. Con ZOH uu costante su [kT,(k+1)T)[kT, (k+1)T): x((k+1)T)=eATx(kT)+(∫0TeAτB dτ)u(kT)x((k+1)T) = e^{AT}x(kT) + \left(\int_0^T e^{A\tau}B\,d\tau\right)u(kT).
  3. Modello discreto: Ad=eATA_d = e^{AT}, Bd=∫0TeAτB dτB_d = \int_0^T e^{A\tau}B\,d\tau, Cd=CC_d = C, Dd=DD_d = D; P(z)=Cd(zI−Ad)−1Bd+DdP(z) = C_d(zI - A_d)^{-1}B_d + D_d.

Mappatura dei poli per una coppia complessa: s≈−δωn±jωn1−δ2s \approx -\delta\omega_n \pm j\omega_n\sqrt{1-\delta^2} diventa z=esTz = e^{sT}. Le curve isodecay (σ\sigma costante, rette verticali) diventano cerchi di raggio eσTe^{\sigma T}; le isodamping (raggi) diventano spirali.

Esempio con sisotool: controllore tunable CC con tempo di campionamento 0.020.02 s e valore 0.22857(z−0.3)z−1\dfrac{0.22857(z-0.3)}{z-1}, cioè un PI discreto con zero in z=0.3z = 0.3 e polo in z=1z=1.

Errori tipici:

  • Confondere C(s)C(s) con il suo equivalente discreto C~(s)\tilde C(s): sono sistemi diversi.
  • Usare BE come metodo sempre stabile senza notare che restringe la regione stabile al disco di raggio 1/21/2.
  • Leggere le specifiche sul piano zz come se fossero sul piano ss: il mapping è z=esTz = e^{sT}.

Teoria collegata