Current state on filter approximation and evaluation Thibault - - PowerPoint PPT Presentation

current state on filter approximation and evaluation
SMART_READER_LITE
LIVE PREVIEW

Current state on filter approximation and evaluation Thibault - - PowerPoint PPT Presentation

Filter Context Realizations Evaluation Approximation Conclusion Current state on filter approximation and evaluation Thibault Hilaire (thibault.hilaire@lip6.fr) Kick-off ANR MetaLibm January 22, 2014 Filter approximation and evaluation


slide-1
SLIDE 1 Filter Context Realizations Evaluation Approximation Conclusion

Current state on filter approximation and evaluation

Thibault Hilaire (thibault.hilaire@lip6.fr)

Kick-off ANR MetaLibm — January 22, 2014 Filter approximation and evaluation
  • T. Hilaire
1/22
slide-2
SLIDE 2 Filter Context Realizations Evaluation Approximation Conclusion

We consider here linear filters

  • bricks for signal processing algorithms
  • linear controllers are linear filters (used with feedback)

Signals

  • Continous-time signal: s(t), t ∈ R
  • Discrete-time signal: s′(k), k ∈ Z

s′(k) s(kTe), Te sampling period

Filter approximation and evaluation
  • T. Hilaire
2/22
slide-3
SLIDE 3 Filter Context Realizations Evaluation Approximation Conclusion

We consider here linear filters

  • bricks for signal processing algorithms
  • linear controllers are linear filters (used with feedback)

Signals

  • Continous-time signal: s(t), t ∈ R
  • Discrete-time signal: s′(k), k ∈ Z

s′(k) s(kTe), Te sampling period H u(k) y(k)

Filter

A filter is defined by

  • its impulse response
  • its transfer function
  • its frequency response
Filter approximation and evaluation
  • T. Hilaire
2/22
slide-4
SLIDE 4 Filter Context Realizations Evaluation Approximation Conclusion

Transfer function

H(z) = Y (z) U(z) where X(z) and Y (z) are the Z-transform of u(k) and y(k) (H(z) is the Z-transform of the impulse response h(k))

Filter approximation and evaluation
  • T. Hilaire
3/22
slide-5
SLIDE 5 Filter Context Realizations Evaluation Approximation Conclusion

Transfer function

H(z) = Y (z) U(z) where X(z) and Y (z) are the Z-transform of u(k) and y(k) (H(z) is the Z-transform of the impulse response h(k))

Z-transform

It is the discrete equivalent of the Laplace-transform: Z [x(k)] : Dcv → C z → X(z) with X(z)

  • k=0

x(k)z−k

Filter approximation and evaluation
  • T. Hilaire
3/22
slide-6
SLIDE 6 Filter Context Realizations Evaluation Approximation Conclusion

Frequency response

Frequency response: H(ejω)

  • for z = ejω, ω ∈ [0, 2π]
  • for z = ej2π f
Fe with 0 f Fe

H(z) =

1 z−0.8
  • H(ejΩ)
  • arg
  • H(ejΩ)
  • !!"
!# " # !" !# $%&'()*+,-.+/0 !" !1 !" !! !" " !" ! !!2" !!3# !4" !5# " 67%8,-.+,&0 /9+,-:(%&;%< =;,>*,'?@--.;%+A8,?0 Filter approximation and evaluation
  • T. Hilaire
4/22
slide-7
SLIDE 7 Filter Context Realizations Evaluation Approximation Conclusion
  • LTI: Linear system with known and constant coefficients
  • FIR (Finite Impulse Response) :

H(z) =

n
  • i=0

biz−i, ⇒ y(k) =

n
  • i=0

biu(k − i)

  • IIR (Infinite Impulse Response) :

H(z) = n

i=0 biz−i

1 + n

i=1 aiz−i ,

⇒ y(k) =

n
  • i=0

biu(k−i)−

n
  • i=1

aiy(k−i)

Filter approximation and evaluation
  • T. Hilaire
