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 // must be < 0
This function computes the solution of this equation and returns "alpha = z^2" and "c";
encapsulated function bandPassAlpha import Modelica; input Real a "Coefficient of p^1"; input Real b "Coefficient of p^0"; input Modelica.Units.SI.AngularVelocity w "Bandwidth angular frequency"; output Real alpha "Alpha factor to build up band pass"; end bandPassAlpha;