Hello everyone,
when I'm trying to compile (compile_jmu())my model the following error occurs:
"Error: in file 'C:/workspace/testModelTotal.mo':
Semantic error at line 44, column 18:
Could not evaluate binding expression for parameter 'y': 'InjectSH.Function2(x1, x2)'"
Here an overview of my (very simple) model testModel:
model testModel
parameter Real x1= 1;
parameter Real x2 = 2;
parameter Real y= InjectSH.Function2(x1,x2);
Real z;
equation
z = y*3;
end testModel;
The function Function2 that is being called is the following:
function Function2
input Real x1;
input Real x2;
output Real y;
protected
Real z1;
Real z2;
algorithm
(z1,z2) :=InjectSH.Function3(x1, x2);
y:= z1 + z2;
end Function2;
And again this function Function3 is:
function Function3
input Real p;
input Real h;
output Real d;
output Real x;
algorithm
d := p*h;
x := p+h;
end Function3;
I'm using jModelica 1.6
What I have found out so far:
- if I only want to have the first output of Function3,i.e. writing
z1 :=InjectSH.Function3(x1, x2);in Function2, everything works - if I change my testModel so that I set y in the equation part, i.e.
Real y;
equation
y = InjectSH.Function2(x1,x2);
again everything works fine - if I call Function3 directly in my testModel, e.g. with
(y,z) = InjectSH.Function3(x1,x2);it also works
So it's not a problem with the 2 functions and not a problem with setting the parameter y in a model with a function call.
What am I doing wrong or is it a bug?
best regards