5/22
slide-8
SLIDE 8 Filter Context Realizations Evaluation Approximation Conclusion
  • LTI: Linear system with known and constant coefficients
  • FIR (Finite Impulse Response) :

H(z) =

n
  • i=0

biz−i, ⇒ y(k) =

n
  • i=0

biu(k − i)

  • IIR (Infinite Impulse Response) :

H(z) = n

i=0 biz−i

1 + n

i=1 aiz−i ,

⇒ y(k) =

n
  • i=0

biu(k−i)−

n
  • i=1

aiy(k−i)

  • parametrized LTI: Linear system, where the coefficients are

constant, but dépends on extra parameters (unknown at compile-time)

Filter approximation and evaluation
  • T. Hilaire
5/22
slide-9
SLIDE 9 Filter Context Realizations Evaluation Approximation Conclusion
  • LTI: Linear system with known and constant coefficients
  • FIR (Finite Impulse Response) :

H(z) =

n
  • i=0

biz−i, ⇒ y(k) =

n
  • i=0

biu(k − i)

  • IIR (Infinite Impulse Response) :

H(z) = n

i=0 biz−i

1 + n

i=1 aiz−i ,

⇒ y(k) =

n
  • i=0

biu(k−i)−

n
  • i=1

aiy(k−i)

  • parametrized LTI: Linear system, where the coefficients are

constant, but dépends on extra parameters (unknown at compile-time)

  • LPV : Linear Parameter Varying (coefficients depends on time)
Filter approximation and evaluation
  • T. Hilaire
5/22
slide-10
SLIDE 10 Filter Context Realizations Evaluation Approximation Conclusion
  • LTI: Linear system with known and constant coefficients
  • FIR (Finite Impulse Response) :

H(z) =

n
  • i=0

biz−i, ⇒ y(k) =

n
  • i=0

biu(k − i)

  • IIR (Infinite Impulse Response) :

H(z) = n

i=0 biz−i

1 + n

i=1 aiz−i ,

⇒ y(k) =

n
  • i=0

biu(k−i)−

n
  • i=1

aiy(k−i)

  • parametrized LTI: Linear system, where the coefficients are

constant, but dépends on extra parameters (unknown at compile-time)

  • LPV : Linear Parameter Varying (coefficients depends on time)

→Can be with multiple inputs and multiple outputs (MIMO controllers).

Filter approximation and evaluation
  • T. Hilaire
5/22
slide-11
SLIDE 11 Filter Context Realizations Evaluation Approximation Conclusion

Given

  • a filter (transfer function or frequency specification)
  • some requirement on the acceptable performance/error
  • a specific hardware

generate code with guarantee (on the error/performance)

Filter approximation and evaluation
  • T. Hilaire
6/22
slide-12
SLIDE 12 Filter Context Realizations Evaluation Approximation Conclusion

Given

  • a filter (transfer function or frequency specification)
  • some requirement on the acceptable performance/error
  • a specific hardware

generate code with guarantee (on the error/performance) Several metrics are used to evaluate the distance to original real filter

  • maximal output error (with/without knowledge on the input)
  • transfer function error
  • poles and/or zeros error (distance to instability)
  • etc.
Filter approximation and evaluation
  • T. Hilaire
6/22
slide-13
SLIDE 13 Filter Context Realizations Evaluation Approximation Conclusion

Equivalent realizations

For a given LTI controller, it exist various equivalent realizations

  • Direct Form I (2n + 1 coefs)

H(z) = n

i=0 biz−i

1 + n

i=1 aiz−i

y(k) =

n
  • i=0

biu(k−i)−

n
  • i=1

aiy(k−i)

q−1 q−1 q−1 q−1 q−1 q−1 q−1 q−1 + b0 b1 b2 bi bn −a1 −a2 −ai −an u(k) u(k − 1) u(k − n) y(k − n) y(k − 1) y(k) Filter approximation and evaluation
  • T. Hilaire
7/22
slide-14
SLIDE 14 Filter Context Realizations Evaluation Approximation Conclusion

Equivalent realizations

