Salta al contenuto
Note per Studenti Discretization Methods for Controllers Report

Discretization Methods for Controllers

In questa pagina 5

This note follows 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 →: in design by emulation (continuous-time design) the controller C(s)C(s) is designed in continuous time (for example with 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 →) and then converted to a discrete-time controller Cˉ(z)\bar C(z) with a discretization procedure.

Discretization methods

Discretization methods of a continuous-time controller (list from the slides):

  • A) Response invariance methods: A-1 impulse invariance method, A-2 step invariance method.
  • B) Methods based on numerical integration techniques: B-1 forward difference method (forward Euler), B-2 backward difference method (backward Euler), B-3 bilinear transformation method (Tustin).
  • C) Pole-zero matching method.

The slides list method C in the outline but do not develop it in the pages read here.

Selection of the sampling frequency

The differences in behaviour between the controller C(s)C(s) and its discretized version C(z)C(z) generally depend on the discretization method and on the sampling frequency. To obtain satisfactory results the sampling frequency ωs=2π/Ts\omega_s = 2\pi/T_s must be chosen much higher than the control bandwidth ωB\omega_B of the continuous-time control system: typically 10 to 20 times higher, depending on the discretization method.

Running example: position control of a DC motor

Plant P(s)=1s(s+1)P(s) = \dfrac{1}{s(s + 1)} with controller C(s)C(s) in the usual unit-feedback loop. Control design specifications:

  • steady-state tracking error ∣ess∣≤0.1\lvert e_{ss}\rvert \le 0.1 with r(t)=δ−2(t)r(t) = \delta_{-2}(t) (a ramp; it is implicitly assumed that ess=0e_{ss} = 0 for r(t)=δ−1(t)r(t) = \delta_{-1}(t));
  • gain crossover frequency ωgc≈5\omega_{gc} \approx 5 rad/s;
  • phase margin φm≈53∘\varphi_m \approx 53^\circ.

The controller given in the slides is the lead network

C(s)=50 s+2s+10,L(s)=C(s)P(s)=50(s+2)s (s+1)(s+10).C(s) = 50\,\frac{s + 2}{s + 10},\qquad L(s) = C(s)P(s) = \frac{50(s + 2)}{s\,(s + 1)(s + 10)}.

Its Bode plot has ∣C(jω)∣\lvert C(j\omega)\rvert rising from 20 dB (low-frequency gain 50⋅2/10=1050\cdot 2/10 = 10) to about 34 dB (high-frequency gain 50) between the corners at 2 and 10 rad/s, and a phase lead up to about 42∘42^\circ; the loop LL crosses 0 dB at ωgc≈5\omega_{gc} \approx 5 rad/s with phase margin φm≈53∘\varphi_m \approx 53^\circ (the dB values are read from the plot).

Choice of TsT_s. The sampling frequency is chosen as

ωs=25 ωgc=125 rad/s→ ωs=2π/Ts Ts≈0.05 s.\omega_s = 25\,\omega_{gc} = 125\ \text{rad/s}\quad \xrightarrow{\ \omega_s = 2\pi/T_s\ }\quad T_s \approx 0.05\ \text{s}.

Given that ωgc≈5B\omega_{gc} \approx 5B and (2πB) tr≈1.8(2\pi B)\,t_r \approx 1.8 (see Control System Design SpecificationsA control design starts from specifications on stability, steady-state and transient performance and robustness, which are stated on the closed-loop time or frequency response and then translated into a crossover frequency and a phase margin of the loop transfer function.Control System Design Specifications →), the rise time is tr≈0.29t_r \approx 0.29 s, so there are approximately tr/Ts≈6t_r/T_s \approx 6 complete sampling periods during the rise time of the closed-loop step response.

A) Response invariance methods

Idea. The discretized controller Cˉ(z)\bar C(z) is obtained by imposing that its output uˉ[k]\bar u[k] matches the sampled output u[k]u[k] of the analog controller C(s)C(s), in response to the same canonical input signal. The analog controller is driven by e(t)e(t) and its output sampled with period TsT_s; the discrete controller is driven by the samples eˉ[k]\bar e[k] of the same e(t)e(t).

A-1) Impulse invariance

