Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

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.

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).

Re: Problems with function calls in modelica functions

I've installed r8526 for Windows (is r8534 available somewhere ?)... and now, it's worse, I cannot even create a new function from OMEdit !

"File->New Function->toto->Error has occurred".

There are 0 guests and 0 other users also viewing this topic
You are here: