Sei sulla pagina 1di 19

Digital Filters and Controllers

1 Poles and zeros in z-transform


Like s-space, you can plot the poles and zeros of a transfer function into
z-space.

z = eT s
s = σ ± jω
z = eT σ eT jω = eT σ ej(T ω+2πn)

although these plot to different spaces, the properties of s translate to z.


That is , σ dictates the decay (or explosion) of a signal, and jω dictates the
natural frequency. If σ is positive, the signal is unstable. The time constant
of the system τ = −1/σ.
example
If the pole in z-space is pz = 0.25 ± 0.5j, then the pole in s-space ps =
ln(pz ) = −0.58 ± 1.11j. σ = −0.58 and ω = 1.11.
A couple things to note:
The distance of the pole in z-space represents how fast the signal decays
or explodes; poles closer to the origin decay faster, and poles far away from
the origin explode. The left-hand side of the s-plane σ < 0 maps to poles
within a distance of 1 on the z-plane |p| < 1.

Credit: Ogata, Discrete-Time Control Systems

Because of the form of the poles in z- and s- space, a single point in z-


space corresponds with an infinite number of poles in s-space. The fact that
multiple frequencies correspond with a single pole ties in with the concept

1
of a nyquist frequency. Remember that a digital sample can only capture a
frequency that is at most half of the sampling frequency. fsample ≤ 1/(2T ),
and ωsample ≤ 2π/(2T ) = π/T .

Credit: Ogata, Discrete-Time Control Systems

A constant frequency in the s-plane corresponds to a ray from the origin


in the z-plane.

Credit: Ogata, Discrete-Time Control Systems

∠z =

2
Credit: Ogata, Discrete-Time Control Systems

Credit: Ogata, Discrete-Time Control Systems

Credit: Ogata, Discrete-Time Control Systems

example:
Consider the poles z = 0.5±0.5j. Is the related system stable or unstable?
p
|z| = (.5)2 + (.5)2 = 0.71
Since z is within the unit circle, the system is stable. What are the system’s
frequency and growth constant? It depends in part on the sampling time T ,
so let’s say T = 10 ms

3
1
s= ln z = 100 (−0.35 ± 0.79j)
T
−1
τ= = 0.029s
35
ω = 79 rad s−1
If you wanted to change the dynamic behavior, you can solve these equa-
tions in reverse. For example, if you want to increase τ to 0.1 s.

s = (−10 ± 79j)
z = eT s = e−0.1±0.79j = 0.64 ± 0.64j
And as we might guess, the magnitude of z increases but the angle stays
the same.

2 Digital Filters
The form and analysis of digital controls is similar to digital filters, the differ-
ence lies on the purpose; digital controls are for controlling dynamic signals,
while digital filters primarily attenuate a certain band of frequencies.
The simplest form of low-pass filter is:

y(k) = x(k) + x(k − 1)


Consider that at steady-state, when x(k) = C, y(k) = 2C. However, as the
frequency increases, the difference between x(k) and x(k − 1) also increases.
When the sampled frequency πω = f /2 = T , then x(k) = −x(k − 1), and
y(k) = 0. Note that because of the Nyquist frequency, the digital signal
frequency can’t exceed f /2 = T , so this is effectively the highest the frequency
can go. Now, how good of a filter is this?
The amplitude corresponds to a point when y(k) = C1 sin(2πnT f + φ) =
sin(2πnT f ) + sin(2πnT f − 2πT f )
we can find the maximum at dy/dt = 0, which corresponds to n = 2T4Tf −1 f .
If we plug this back in, we get sin(πT f − π/2) + sin(−πT f − π/2) =
−2 cos(πT f )
Digital filter design is a large and complex field.

4
3 Digital controls
Instead of proportional, derivative, and integral feedback, digital systems
often use the last n states as input to determining the output. For example,
consider an output y(k) from an input x(k)

y(k) = b0 x(k) + b1 x(k − 1) + ... + bm x(k − m)


− a1 y(k − 1) − a2 y(k − 2)... − an y(k − n)
Y (z) = b0 X(z) + b1 X(z)z −1 + ... + bm X(z)z −m
− a1 Y (z)z −1 − a2 Y (z)z −2 ... − an Y (z)z −n
Y (z) b0 + b1 z −1 + b2 z −2 + ... + bm z −m
=
X(z) 1 + a1 z −1 + a2 z −2 + ... + an z −n

3.1 Analog control approximation


proportional gain:

m(kT ) = Ke(kT )
M (z) = KE(z)

derivative control:

e(kT ) − e((k − 1)T )


m(kT ) = KTD
−1
T
M (z) = KTD 1 − z E(z)