Input e(t)=δ(t)e(t) = \delta(t) (so eˉ[k]=δ[k]\bar e[k] = \delta[k]). The analog output is u(t)=L−1[C(s)](t)u(t) = \mathcal{L}^{-1}[C(s)](t), whose samples are u[k]=L−1[C(s)](kTs)u[k] = \mathcal{L}^{-1}[C(s)](kT_s); the discrete output is uˉ[k]=Z−1{Cˉ(z)}[k]\bar u[k] = \mathcal{Z}^{-1}\{\bar C(z)\}[k]. Imposing u[k]=uˉ[k]u[k] = \bar u[k]:

Cˉ(z)=Z{uˉ[k]}(z)=Z{L−1[C(s)](kTs)}(z)≜Z{C(s)}(z).\bar C(z) = \mathcal{Z}\{\bar u[k]\}(z) = \mathcal{Z}\Big\{\mathcal{L}^{-1}[C(s)](kT_s)\Big\}(z) \triangleq \mathcal{Z}\{C(s)\}(z).

A-2) Step invariance

Input e(t)=δ−1(t)e(t) = \delta_{-1}(t) (so eˉ[k]=δ−1[k]\bar e[k] = \delta_{-1}[k]). The analog output samples are u[k]=L−1 ⁣[C(s)s](kTs)u[k] = \mathcal{L}^{-1}\!\left[\dfrac{C(s)}{s}\right](kT_s), and the discrete output is uˉ[k]=Z−1 ⁣{Cˉ(z)1−z−1}[k]\bar u[k] = \mathcal{Z}^{-1}\!\left\{\dfrac{\bar C(z)}{1 - z^{-1}}\right\}[k] (the Z\mathcal{Z}-transform of the step is 1/(1−z−1)1/(1 - z^{-1})). Imposing u[k]=uˉ[k]u[k] = \bar u[k]:

Cˉ(z)1−z−1=Z{L−1 ⁣[C(s)s](kTs)}(z)  ⇒  Cˉ(z)≜(1−z−1) Z{C(s)s}(z)\frac{\bar C(z)}{1 - z^{-1}} = \mathcal{Z}\Big\{\mathcal{L}^{-1}\!\Big[\frac{C(s)}{s}\Big](kT_s)\Big\}(z)\;\Rightarrow\;\boxed{\bar C(z) \triangleq (1 - z^{-1})\,\mathcal{Z}\Big\{\frac{C(s)}{s}\Big\}(z)}

(See 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 transform pairs.)

Example: step invariance on the DC-motor controller

With Ts=0.05T_s = 0.05 s:

C(s)s=50s s+2s+10=10s+40s+10\frac{C(s)}{s} = \frac{50}{s}\,\frac{s + 2}{s + 10} = \frac{10}{s} + \frac{40}{s + 10}

L−1 ⁣[C(s)s](t)=10+40 e−10t (t≥0)  ⇒  L−1 ⁣[C(s)s](kTs)=10+40 e−0.5k (k≥0)\mathcal{L}^{-1}\!\left[\frac{C(s)}{s}\right](t) = 10 + 40\,e^{-10t}\ (t \ge 0)\;\Rightarrow\;\mathcal{L}^{-1}\!\left[\frac{C(s)}{s}\right](kT_s) = 10 + 40\,e^{-0.5k}\ (k \ge 0)

Z{C(s)s}(z)=10zz−1+40zz−e−0.5=zz−1⋅50z−(40+10e−0.5)z−e−0.5\mathcal{Z}\Big\{\frac{C(s)}{s}\Big\}(z) = \frac{10z}{z - 1} + \frac{40z}{z - e^{-0.5}} = \frac{z}{z - 1}\cdot\frac{50z - (40 + 10e^{-0.5})}{z - e^{-0.5}}

Cˉ(z)=(1−z−1) Z{C(s)s}(z)=50z−46.07z−0.61.\bar C(z) = (1 - z^{-1})\,\mathcal{Z}\Big\{\frac{C(s)}{s}\Big\}(z) = \frac{50z - 46.07}{z - 0.61}.

The slides compare the two controllers: the step responses coincide at the sampling instants (starting at 50 and settling at 10), while the frequency responses of C(s)C(s) and Cˉ(z)\bar C(z) (plotted up to the Nyquist frequency ωN\omega_N) differ at high frequency: the magnitude of Cˉ(z)\bar C(z) goes up to about 35.5 dB against about 34 dB for C(s)C(s), and the phase of Cˉ(z)\bar C(z) goes to 0∘0^\circ at ωN\omega_N.

B) Methods based on numerical integration

Idea. Approximate the continuous-time integration operator with a discrete-time algorithm that "simulates" it.

Motivation. For a second-order controller

C(s)=U(s)E(s)=b1s+b0s2+a1s+a0=b1s+b0s21+a1s+a0s2C(s) = \frac{U(s)}{E(s)} = \frac{b_1s + b_0}{s^2 + a_1s + a_0} = \frac{\dfrac{b_1}{s} + \dfrac{b_0}{s^2}}{1 + \dfrac{a_1}{s} + \dfrac{a_0}{s^2}}

⇓(1+a1s+a0s2)U(s)=(b1s+b0s2)E(s)\Downarrow\quad \Big(1 + \frac{a_1}{s} + \frac{a_0}{s^2}\Big)U(s) = \Big(\frac{b_1}{s} + \frac{b_0}{s^2}\Big)E(s)

⇓U(s)=1s[b1E(s)−a1U(s)]+1s2[b0E(s)−a0U(s)]=1s{[b1E(s)−a1U(s)]+1s[b0E(s)−a0U(s)]}.\Downarrow\quad U(s) = \frac{1}{s}\big[b_1E(s) - a_1U(s)\big] + \frac{1}{s^2}\big[b_0E(s) - a_0U(s)\big] = \frac{1}{s}\Big\{\big[b_1E(s) - a_1U(s)\big] + \frac{1}{s}\big[b_0E(s) - a_0U(s)\big]\Big\}.

This is a block diagram made of gains b0b_0, b1b_1, a0a_0, a1a_1, two summing nodes (with minus signs on the a0a_0, a1a_1 feedback) and two integrators 1/s1/s in series, with the output U(s)U(s) fed back through a0a_0 and a1a_1 (see Block Diagram AlgebraA block diagram is a graph of elementary SISO linear blocks, branching points and summing nodes, and nine reduction rules (series, parallel, moving branching points and summing nodes, feedback) collapse it into one transfer function.Block Diagram Algebra →). By replacing each continuous-time integrator with a discrete-time approximation, a discrete equivalent C(z)C(z) of C(s)C(s) is obtained.

The integrator. For y(t)=∫0tu(τ)dτy(t) = \int_0^t u(\tau)d\tau:

y(kTs)=∫0kTsu(t)dt=∫0(k−1)Tsu(t)dt⏟=y((k−1)Ts)+∫(k−1)TskTsu(t)dt⏟area under u(t) over the last sampling period Ts.y(kT_s) = \int_0^{kT_s}u(t)dt = \underbrace{\int_0^{(k-1)T_s}u(t)dt}_{= y((k-1)T_s)} + \underbrace{\int_{(k-1)T_s}^{kT_s}u(t)dt}_{\text{area under }u(t)\text{ over the last sampling period }T_s}.

The integral over the last sampling period is approximated by:

  • rectangles (forward and backward Euler methods);
  • trapezoids (Tustin method).

B-1) Forward Euler (forward difference)

The area is approximated by the rectangle with height equal to the value at the start of the interval: ∫(k−1)TskTsu dt≈u((k−1)Ts) Ts\int_{(k-1)T_s}^{kT_s}u\,dt \approx u((k-1)T_s)\,T_s. Hence

y[k]=y[k−1]+Ts u[k−1]⇒Y(z)U(z)=Tsz−11−z−1=Tsz−1.y[k] = y[k-1] + T_s\,u[k-1]\quad\Rightarrow\quad \frac{Y(z)}{U(z)} = \frac{T_sz^{-1}}{1 - z^{-1}} = \frac{T_s}{z - 1}.

So 1/s1/s is replaced by Ts/(z−1)T_s/(z - 1), which is the substitution

s=z−1Ts,C(z)=C(s)∣s=z−1Ts.\boxed{s = \frac{z - 1}{T_s}},\qquad C(z) = C(s)\Big|_{s = \frac{z-1}{T_s}}.

Stability. Re[s]<0\mathrm{Re}[s] < 0 maps to Re ⁣[z−1Ts]z=σ+jω=Re ⁣[σ+jω−1Ts]=σ−1Ts<0\mathrm{Re}\!\left[\dfrac{z - 1}{T_s}\right]_{z = \sigma + j\omega} = \mathrm{Re}\!\left[\dfrac{\sigma + j\omega - 1}{T_s}\right] = \dfrac{\sigma - 1}{T_s} < 0, i.e. σ<1\sigma < 1: the left half-plane of ss becomes the half-plane Re[z]<1\mathrm{Re}[z] < 1, which contains the unit disc and much more. Consequence: a stable continuous-time C(s)C(s) can be transformed into an unstable discrete-time C(z)C(z).

B-2) Backward Euler (backward difference)

The rectangle has height equal to the value at the end of the interval: ∫(k−1)TskTsu dt≈u(kTs) Ts\int_{(k-1)T_s}^{kT_s}u\,dt \approx u(kT_s)\,T_s. Hence

y[k]=y[k−1]+Ts u[k]⇒Y(z)U(z)=Ts1−z−1=Ts zz−1,y[k] = y[k-1] + T_s\,u[k]\quad\Rightarrow\quad \frac{Y(z)}{U(z)} = \frac{T_s}{1 - z^{-1}} = \frac{T_s\,z}{z - 1},

and the substitution is

s=z−1Ts z,C(z)=C(s)∣s=z−1Tsz.\boxed{s = \frac{z - 1}{T_s\,z}},\qquad C(z) = C(s)\Big|_{s = \frac{z-1}{T_sz}}.

Stability. With z=σ+jωz = \sigma + j\omega:

Re ⁣[z−1Tsz]=Re ⁣[(σ+jω−1)(σ−jω)Ts(σ2+ω2)]=σ2−σ+ω2Ts(σ2+ω2)<0  ⇒  (σ−12)2+ω2<(12)2.\mathrm{Re}\!\left[\frac{z - 1}{T_sz}\right] = \mathrm{Re}\!\left[\frac{(\sigma + j\omega - 1)(\sigma - j\omega)}{T_s(\sigma^2 + \omega^2)}\right] = \frac{\sigma^2 - \sigma + \omega^2}{T_s(\sigma^2 + \omega^2)} < 0\;\Rightarrow\;\Big(\sigma - \frac12\Big)^2 + \omega^2 < \Big(\frac12\Big)^2.

The left half-plane of ss is mapped into the disc of center 1/21/2 and radius 1/21/2, inside the unit disc. Consequences: every stable C(s)C(s) is transformed into a stable C(z)C(z), but some unstable C(s)C(s) may be transformed into a stable C(z)C(z).

B-3) Tustin (bilinear transformation)

The area is approximated by the trapezoid: ∫(k−1)TskTsu dt≈[u((k−1)Ts)+u(kTs)]Ts2\int_{(k-1)T_s}^{kT_s}u\,dt \approx [u((k-1)T_s) + u(kT_s)]\dfrac{T_s}{2}. Hence

y[k]=y[k−1]+Ts2(u[k−1]+u[k])⇒Y(z)U(z)=Ts2 1+z−11−z−1=Ts2 z+1z−1,y[k] = y[k-1] + \frac{T_s}{2}\big(u[k-1] + u[k]\big)\quad\Rightarrow\quad \frac{Y(z)}{U(z)} = \frac{T_s}{2}\,\frac{1 + z^{-1}}{1 - z^{-1}} = \frac{T_s}{2}\,\frac{z + 1}{z - 1},

and the substitution is

s=2Ts z−1z+1,C(z)=C(s)∣s=2Tsz−1z+1.\boxed{s = \frac{2}{T_s}\,\frac{z - 1}{z + 1}},\qquad C(z) = C(s)\Big|_{s = \frac{2}{T_s}\frac{z-1}{z+1}}.

Stability. With z=σ+jωz = \sigma + j\omega:

