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
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
Current state on filter approximation and evaluation
Thibault Hilaire (thibault.hilaire@lip6.fr)
Kick-off ANR MetaLibm — January 22, 2014 Filter approximation and evaluationWe consider here linear filters
Signals
s′(k) s(kTe), Te sampling period
Filter approximation and evaluationWe consider here linear filters
Signals
s′(k) s(kTe), Te sampling period H u(k) y(k)
Filter
A filter is defined by
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 evaluationTransfer 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)
∞x(k)z−k
Filter approximation and evaluationFrequency response
Frequency response: H(ejω)
H(z) =
1 z−0.8H(z) =
nbiz−i, ⇒ y(k) =
nbiu(k − i)
H(z) = n
i=0 biz−i1 + n
i=1 aiz−i ,⇒ y(k) =
nbiu(k−i)−
naiy(k−i)
Filter approximation and evaluationH(z) =
nbiz−i, ⇒ y(k) =
nbiu(k − i)
H(z) = n
i=0 biz−i1 + n
i=1 aiz−i ,⇒ y(k) =
nbiu(k−i)−
naiy(k−i)
constant, but dépends on extra parameters (unknown at compile-time)
Filter approximation and evaluationH(z) =
nbiz−i, ⇒ y(k) =
nbiu(k − i)
H(z) = n
i=0 biz−i1 + n
i=1 aiz−i ,⇒ y(k) =
nbiu(k−i)−
naiy(k−i)
constant, but dépends on extra parameters (unknown at compile-time)
H(z) =
nbiz−i, ⇒ y(k) =
nbiu(k − i)
H(z) = n
i=0 biz−i1 + n
i=1 aiz−i ,⇒ y(k) =
nbiu(k−i)−
naiy(k−i)
constant, but dépends on extra parameters (unknown at compile-time)
→Can be with multiple inputs and multiple outputs (MIMO controllers).
Filter approximation and evaluationGiven
generate code with guarantee (on the error/performance)
Filter approximation and evaluationGiven
generate code with guarantee (on the error/performance) Several metrics are used to evaluate the distance to original real filter
Equivalent realizations
For a given LTI controller, it exist various equivalent realizations
H(z) = n
i=0 biz−i1 + n
i=1 aiz−iy(k) =
nbiu(k−i)−
naiy(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 evaluationEquivalent realizations
For a given LTI controller, it exist various equivalent realizations
Equivalent realizations
For a given LTI controller, it exist various equivalent realizations
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 evaluationEquivalent realizations
For a given LTI controller, it exist various equivalent realizations
δ 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 evaluationEquivalent realizations
For a given LTI controller, it exist various equivalent realizations
δ q−1
∆Equivalent realizations
For a given LTI controller, it exist various equivalent realizations
δ q−1
∆+
∆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 evaluationEquivalent realizations
For a given LTI controller, it exist various equivalent realizations
δ q−1
∆etc. Each of these realizations uses different coefficients. They are equivalent in infinite precision, but no more in finite
roundoff noises) depends on the realization.
Filter approximation and evaluationComparison with polynomials
It is interesting to compare filter realizations and polynomial evaluation:
Comparison with polynomials
It is interesting to compare filter realizations and polynomial evaluation:
Comparison with polynomials
It is interesting to compare filter realizations and polynomial evaluation:
̺i(z) =
nz − γj ∆j
Pi = Πi
k=1(X − xk) Filter approximation and evaluationComparison with polynomials
It is interesting to compare filter realizations and polynomial evaluation:
̺i(z) =
nz − γj ∆j
Pi = Πi
k=1(X − xk)basis
Filter approximation and evaluationOptimal 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 evaluationOptimal 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 measuresCurrently done with the FWR toolbox (Matlab) →about to be redeveloped in Python
Filter approximation and evaluationEvaluation
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 evaluationEvaluation
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 TargetCurrently done by Benoit Lopez (and its tool FiPoGen)
Filter approximation and evaluationFiPoGen (Fixed-Point Code Generator) is a tool to translate filter algorithm into Fixed-Point code (in some way, similar to CGPE).
sum-of-products, with constant multiplications)
→ combined with the Worst Case Peak Gain of a certain filter, gives the error(s) added at the output(s) of the filter
paradigm) — work in progress
Filter approximation and evaluationFiPoGen (Fixed-Point Code Generator) is a tool to translate filter algorithm into Fixed-Point code (in some way, similar to CGPE).
sum-of-products, with constant multiplications)
→ combined with the Worst Case Peak Gain of a certain filter, gives the error(s) added at the output(s) of the filter
paradigm) — work in progress Soon, we will give it
and it will give the FxP algorithm that satisfies the error contraint and minimizes the word-lengths
Filter approximation and evaluationApproximation – 1
But the approximation part is missing...
Filter approximation and evaluationApproximation – 1
But the approximation part is missing... Hopefully, Silviu Filip (PhD with N. Brisebarre and G. Hanrot) is working on it !
Filter approximation and evaluationApproximation – 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 evaluationApproximation – 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 evaluationApproximation – 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 !aOr the best transfer function with FxP/fp coefficients relatively to a real transfer function.
Filter approximation and evaluationApproximation – 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 !aOr 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 evaluationApproximation – 3
For the FIR case, this is not too difficult (extension of the polynomial case)
Filter approximation and evaluationApproximation – 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 evaluationApproximation – 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 evaluationConclusion – 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 evaluationConclusion – 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 evaluationConclusion – 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 evaluationConclusion – 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 evaluationConclusion – 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 evaluationConclusion – 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 evaluationQuestions ?
Filter approximation and evaluationAppendix Appendix
Outline
6 ρDFIIt
Filter approximation and evaluationρ-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(z) and ρi : z → z − γi ∆i and to use the ρi-operator in a direct form II transposed.
Filter approximation and evaluationρ-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ρ-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