integral control:

 
T e(o) + e(T ) e(T ) + e(2T ) e(kT − T ) + e(kT )
m(kT ) = K + + ... +
Ti 2 2 2
k
X e(hT − T ) + e(hT )
= KI T
2
h=1

and we can define a new equation

5
e(hT − T ) + e(hT )
f (ht) = f (0) = 0
2
−1
1−z
F (z) = E(z)
" k # 2
X 1 + z −1
Z f (ht) = E(z)
2 (1 − z −1 )
h=1

So a PID controller would look like:

T 1 + z −1 TD
 
−1

M (z) = K 1 + + 1−z E(z)
2Ti 1 − z −1 T
 
T T 1 TD −1

=K 1− + + 1−z E(z)
2Ti 2Ti 1 − z −1 T
 
KI
+ KD 1 − z −1 E(z)

= KP + −1
1−z
(KP + KI + KD ) − (KP + 2KD ) z −1 + KD z −2
 
= E(z)
1 − z −1
example:
Consider a discrete controller with the time-space equation. Is it stable?

y(k) = x(k) − 0.5x(k − 1) + y(k − 1) − 2y(k − 2)


Y (z) = X(z) − 0.5X(z)z −1 + Y (z)z −1 − 2Y (z)z −2
Y (z) 1 − 0.5z −1
=
X(z) 1 − z −1 + 2z −2
z (z − 0.5)
= 2
z −z+2
pz = 0.5 ± 1.32j

So the system is unstable. What if we remove the y(k − 1) term and


reduced the y(k − 1) coefficient?

6
Y (z) z (z − 0.5)
= 2
X(z) z − z + 0.5
pz = 0.5 ± 0.5j

Now it’s stable

4 Filter characteristics
4.1 Linear vs. Nonlinear
Linear: y(n) = x(n) + x(n − 1)
Nonlinear: y(n) = x2 (n) + x(n)x(n − 1)

4.2 Time-invariant vs Time-variant


Invariant: y(n) = x(n) + x(n − 1)
Variant: y(n) = nx(n) + x(n − 1)

4.3 Memory vs Memoryless


Memoryless: y(n) = x2 (n)
Memory: y(n) = x2 (n) + x(n − 1) + y(n − 1)

4.4 Control vs. Signal Processing


When designing a filter, we must consider its application. Filters for con-
trollers must be executed in realtime so they can only tolerate small delays.
When processing communication signals, long delays are often acceptable.

5 Finite vs. Infinite Impulse Response Filters


A Finite Impulse Response (FIR) filter has a finite number of nonzero
samples, each sampled from a delay block of the input signal.

7
y(k) = b0 x(k) + b1 x(k − 1) + b2 x(k − 2) + ... + bm x(k − m)
Y (z)
= b0 + b1 z −1 + b2 z −2 + ... + bm z −m
X(z)
FIR filters have the following characteristics:

• FIR filters are nonrecursive, i.e. they have no feedback. Therefore, errors
in don’t accumulate.
• The poles of the pulse transfer function are at the origin, and so the
system is stable.
• If the input has high-frequency components, the number of delay ele-
ments needed in the FIR filter increases and the amount of time delay
becomes large.

In contrast, an Infinite Impulse Response (IIR) filter has a finite


number of nonzero samples, each sampled from a delay block of the input
signal.

y(k) = − a1 y(k − 1) − a2 y(k − 2) − ... − an y(k − n) (1)


+ b0 x(k) + b1 x(k − 1) + b2 x(k − 2) + ... + bm x(k − m) (2)
Y (z) b0 + b1 z −1 + b2 z −2 + ... + bm z −m
= (3)
X(z) 1 + a1 z − 1 + a2 z −2 + ... + an z −m

6 Realization of Digital Controllers and Filters


Discrete-Time Control Systems, Ogata 2nd Ed., Sec. 3-6, pg 122
The general form for a pulse transfer function in z-space is

Y (z) b0 + b1 z −1 + b2 z −2 + ... + bm z −m
= n≥m
X(z) 1 + a1 z − 1 + a2 z −2 + ... + an z −m
There are two general methods to converting this into a block diagram
and from there a software or hardware design. Keep in mind that each time

8
point must be saved for use later, so the use of previous time points requires
delay blocks that typically have a hardware or software cost.

Credit: Ogata, Discrete-Time Control Systems

Direct Programming
Direct programming is a direct translation of the pulse transfer function
into a block diagram. It requires m + n delay elements. However, it is not
the most efficient because we can reduce the number of delay elements, so it
is not commonly used in system design.

Credit: Ogata, Discrete-Time Control Systems

Standard Programming
Standard programming can reduce the number of delay elements to n
(assuming that n ≥ m).
We first consider the filter to be the product of two transfer functions, one
representing the numerator and the other the denominator.