Re ⁣[2Tsz−1z+1]=Re ⁣[2Ts (σ+jω−1)(σ−jω+1)(σ+1)2+ω2]=2Ts σ2−1+ω2(σ+1)2+ω2<0  ⇒  σ2+ω2<1.\mathrm{Re}\!\left[\frac{2}{T_s}\frac{z - 1}{z + 1}\right] = \mathrm{Re}\!\left[\frac{2}{T_s}\,\frac{(\sigma + j\omega - 1)(\sigma - j\omega + 1)}{(\sigma + 1)^2 + \omega^2}\right] = \frac{2}{T_s}\,\frac{\sigma^2 - 1 + \omega^2}{(\sigma + 1)^2 + \omega^2} < 0\;\Rightarrow\;\sigma^2 + \omega^2 < 1.

The left half-plane of ss is mapped exactly onto the unit disc. Consequences: every stable C(s)C(s) becomes a stable C(z)C(z), and every unstable C(s)C(s) becomes an unstable C(z)C(z).

Method Substitution Image of Re[s]<0\mathrm{Re}[s] < 0 Stability preserved
Forward Euler s=z−1Tss = \frac{z - 1}{T_s} half-plane Re[z]<1\mathrm{Re}[z] < 1 no: stable may become unstable
Backward Euler s=z−1Tszs = \frac{z - 1}{T_sz} disc centre 1/21/2, radius 1/21/2 stable stays stable; some unstable become stable
Tustin s=2Tsz−1z+1s = \frac{2}{T_s}\frac{z - 1}{z + 1} unit disc yes, in both directions

Note (slides): in general, the stability of the controller does not imply the stability of the closed-loop system, and vice versa.

Example: the three rules on C(s)=50 s+2s+10C(s) = 50\,\dfrac{s + 2}{s + 10}, Ts=0.05T_s = 0.05 s

1) Forward Euler:

CˉFE(z)=50 z−1Ts+2z−1Ts+10=50 z−1+2Tsz−1+10Ts=50 z−0.9z−0.5.\bar C_{FE}(z) = 50\,\frac{\frac{z-1}{T_s} + 2}{\frac{z-1}{T_s} + 10} = 50\,\frac{z - 1 + 2T_s}{z - 1 + 10T_s} = 50\,\frac{z - 0.9}{z - 0.5}.

2) Backward Euler (the slide heading says "(FE)", evidently a typo for BE):

CˉBE(z)=50 z−1Tsz+2z−1Tsz+10=50 (1+2Ts)z−1(1+10Ts)z−1=50 1.1z−11.5z−1=36.67 z−0.91z−0.67.\bar C_{BE}(z) = 50\,\frac{\frac{z-1}{T_sz} + 2}{\frac{z-1}{T_sz} + 10} = 50\,\frac{(1 + 2T_s)z - 1}{(1 + 10T_s)z - 1} = 50\,\frac{1.1z - 1}{1.5z - 1} = 36.67\,\frac{z - 0.91}{z - 0.67}.

3) Tustin:

CˉTU(z)=50 (2+2Ts)z+(2Ts−2)(10Ts+2)z+(10Ts−2)=50 2.1z−1.92.5z−1.5=42 z−0.9z−0.6.\bar C_{TU}(z) = 50\,\frac{(2 + 2T_s)z + (2T_s - 2)}{(10T_s + 2)z + (10T_s - 2)} = 50\,\frac{2.1z - 1.9}{2.5z - 1.5} = 42\,\frac{z - 0.9}{z - 0.6}.

Frequency-response comparison (slide plot up to the Nyquist frequency ωN\omega_N, values read from the plot): all discretized controllers match C(s)C(s) at low frequency; towards ωN\omega_N the forward-Euler version has the highest magnitude (about 36 dB, above the 34 dB of C(s)C(s)) and the largest phase lead (peak about 47∘47^\circ against about 42∘42^\circ for C(s)C(s)); the backward-Euler version is lower (about 32.5 dB, peak phase about 38∘38^\circ); the Tustin version follows C(s)C(s) most closely (about 34 dB, peak phase about 42∘42^\circ). All discrete phases fall to 0∘0^\circ at ωN\omega_N.

Effect of the zero-order hold

