1

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.

gwr
  • 465
  • 6
  • 17

1 Answers1

4

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

sjoelund.se
  • 3,468
  • 12
  • 15
  • But then it should simply be a `message`? Giving an `error` when there is none or when errors were not checked for (i.e. `skipped`) is an `error` in itself imo. – gwr Jan 31 '21 at 15:35
  • I opened a new issue at OpenModelica's trac [#6359](https://trac.openmodelica.org/OpenModelica/ticket/6359). – gwr Jan 31 '21 at 18:28
  • No, it really should be an error message. You're using the wrong functionality. Or OMEdit should gray out the buttons for functions (and packages) – sjoelund.se Feb 01 '21 at 07:18
  • Ok, I see your point as it indeed says `Check Model`—not `Validate Class` in OMEdit, which is different from Wolfram SystemModeler to which I am mostly used (tricky as buttons look alike). ;-) – gwr Feb 01 '21 at 14:26