For a given LTI controller, it exist various equivalent realizations

  • Direct Form I (2n + 1 coefs)
  • Direct Form II (transposed or not) (2n + 1 coefs)
q−1 q−1 q−1 q−1 + + + + + + + + −a1 −a2 −ai −an u(k) y(k) e(k) e(k − 1) e(k − n) b0 b1 bi b2 bn Filter approximation and evaluation
  • T. Hilaire
7/22
slide-15
SLIDE 15 Filter Context Realizations Evaluation Approximation Conclusion

Equivalent realizations

For a given LTI controller, it exist various equivalent realizations

  • Direct Form I (2n + 1 coefs)
  • Direct Form II (transposed or not) (2n + 1 coefs)
  • State-space (depend on the basis) ((n + 1)2 coefs)

X(k + 1) = AX(k) + Bu(k) y(k) = CX(k) + Du(k) X(k) → T.X(k)

q−1 + A + C B D U(k) Y (k) X(k) X(k + 1) Filter approximation and evaluation
  • T. Hilaire
7/22
slide-16
SLIDE 16 Filter Context Realizations Evaluation Approximation Conclusion

Equivalent realizations

For a given LTI controller, it exist various equivalent realizations

  • Direct Form I (2n + 1 coefs)
  • Direct Form II (transposed or not) (2n + 1 coefs)
  • State-space (depend on the basis) ((n + 1)2 coefs)
  • δ-operator

δ q−1

q−1 + δ−1

δ[X(k)] = AδX(k) + Bδu(k) y(k) = CδX(k) + Dδu(k)

+ + U(k) Y (k) X(k) X(k + 1) δ−1 Aδ Bδ Cδ Dδ Filter approximation and evaluation
  • T. Hilaire
7/22
slide-17
SLIDE 17 Filter Context Realizations Evaluation Approximation Conclusion

Equivalent realizations

For a given LTI controller, it exist various equivalent realizations

  • Direct Form I (2n + 1 coefs)
  • Direct Form II (transposed or not) (2n + 1 coefs)
  • State-space (depend on the basis) ((n + 1)2 coefs)
  • δ-operator

δ q−1

  • Cascad and/or parallel decompositions
H1 H2 Hi Hm H + H H1 H2 Hi Hm Filter approximation and evaluation
  • T. Hilaire
7/22
slide-18
SLIDE 18 Filter Context Realizations Evaluation Approximation Conclusion

Equivalent realizations

For a given LTI controller, it exist various equivalent realizations

  • Direct Form I (2n + 1 coefs)
  • Direct Form II (transposed or not) (2n + 1 coefs)
  • State-space (depend on the basis) ((n + 1)2 coefs)
  • δ-operator

δ q−1

  • Cascad and/or parallel decompositions
  • ρDirect Form II transposed (5n + 1 ou 4n + 1 coefs)
ρDFIIt

+

∆i z−1 γi ρ−1 i + + + + + βn βi βn−1 β1 β0 ρ−1 n ρ−1 i+1 ρ−1 i ρ−1 1 αn αn−1 αi α1 y(k) u(k) Filter approximation and evaluation
  • T. Hilaire
7/22
slide-19
SLIDE 19 Filter Context Realizations Evaluation Approximation Conclusion

Equivalent realizations

For a given LTI controller, it exist various equivalent realizations

  • Direct Form I (2n + 1 coefs)
  • Direct Form II (transposed or not) (2n + 1 coefs)
  • State-space (depend on the basis) ((n + 1)2 coefs)
  • δ-operator

δ q−1

  • Cascad and/or parallel decompositions
  • ρDirect Form II transposed (5n + 1 ou 4n + 1 coefs)
ρDFIIt
  • lattice, ρ-modale, LGC et LCW-structures, sparse state-space,

etc. Each of these realizations uses different coefficients. They are equivalent in infinite precision, but no more in finite

  • precision. The finite precision degradation (parametric errors and

roundoff noises) depends on the realization.

Filter approximation and evaluation
  • T. Hilaire