Note. Even if u[k]u[k] is a perfect replica at time t=kTst = kT_s of the output u(t)u(t) of the analog controller to emulate, the "hold" process of the ZOH introduces an effective time delay Td≈Ts/2T_d \approx T_s/2.

Continuous-time model of the ZOH. Replace the discrete-time input with its impulsive representation u⋆(t)u^\star(t) (an impulse train); the ZOH becomes a continuous-time system H0(s)H_0(s) whose impulse response is a rectangular pulse of height 1 and width TsT_s:

h0(t)=δ−1(t)−δ−1(t−Ts)→ L H0(s)=1s−e−sTss=1−e−sTssh_0(t) = \delta_{-1}(t) - \delta_{-1}(t - T_s)\quad\xrightarrow{\ \mathcal{L}\ }\quad \boxed{H_0(s) = \frac{1}{s} - \frac{e^{-sT_s}}{s} = \frac{1 - e^{-sT_s}}{s}}

(the slide writes δ−1(t−T)\delta_{-1}(t - T) with TT for TsT_s).

Frequency response. With s=jωs = j\omega:

H0(jω)=1−e−jωTsjω=e−jωTs2 ejωTs2−e−jωTs2jω=Ts e−jωTs/2 sin⁡ ⁣(ωTs2)ωTs2,H_0(j\omega) = \frac{1 - e^{-j\omega T_s}}{j\omega} = e^{-j\omega\frac{T_s}{2}}\,\frac{e^{j\omega\frac{T_s}{2}} - e^{-j\omega\frac{T_s}{2}}}{j\omega} = T_s\,e^{-j\omega T_s/2}\,\frac{\sin\!\big(\omega\frac{T_s}{2}\big)}{\omega\frac{T_s}{2}},

∣H0(jω)∣=∣Ts sin⁡ ⁣(ωTs2)ωTs2∣,∠H0(jω)=−ωTs2+∠sin⁡ ⁣(ωTs2).\lvert H_0(j\omega)\rvert = \left\lvert T_s\,\frac{\sin\!\big(\omega\frac{T_s}{2}\big)}{\omega\frac{T_s}{2}}\right\rvert,\qquad \angle H_0(j\omega) = -\frac{\omega T_s}{2} + \angle\sin\!\Big(\omega\frac{T_s}{2}\Big).

The plots in the slides, against ω/ωs\omega/\omega_s: 1Ts∣H0∣\frac{1}{T_s}\lvert H_0\rvert starts at 1 and has zeros at integer multiples of ωs\omega_s with decreasing lobes; the phase is a sawtooth falling linearly from 0∘0^\circ to −180∘-180^\circ between consecutive multiples of ωs\omega_s and jumping back to 0∘0^\circ at each multiple.

Low-frequency approximation.

H0(jω)≈Ts e−jωTs/2for ∣ω∣≤ωN=ωs2.H_0(j\omega) \approx T_s\,e^{-j\omega T_s/2}\qquad\text{for } \lvert\omega\rvert \le \omega_N = \frac{\omega_s}{2}.

So H0(s)H_0(s) is like a low-pass filter with bandwidth ≈ωN\approx \omega_N (the −3-3 dB point is close to ωN\omega_N on the slide plot).

Consequence: phase lag in the loop. The time delay introduced by the ZOH produces a phase lag in the loop transfer function:

∠H0(jω)≈−ωTs2for ω<ωN≜ωs2,\angle H_0(j\omega) \approx -\frac{\omega T_s}{2}\qquad\text{for } \omega < \omega_N \triangleq \frac{\omega_s}{2},

which reduces the phase margin φm\varphi_m achieved in the continuous-time design. This may result in a large overshoot in the step response of the sampled-data system.

Remedy (slides). The reduction of phase margin caused by the ZOH can be accounted for in the design of the continuous-time controller, by allocating an extra phase margin equal to the phase lag introduced by the ZOH at the desired gain crossover frequency, ωgcTs/2\omega_{gc}T_s/2.

Illustration with the running example (computed here from the slide formula, not stated on the slides): ωgc=5\omega_{gc} = 5 rad/s and Ts=0.05T_s = 0.05 s give a lag ωgcTs/2=0.125\omega_{gc}T_s/2 = 0.125 rad ≈7∘\approx 7^\circ.

