This icon shall be used for a package that contains internal classes not to be directly utilized by a user.
Extends from Modelica.Icons.InternalPackage
(Icon for an internal package (indicating that the package should not be directly utilized by user)).
Name | Description |
---|---|
bandPassAlpha | Return alpha for band pass |
BesselBaseCoefficients | Return coefficients of normalized low pass Bessel filter (= gain at cut-off frequency 1 rad/s is decreased 3dB) |
normalizationFactor | Compute correction factor of low pass filter such that amplitude at cut-off frequency is -3db (=10^(-3/20) = 0.70794...) |
toHighestPowerOne | Transform filter to form with highest power of s equal 1 |
The transfer function H(p) of a n 'th order Bessel filter is given by
Bn(0) H(p) = ------- Bn(p)
with the denominator polynomial
n n (2n - k)! p^k Bn(p) = sum c_k*p^k = sum ----------- * ------- (1) k=0 k=0 (n - k)!k! 2^(n-k)
and the numerator
(2n)! 1 Bn(0) = c_0 = ------- * ---- . (2) n! 2^n
Although the coefficients c_k are integer numbers, it is not advisable to use the polynomials in an unfactorized form because the coefficients are fast growing with order n (c_0 is approximately 0.3e24 and 0.8e59 for order n=20 and order n=40 respectively).
Therefore, the polynomial Bn(p) is factorized to first and second order polynomials with real coefficients corresponding to zeros and poles representation that is used in this library.
The function returns the coefficients which resulted from factorization of the normalized transfer function
H'(p') = H(p), p' = p/w0
as well as
alpha = 1/w0
the reciprocal of the cut of frequency w0 where the gain of the transfer function is decreased 3dB.
Both, coefficients and cut off frequency were calculated symbolically and were eventually evaluated with high precision calculation. The results were stored in this function as real numbers.
Equation
abs(H(j*w0)) = abs(Bn(0)/Bn(j*w0)) = 10^(-3/20)
which must be fulfilled for cut off frequency w = w0 leads to
[Re(Bn(j*w0))]^2 + [Im(Bn(j*w0))]^2 - (Bn(0)^2)*10^(3/10) = 0
which has exactly one real solution w0 for each order n. This solutions of w0 are calculated symbolically first and evaluated by using high precise values of the coefficients c_k calculated by following (1) and (2).
With w0, the coefficients of the factorized polynomial can be computed by calculating the zeros of the denominator polynomial
n Bn(p) = sum w0^k*c_k*(p/w0)^k k=0
of the normalized transfer function H'(p'). There exist n/2 of conjugate complex pairs of zeros (beta +-j*gamma) if n is even and one additional real zero (alpha) if n is odd. Finally, the coefficients a, b1_k, b2_k of the polynomials
a*p + 1, n is odd
and
b2_k*p^2 + b1_k*p + 1, k = 1,... div(n,2)
results from
a = -1/alpha
and
b2_k = 1/(beta_k^2 + gamma_k^2) b1_k = -2*beta_k/(beta_k^2 + gamma_k^2)
Extends from Modelica.Icons.Function
(Icon for functions).
Type | Name | Description |
---|---|---|
Integer | order | Order of filter in the range 1..41 |
Type | Name | Description |
---|---|---|
Real | c1[mod(order, 2)] | [p] coefficients of Bessel denominator polynomials (a*p + 1) |
Real | c2[integer(0.5 * order),2] | [p^2, p] coefficients of Bessel denominator polynomials (b2*p^2 + b1*p + 1) |
Real | alpha | Normalization factor |
This icon indicates Modelica functions.
Extends from Modelica.Icons.Function
(Icon for functions).
Type | Name | Description |
---|---|---|
Real | den1[:] | [s] coefficients of polynomials (den1[i]*s + 1) |
Real | den2[:,2] | [s^2, s] coefficients of polynomials (den2[i,1]*s^2 + den2[i,2]*s + 1) |
Type | Name | Description |
---|---|---|
Real | cr[size(den1, 1)] | [s^0] coefficients of polynomials cr[i]*(s+1/cr[i]) |
Real | c0[size(den2, 1)] | [s^0] coefficients of polynomials (s^2 + (den2[i,2]/den2[i,1])*s + (1/den2[i,1])) |
Real | c1[size(den2, 1)] | [s^1] coefficients of polynomials (s^2 + (den2[i,2]/den2[i,1])*s + (1/den2[i,1])) |
This icon indicates Modelica functions.
Extends from Modelica.Icons.Function
(Icon for functions).
Type | Name | Description |
---|---|---|
Real | c1[:] | [p] coefficients of denominator polynomials (c1[i}*p + 1) |
Real | c2[:,2] | [p^2, p] coefficients of denominator polynomials (c2[i,1]*p^2 + c2[i,2]*p + 1) |
Type | Name | Description |
---|---|---|
Real | alpha | Correction factor (replace p by alpha*p) |
A band pass with bandwidth "w" is determined from a low pass
1/(p^2 + a*p + b)
with the transformation
new(p) = (p + 1/p)/w
This results in the following derivation:
1/(p^2 + a*p + b) -> 1/( (p+1/p)^2/w^2 + a*(p + 1/p)/w + b ) = 1 /( ( p^2 + 1/p^2 + 2)/w^2 + (p + 1/p)*a/w + b ) = w^2*p^2 / (p^4 + 2*p^2 + 1 + (p^3 + p)a*w + b*w^2*p^2) = w^2*p^2 / (p^4 + a*w*p^3 + (2+b*w^2)*p^2 + a*w*p + 1)
This 4th order transfer function shall be split in to two transfer functions of order 2 each for numerical reasons. With the following formulation, the fourth order polynomial can be represented (with the unknowns "c" and "alpha"):
g(p) = w^2*p^2 / ( (p*alpha)^2 + c*(p*alpha) + 1) * ( (p/alpha)^2 + c*(p/alpha) + 1) = w^2*p^2 / ( p^4 + c*(alpha + 1/alpha)*p^3 + (alpha^2 + 1/alpha^2 + c^2)*p^2 + c*(alpha + 1/alpha)*p + 1 )
Comparison of coefficients:
c*(alpha + 1/alpha) = a*w -> c = a*w / (alpha + 1/alpha) alpha^2 + 1/alpha^2 + c^2 = 2+b*w^2 -> equation to determine alpha alpha^4 + 1 + a^2*w^2*alpha^4/(1+alpha^2)^2 = (2+b*w^2)*alpha^2 or z = alpha^2 z^2 + a^2*w^2*z^2/(1+z)^2 - (2+b*w^2)*z + 1 = 0
Therefore the last equation has to be solved for "z" (basically, this means to compute a real zero of a fourth order polynomial):
solve: 0 = f(z) = z^2 + a^2*w^2*z^2/(1+z)^2 - (2+b*w^2)*z + 1 for "z" f(0) = 1 > 0 f(1) = 1 + a^2*w^2/4 - (2+b*w^2) + 1 = (a^2/4 - b)*w^2 < 0 // since b - a^2/4 > 0 requirement for complex conjugate poles -> 0 < z < 1
This function computes the solution of this equation and returns "alpha = sqrt(z)";
Extends from Modelica.Icons.Function
(Icon for functions).
Type | Name | Description |
---|---|---|
Real | a | Coefficient of s^1 |
Real | b | Coefficient of s^0 |
AngularVelocity | w | Bandwidth angular frequency |
Type | Name | Description |
---|---|---|
Real | alpha | Alpha factor to build up band pass |