- Index
- » Programming
- » Modelica Language
- » Problems with function calls in...
Problems with function calls in modelica functions
Problems with function calls in modelica functions
Hello,
I try to develop an application in Modelica and I don't understand why I cannot make function calls in another modelica function (define as usual sub-functions and a main function with Modelica). Even with simple examples, I get the message "Error occurred building AST - Syntax error".
Do you have an idea about the problem ?
Thanks.
Kind Regards.
Re: Problems with function calls in modelica functions
It sounds like you are trying to use OMShell or maybe OMNotebook to pass classes to the compiler. If you do so, you need to pass all functions at the same time because some type-checking is done if I recall correctly. Otherwise I would need to see some sample code.
- sjoelund.se
- 1700 Posts
Re: Problems with function calls in modelica functions
Ok but how to pass functions at the same time ?
I write the functions with OMEdit and call them from OMShell. For instance, with two simple functions "Sum" and "Average" :
/////////////////////////////////
function Sum
input Real a;
input Real b;
output Real s;
algorithm
s:=a + b;
end Sum;
///////////////////////////////////
function Average
input Real x;
input Real y;
output Real z;
algorithm
z:=Sum(x, y) / 2;
end Average;
/////////////////////////////////
I cannot save the second function with OMEdit because of the call of the first one that generates an error message. Do I forget something ?
Thanks a lot for your help.
Re: Problems with function calls in modelica functions
Yes, it seems OMEdit could not reliably create functions. I have changed it to no longer do type-checking of functions (in r8534).
- sjoelund.se
- 1700 Posts
- Index
- » Programming
- » Modelica Language
- » Problems with function calls in...