Versione ripasso

Design by emulation: design C(s)C(s) in continuous time, then discretize to Cˉ(z)\bar C(z). Choose ωs=2π/Ts\omega_s = 2\pi/T_s about 10 to 20 times ωB\omega_B (example: ωgc=5\omega_{gc} = 5, ωs=25ωgc=125\omega_s = 25\omega_{gc} = 125 rad/s, Ts≈0.05T_s \approx 0.05 s, about 6 samples in tr≈0.29t_r \approx 0.29 s).

Methods: impulse invariance, step invariance, forward Euler, backward Euler, Tustin (pole-zero matching listed, not developed).

Response invariance: match the sampled output for the same canonical input.

  • Impulse: Cˉ(z)=Z{L−1[C(s)](kTs)}\bar C(z) = \mathcal{Z}\{\mathcal{L}^{-1}[C(s)](kT_s)\}.
  • Step: Cˉ(z)=(1−z−1) Z{C(s)/s}\bar C(z) = (1 - z^{-1})\,\mathcal{Z}\{C(s)/s\}.
  • Example C=50(s+2)/(s+10)C = 50(s+2)/(s+10): C/s=10/s+40/(s+10)C/s = 10/s + 40/(s+10), samples 10+40e−0.5k10 + 40e^{-0.5k}, Cˉ(z)=50z−46.07z−0.61\bar C(z) = \dfrac{50z - 46.07}{z - 0.61}.

Numerical integration of 1/s1/s (area over last period):

Method 1/s→1/s \to substitution s=s = stable image
Forward Euler Tsz−1\frac{T_s}{z-1} z−1Ts\frac{z-1}{T_s} Re z<1\mathrm{Re}\,z < 1 (stable can become unstable)
Backward Euler Tszz−1\frac{T_sz}{z-1} z−1Tsz\frac{z-1}{T_sz} disc centre 1/21/2, radius 1/21/2
Tustin Ts2z+1z−1\frac{T_s}{2}\frac{z+1}{z-1} 2Tsz−1z+1\frac{2}{T_s}\frac{z-1}{z+1} exactly the unit disc

Example results (Ts=0.05T_s = 0.05): FE 50z−0.9z−0.550\dfrac{z - 0.9}{z - 0.5}; BE 36.67z−0.91z−0.6736.67\dfrac{z - 0.91}{z - 0.67}; Tustin 42z−0.9z−0.642\dfrac{z - 0.9}{z - 0.6}. Tustin follows C(s)C(s) best.

ZOH: H0(s)=1−e−sTssH_0(s) = \dfrac{1 - e^{-sT_s}}{s}, H0(jω)=Tse−jωTs/2sin⁡(ωTs/2)ωTs/2H_0(j\omega) = T_s e^{-j\omega T_s/2}\dfrac{\sin(\omega T_s/2)}{\omega T_s/2}; for ∣ω∣≤ωN=ωs/2\lvert\omega\rvert \le \omega_N = \omega_s/2: H0≈Tse−jωTs/2H_0 \approx T_se^{-j\omega T_s/2}, a delay Td≈Ts/2T_d \approx T_s/2.

Consequence: phase lag ≈−ωTs/2\approx -\omega T_s/2 lowers φm\varphi_m and can cause large overshoot; allocate extra phase margin equal to ωgcTs/2\omega_{gc}T_s/2 in the continuous design.

Typical error: assuming a stable C(s)C(s) always gives a stable C(z)C(z) (false for forward Euler); stable controller does not imply stable closed loop.

Esempio di riferimento: P(s)=1s(s+1)P(s) = \dfrac{1}{s(s+1)}, specifiche ∣ess∣≤0.1\lvert e_{ss}\rvert \le 0.1 con rampa, ωgc≈5\omega_{gc} \approx 5 rad/s, φm≈53∘\varphi_m \approx 53^\circ. Regolatore: C(s)=50 s+2s+10C(s) = 50\,\dfrac{s+2}{s+10}, guadagno a bassa frequenza 1010, ad alta frequenza 5050.

