- Index
- » Programming
- » Modelica Language
- » Transferfunction initialisation
Transferfunction initialisation
Transferfunction initialisation
Hello,
I want to create a transferfunction in which I initialise the coefficients a,b with an external function call. I do this with:
extends Modelica.Blocks.Continuous.TransferFunction((a,b) =getA(m=26.0))
However, this gives me the error message "missing token ')'". The function getA is rather trivial a:
function getA
input Real m;
output Real a[2];
output Real b[2];
algorithm
a := {4, 2 * m};
b := {9, 10};
end getA;
If I try it with one output, it works fine, but I would like to initialise both with one function. Does anyone know how this can be approached?
----------
addition: The goal of this whole exercise is to initialise the transfer function based on some other parameters. With these first parameters, I do some calculations, and this results in the coefficients of the transferfunction. Any other way of implementing this, is perfectly fine with me, of course
----------
Thanks for any pointer.
Bas
- bjdekruif
- 18 Posts
Re: Transferfunction initialisation
Hello,
I got it working, and just wanted to post the result if anybody want do the same in the future. If somebody knows a better solution, please feel free to comment on the solution. Anyway:
model PD
extends Modelica.Blocks.Continuous.TransferFunction(a = p, b = q);
parameter Real[2] p(start = {1, 1},fixed = false);
parameter Real[2] q(start = {1, 1},fixed = false);
initial equation
(p, q) = getA(m=10.3);
end PD;
With the function getA I can calculate the num and den for a PD controller based on the mass, bandwidth and phase margin. These are passed to the transferfunction and it simulates now with these coefficients.
Bas
- bjdekruif
- 18 Posts
- Index
- » Programming
- » Modelica Language
- » Transferfunction initialisation