9
Y (z) 1
= b0 + b1 z −1 + b2 z −2 + ... + bm z −m

X(z) 1 + a1 z − 1 + a2 z −2 + ... + an z −n
Y (z) H(z)
=
H(z) X(z)
Y (z)
= b0 + b1 z −1 + b2 z −2 + ... + bm z −n
H(z)
H(z) 1
=
X(z) 1 + a1 z − 1 + a2 z −2 + ... + an z −n
H(z) = X(z) − a − 1z −1 H(z) − a2 z −2 H(z) − ... − an z −n H(z)

We can then draw out block diagrams for each transfer function indi-
vidually, and we see that in both cases the delay blocks are applied to our
intermediate function H. We can then combine these systems as you see
below.

10
Credit: Ogata, Discrete-Time Control Systems

example:
Consider our earlier stable example

11
y(k) = x(k) − 0.5x(k − 1) + y(k − 1) − 0.5y(k − 2)
Y (z) = X(z) − 0.5X(z)z −1 + Y (z)z −1 − 0.5Y (z)z −2
Y (z) z (z − 0.5)
= 2
X(z) z − z + 0.5
The direct form of this filter looks like

1
Y(Z)

X(Z) +
z-1 -0.5 +- z-1 z-1

1
-0.5

While the standard is

Y (z) = H(z) − 0.5H(z)z −1


H(z) = X(z) − H(z)z −1 + 0.5H(z)

12
1

H(Z) Y(Z)
-1
-0.5 +
z +
H(Z)

X(Z)
+ z-1 z-1
-

1
-0.5

-0.5
X(Z) Y(Z)
+ z -1
z -1 +
- +

1
-0.5

7 Solving for stability


7.1 Jury Stability Test
For a characteristic equation

P (z) = a0 z n + a1 z n−1 + ... + an−1 z 1 + an

We can build a Jury Stability Table, which looks like this:

13
Credit: Ogata, Discrete-Time Control Systems

The first two rows are the coefficients of the polynomial in ascending and
descending order. Later rows have values defined as:


an an−1−k
bk = k = 0, 1, 2, ..., n − 1
a0 ak+1

bn−1 bn−2−k
ck = k = 0, 1, 2, ..., n − 2
b0 ak+1
..
.

p3 p2−k
qk = k = 0, 1, 2
p0 pk+1

Stability Criterion
A system where a0 > 0 is stable if all of the following are satisified

14
|an | < a0
P (z)z=1 > 0
(
> 0 for n even
P (z)z=−1
< 0 for n even
|bn−1 | > |b0 |
|cn−2 | > |c0 |
..
.
|q2 | > |q0 |

Credit: Ogata, Discrete-Time Control Systems

example

15
If we go back to our earlier example

P (z) = z 2 − z + 2
a0 = 1
a1 = −1
a2 = 2

First, note that the first row of our table already includes only three ele-
ments, so we don’t need to solve for bi etc.
Criterion 1

|an | < a0
|2| ≮ 1

So already we can see that it’s unstable.


What about our modified example?

P (z) = z 2 − z + 0.5
a0 = 1
a1 = −1
a2 = 0.5

First, note that the first row of our table already includes only three ele-
ments, so we don’t need to solve for bi etc.
Criterion 1

|an | < a0
|0.5| < 1

Criterion 2

16
P (z)z=1 > 0
P (1) = 1 − 1 + 0.5 = 0.5 > 0

Criterion 3

(
> 0 for n even
P (z)z=−1
< 0 for n even
P (−1) = 1 + 1 + 0.5 − 0.3 = 2.5 > 0

example
Consider the following characteristic polynomial

P (z) = z 4 − 1.2z 3 + 0.07z 2 + 0.3z − 0.08


a0 = 1
a1 = −1.2
a2 = 0.07
a3 = 0.3
a4 = −0.08

First, note that the first row of our table already includes only three ele-
ments, so we don’t need to solve for bi etc.
Criterion 1

|an | < a0
| − 0.08| ≮ 1

Criterion 2

P (z)z=1 > 0
P (1) = 1 − 1.2 + 0.07 + 0.3 − 0.08 = 0.09 > 0

Criterion 3

17
(
> 0 for n even
P (z)z=−1
< 0 for n even
P (−1) = 1 + 1.2 + 0.07 − 0.3 + 0.08 = 1.89 > 0
Remaining Criteria

|bn−1 | > |b0 |


|cn−2 | > |c0 |

Credit: Ogata, Discrete-Time Control Systems

|b3 | = 0.994 > 0.204 = |b0 |


|c2 | = 0.946 > 0.315 = |c0 |

18
This means that the system is stable and that all poles fall within the unit
circle.

19