Procedura:

  1. Scegliere TsT_s con ωs=2π/Ts\omega_s = 2\pi/T_s circa 10-20 volte ωB\omega_B (qui ωs=25 ωgc=125\omega_s = 25\,\omega_{gc} = 125 rad/s, Ts≈0.05T_s \approx 0.05 s).
  2. Scegliere il metodo di discretizzazione.
  3. Sostituire la variabile di Laplace (o la trasformata del campionato) e semplificare in rapporto di polinomi in zz.
  4. Verificare la stabilità del C(z)C(z) e confrontare le risposte in frequenza con C(s)C(s).

Invarianza allo step, passi:

  1. C(s)s=10s+40s+10\dfrac{C(s)}{s} = \dfrac{10}{s} + \dfrac{40}{s+10}.
  2. Antitrasformata campionata: 10+40e−0.5k10 + 40e^{-0.5k} per k≥0k \ge 0.
  3. Z{C(s)/s}=zz−1⋅50z−(40+10e−0.5)z−e−0.5\mathcal{Z}\{C(s)/s\} = \dfrac{z}{z-1}\cdot\dfrac{50z - (40 + 10e^{-0.5})}{z - e^{-0.5}}.
  4. Cˉ(z)=(1−z−1) Z{C(s)/s}=50z−46.07z−0.61\bar C(z) = (1 - z^{-1})\,\mathcal{Z}\{C(s)/s\} = \dfrac{50z - 46.07}{z - 0.61}.

Equazione alle differenze di ciascun metodo (con y′=uy' = u):

  • Forward Euler: y[k]=y[k−1]+Ts u[k−1]y[k] = y[k-1] + T_s\,u[k-1], cioè Tsz−1\dfrac{T_s}{z-1}.
  • Backward Euler: y[k]=y[k−1]+Ts u[k]y[k] = y[k-1] + T_s\,u[k], cioè Tszz−1\dfrac{T_s z}{z-1}.
  • Tustin: y[k]=y[k−1]+Ts2(u[k−1]+u[k])y[k] = y[k-1] + \dfrac{T_s}{2}\big(u[k-1] + u[k]\big), cioè Ts2z+1z−1\dfrac{T_s}{2}\dfrac{z+1}{z-1}.

Stabilità, in breve: FE mappa il semipiano sinistro in Re[z]<1\mathrm{Re}[z] < 1 (contiene il disco e oltre); BE nel disco di centro 1/21/2 e raggio 1/21/2; Tustin esattamente nel disco unitario, quindi conserva la stabilità in entrambe le direzioni.

Confronto in frequenza (letto dal grafico): FE ha il picco più alto (circa 36 dB, fase fino a circa 47∘47^\circ); BE è più basso (circa 32.5 dB, fase circa 38∘38^\circ); Tustin segue meglio C(s)C(s) (circa 34 dB, fase circa 42∘42^\circ). Tutte le fasi tendono a 0∘0^\circ a ωN\omega_N.

Ritardo dello ZOH:

  • h0(t)=δ−1(t)−δ−1(t−Ts)h_0(t) = \delta_{-1}(t) - \delta_{-1}(t-T_s), quindi H0(s)=1−e−sTssH_0(s) = \dfrac{1 - e^{-sT_s}}{s}.
  • Per ∣ω∣≤ωN=ωs/2\lvert\omega\rvert \le \omega_N = \omega_s/2: H0(jω)≈Ts e−jωTs/2H_0(j\omega) \approx T_s\,e^{-j\omega T_s/2}, cioè un ritardo di Ts/2T_s/2.
  • Ritardo di fase nel loop: ∠H0≈−ωTs/2\angle H_0 \approx -\omega T_s/2, che riduce φm\varphi_m.

Errori tipici:

  • Usare FE senza verificare la stabilità del C(z)C(z): FE può rendere instabile un C(s)C(s) stabile.
  • Ignorare il ritardo di Ts/2T_s/2 dello ZOH nel margine di fase.
  • Confondere le formule di sostituzione: FE s=(z−1)/Tss = (z-1)/T_s, BE s=(z−1)/(Tsz)s = (z-1)/(T_s z), Tustin s=2Tsz−1z+1s = \dfrac{2}{T_s}\dfrac{z-1}{z+1}.

Teoria collegata