dzp = 'constructor'.fromFactorization(n1, n2, d1, d2, k, Ts, method) dzp = 'constructor'.fromFactorization(n1, n2, d1, d2, k, Ts, method, uName, yName)
This function constructs a DiscreteZerosAndPoles transfer function from the real first and scond order polynomials of the numerator and the denominator, respectively.
(q + 0.1)
dzp = 4 * -----------------
(q + 1)*(q - 0.1)
is defined as
import Complex;
import Modelica_LinearSystems2.DiscreteZerosAndPoles;
dzp = DiscreteZerosAndPoles(n1={0.1},n2=fill(0,0,2), d1={1,-0.1}, d2=fill(0,0,2), k=4);
which is equal to
dzp = DiscreteZerosAndPoles(n1={0.1},n2=fill(0,0,2), d1=fill(0,0), d2=[0.9, -0.1], k=4);
encapsulated function fromFactorization
import Modelica;
import Modelica_LinearSystems2;
import Modelica_LinearSystems2.DiscreteZerosAndPoles;
input Real n1[:] = fill(0, 0) "[p^0] coefficients of 1st order numerator polynomials" annotation(
Dialog(group = "y = k*(product(p+n1[i]) * product(p^2+n2[i,1]*p+n2[i,2])) / (product(p+d1[i])*product(p^2+d2[i,1]*p+d2[i,2])) *u"));
input Real n2[:, 2] = fill(0, 0, 2) "[p,p^0] coefficients of 2nd order numerator polynomials" annotation(
Dialog(group = "y = k*(product(p+n1[i]) * product(p^2+n2[i,1]*p+n2[i,2])) / (product(p+d1[i])*product(p^2+d2[i,1]*p+d2[i,2])) *u"));
input Real d1[:] = fill(0, 0) "[p^0] coefficients of 1st order denominator polynomials" annotation(
Dialog(group = "y = k*(product(p+n1[i]) * product(p^2+n2[i,1]*p+n2[i,2])) / (product(p+d1[i])*product(p^2+d2[i,1]*p+d2[i,2])) *u"));
input Real d2[:, 2] = fill(0, 0, 2) "[p,p^0] coefficients of 2nd order denominator polynomials" annotation(
Dialog(group = "y = k*(product(p+n1[i]) * product(p^2+n2[i,1]*p+n2[i,2])) / (product(p+d1[i])*product(p^2+d2[i,1]*p+d2[i,2])) *u"));
input Real k = 1.0 "Multiplicative factor of transfer function" annotation(
Dialog(group = "y = k*(product(p+n1[i]) * product(p^2+n2[i,1]*p+n2[i,2])) / (product(p+d1[i])*product(p^2+d2[i,1]*p+d2[i,2])) *u"));
input Modelica.Units.SI.Time Ts = 1 "Sample time";
input Modelica_LinearSystems2.Utilities.Types.Method method = Modelica_LinearSystems2.Utilities.Types.Method.Trapezoidal "Discretization method";
input String uName = "" "input name";
input String yName = "" "output name";
output DiscreteZerosAndPoles dzp(redeclare Real n1[size(n1, 1)], redeclare Real n2[size(n2, 1), 2], redeclare Real d1[size(d1, 1)], redeclare Real d2[size(d2, 1), 2]) "ZerosAndPoles transfer function";
end fromFactorization;