7/22
slide-20
SLIDE 20 Filter Context Realizations Evaluation Approximation Conclusion

Comparison with polynomials

It is interesting to compare filter realizations and polynomial evaluation:

  • The shift operator
z−1
  • The multiplication by x
Filter approximation and evaluation
  • T. Hilaire
8/22
slide-21
SLIDE 21 Filter Context Realizations Evaluation Approximation Conclusion

Comparison with polynomials

It is interesting to compare filter realizations and polynomial evaluation:

  • The shift operator
z−1
  • The multiplication by x
  • Direct forms
  • Horner’s method
Filter approximation and evaluation
  • T. Hilaire
8/22
slide-22
SLIDE 22 Filter Context Realizations Evaluation Approximation Conclusion

Comparison with polynomials

It is interesting to compare filter realizations and polynomial evaluation:

  • The shift operator
z−1
  • The multiplication by x
  • Direct forms
  • Horner’s method
  • ρ-operator

̺i(z) =

n
  • j=i+1

z − γj ∆j

  • Newton’s basis

Pi = Πi

k=1(X − xk) Filter approximation and evaluation
  • T. Hilaire
8/22
slide-23
SLIDE 23 Filter Context Realizations Evaluation Approximation Conclusion

Comparison with polynomials

It is interesting to compare filter realizations and polynomial evaluation:

  • The shift operator
z−1
  • The multiplication by x
  • Direct forms
  • Horner’s method
  • ρ-operator

̺i(z) =

n
  • j=i+1

z − γj ∆j

  • Newton’s basis

Pi = Πi

k=1(X − xk)
  • ρDFIIt
  • Horner’s method with Newton’s

basis

Filter approximation and evaluation
  • T. Hilaire
8/22
slide-24
SLIDE 24 Filter Context Realizations Evaluation Approximation Conclusion

Optimal realization

So a dedicated step is necessary to find the best realization (algorithm to compute the outputs from the inputs), according to some a priori error/performance measure (sensitivity-based measure, approximative error bounds, etc.)

Optimal realization Algorithm Transfer function a priori error/performance measures Filter approximation and evaluation
  • T. Hilaire
9/22
slide-25
SLIDE 25 Filter Context Realizations Evaluation Approximation Conclusion

Optimal realization

So a dedicated step is necessary to find the best realization (algorithm to compute the outputs from the inputs), according to some a priori error/performance measure (sensitivity-based measure, approximative error bounds, etc.)

Optimal realization Algorithm Transfer function a priori error/performance measures

Currently done with the FWR toolbox (Matlab) →about to be redeveloped in Python

Filter approximation and evaluation
  • T. Hilaire
9/22
slide-26
SLIDE 26 Filter Context Realizations Evaluation Approximation Conclusion

Evaluation

Once the (low sensitivity) algorithm is determined, it has to be implemented (in FxP arithmetic in our case)

Evaluation Code Algorithm with FxP/fp coefs HW Target Filter approximation and evaluation
  • T. Hilaire
10/22
slide-27
SLIDE 27 Filter Context Realizations Evaluation Approximation Conclusion

Evaluation

Once the (low sensitivity) algorithm is determined, it has to be implemented (in FxP arithmetic in our case)

Evaluation Code Algorithm with FxP/fp coefs HW Target

Currently done by Benoit Lopez (and its tool FiPoGen)

Filter approximation and evaluation
  • T. Hilaire
10/22
slide-28
SLIDE 28 Filter Context Realizations Evaluation Approximation Conclusion

FiPoGen (Fixed-Point Code Generator) is a tool to translate filter algorithm into Fixed-Point code (in some way, similar to CGPE).

  • Specially dedicated to Sum-of-Products (ordered

sum-of-products, with constant multiplications)

  • Evaluation of the output error (interval)

→ combined with the Worst Case Peak Gain of a certain filter, gives the error(s) added at the output(s) of the filter

  • Bit formatting
  • Word-length optimization (with multiple word length

paradigm) — work in progress

