Search code examples
modelicaopenmodelicasystemmodeler

Why does using a flexible array input in a function raise a translation error in OpenModelica?


In my opinion, the following simple function is perfectly legal Modelica code:

function foo "Returns true"
  input Boolean[:] x "Vector of booleans";
  output Boolean y "= true, in any case here";
algorithm
  y := true;
end foo;

Using Check Model in OpenModelica v1.16.2 (64-bit) raises an error:

[1] 15:15:11 Translation Error
[foo: 2:3-2:42]: Failed to deduce dimension 1 of x due to missing binding equation.

Is there something wrong with the Modelica code or is this an OME issue?

EDIT

Just to show, that this is in fact not a clear cut case:
This is the message one gets upon validating foo in Wolfram System Modeler 12.2:

[3] 10:59 Validation of function foo
Validation of function foo completed successfully.


Solution

  • The error message should be: "OpenModelica does not check or instantiate functions. To test a function, use it in a model."