Filter approximation and evaluation
  • T. Hilaire
11/22
slide-29
SLIDE 29 Filter Context Realizations Evaluation Approximation Conclusion

FiPoGen (Fixed-Point Code Generator) is a tool to translate filter algorithm into Fixed-Point code (in some way, similar to CGPE).

  • Specially dedicated to Sum-of-Products (ordered

sum-of-products, with constant multiplications)

  • Evaluation of the output error (interval)

→ combined with the Worst Case Peak Gain of a certain filter, gives the error(s) added at the output(s) of the filter

  • Bit formatting
  • Word-length optimization (with multiple word length

paradigm) — work in progress Soon, we will give it

  • the realization (with FxP or fp coefficients)
  • the maximum output error

and it will give the FxP algorithm that satisfies the error contraint and minimizes the word-lengths

Filter approximation and evaluation
  • T. Hilaire
11/22
slide-30
SLIDE 30 Filter Context Realizations Evaluation Approximation Conclusion

Approximation – 1

But the approximation part is missing...

Filter approximation and evaluation
  • T. Hilaire
12/22
slide-31
SLIDE 31 Filter Context Realizations Evaluation Approximation Conclusion

Approximation – 1

But the approximation part is missing... Hopefully, Silviu Filip (PhD with N. Brisebarre and G. Hanrot) is working on it !

Filter approximation and evaluation
  • T. Hilaire
12/22
slide-32
SLIDE 32 Filter Context Realizations Evaluation Approximation Conclusion

Approximation – 1

But the approximation part is missing... Hopefully, Silviu Filip (PhD with N. Brisebarre and G. Hanrot) is working on it !

Approximation Frequency specifications Transfer function FxP/fp coefs Filter approximation and evaluation
  • T. Hilaire
12/22
slide-33
SLIDE 33 Filter Context Realizations Evaluation Approximation Conclusion

Approximation – 2

The idea is to provide the best transfer function with Fixed-Point or floating-point coefficients that satisfies some frequency specifications

! " !p 1 |H(ej!)| 1-#1 1+#1 #2 !a Filter approximation and evaluation
  • T. Hilaire
13/22
slide-34
SLIDE 34 Filter Context Realizations Evaluation Approximation Conclusion

Approximation – 2

The idea is to provide the best transfer function with Fixed-Point or floating-point coefficients that satisfies some frequency specifications

! " !p 1 |H(ej!)| 1-#1 1+#1 #2 !a

Or the best transfer function with FxP/fp coefficients relatively to a real transfer function.

Filter approximation and evaluation
  • T. Hilaire
13/22
slide-35
SLIDE 35 Filter Context Realizations Evaluation Approximation Conclusion

Approximation – 2

The idea is to provide the best transfer function with Fixed-Point or floating-point coefficients that satisfies some frequency specifications

! " !p 1 |H(ej!)| 1-#1 1+#1 #2 !a

Or the best transfer function with FxP/fp coefficients relatively to a real transfer function. Or, even better, the best FxP/fp realization, relatively to a real structured realization.

Filter approximation and evaluation
  • T. Hilaire
13/22
slide-36
SLIDE 36 Filter Context Realizations Evaluation Approximation Conclusion

Approximation – 3

For the FIR case, this is not too difficult (extension of the polynomial case)

Filter approximation and evaluation
  • T. Hilaire
14/22
slide-37
SLIDE 37 Filter Context Realizations Evaluation Approximation Conclusion

Approximation – 3

For the FIR case, this is not too difficult (extension of the polynomial case) And it’s already partially done by Silviu !

Filter approximation and evaluation
  • T. Hilaire
14/22
slide-38
SLIDE 38 Filter Context Realizations Evaluation Approximation Conclusion

Approximation – 3

For the FIR case, this is not too difficult (extension of the polynomial case) And it’s already partially done by Silviu ! For the IIR case, I can’t tell

Filter approximation and evaluation
  • T. Hilaire
14/22
slide-39
SLIDE 39 Filter Context Realizations Evaluation Approximation Conclusion

Conclusion – 1

If we only consider the direct forms, then the algorithm used to compute the outputs from the inputs is deduced from the transfer function (use the same coefficients).

Filter approximation and evaluation
  • T. Hilaire
15/22
slide-40
SLIDE 40 Filter Context Realizations Evaluation Approximation Conclusion

Conclusion – 1

If we only consider the direct forms, then the algorithm used to compute the outputs from the inputs is deduced from the transfer function (use the same coefficients).

Evaluation Approximation Code Frequency specifications Transfer function FxP/fp coefs HW Target Filter approximation and evaluation
  • T. Hilaire
15/22
slide-41
SLIDE 41 Filter Context Realizations Evaluation Approximation Conclusion

Conclusion – 2

If the approximation part is not fully available, then the question is how to combine the optimal realization problem and the optimal evaluation

Filter approximation and evaluation
  • T. Hilaire
16/22
slide-42
SLIDE 42 Filter Context Realizations Evaluation Approximation Conclusion

Conclusion – 2

If the approximation part is not fully available, then the question is how to combine the optimal realization problem and the optimal evaluation

Optimal realization Evaluation HW Target Code Algorithm Transfer function Filter approximation and evaluation
  • T. Hilaire
16/22
slide-43
SLIDE 43 Filter Context Realizations Evaluation Approximation Conclusion

Conclusion – 1

And finally, if we consider the problem globally, how to combine the three steps ? How to make the parallel with the approximation-evaluation problem for functions ?

Filter approximation and evaluation
  • T. Hilaire
17/22
slide-44
SLIDE 44 Filter Context Realizations Evaluation Approximation Conclusion

Conclusion – 1

And finally, if we consider the problem globally, how to combine the three steps ? How to make the parallel with the approximation-evaluation problem for functions ?

Optimal realization Evaluation HW Target Code Algorithm Approximation Transfer function FxP/fp coefs Frequency specifications Error/performance Filter approximation and evaluation
  • T. Hilaire
17/22
slide-45
SLIDE 45 Filter Context Realizations Evaluation Approximation Conclusion

Questions ?

Filter approximation and evaluation
  • T. Hilaire
18/22
slide-46
SLIDE 46 ρDFIIt

Appendix Appendix

✶ ✶

Filter approximation and evaluation
  • T. Hilaire
19/22
slide-47
SLIDE 47 ρDFIIt

Outline

6 ρDFIIt

Filter approximation and evaluation
  • T. Hilaire
20/22
slide-48
SLIDE 48 ρDFIIt

ρ-DFIIt – 1

It is possible to re-parametrized the transfer function: H(z) = b0zn + b1zn−1 + . . . + bn−1z + bn zn + a1zn−1 + . . . + an−1z + an by H(z) = β0̺0(z) + β1̺1(z) + . . . + βn−1̺n−1(z) + βn̺n(z) 1 + α1̺1(z) + . . . + αn−1̺n−11(z) + αn̺n(z) with ̺i : z →

n
  • j=i+1

ρj(z) and ρi : z → z − γi ∆i and to use the ρi-operator in a direct form II transposed.

Filter approximation and evaluation
  • T. Hilaire
21/22
slide-49
SLIDE 49 ρDFIIt

ρ-DFIIt – 2

+ + + + +

βn βi βn−1 β1 β0 ρ−1 n ρ−1 i+1 ρ−1 i ρ−1 1 −α1 −αi −αn−1 −αn y(k) u(k) w1(k) wi(k) wn(k) Filter approximation and evaluation
  • T. Hilaire
22/22
slide-50
SLIDE 50 ρDFIIt

ρ-DFIIt – 2

+ + + + +

βn βi βn−1 β1 β0 ρ−1 n ρ−1 i+1 ρ−1 i ρ−1 1 −α1 −αi −αn−1 −αn y(k) u(k) w1(k) wi(k) wn(k)

+

∆i z−1 γi ρ−1

i Filter approximation and evaluation
  • T. Hilaire
22/22