Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#5718 closed defect (invalid)

Got type mismatch error, but matching types.

Reported by: Vladimir Korolev<balodja@…> Owned by: somebody
Priority: normal Milestone: Future
Component: *unknown* Version:
Keywords: Cc:

Description

Hello,

I'm trying to implement the RLS identifier (see the attachment) in the Modelica language. And I'm stuck with some error, which I can't recognize due to unhelpful compiler output. So:

$ omc test.mo RlsIdentifier.mo
Error processing file: test.mo
[bla-bla-bla/RlsIdentifier.mo:13:3-13:26:writable] Error: Got type mismatch error, but matching types Real[size(x, 1), :].
This is a ***COMPILER BUG***, please report it to https://trac.openmodelica.org/OpenModelica.
Error: Error occurred while flattening model test

# Error encountered! Exiting...
# Please check the error message and the flags.

Execution failed!

Moreover I'm new to Modelica, so I don't even have a clue, where to dig for the solution.

Attachments (3)

code.tar.xz (796 bytes ) - added by anonymous 5 years ago.
RlsIdentifier.mo (917 bytes ) - added by Francesco Casella 5 years ago.
test.mo (320 bytes ) - added by Francesco Casella 5 years ago.

Download all attachments as: .zip

Change History (8)

by anonymous, 5 years ago

Attachment: code.tar.xz added

comment:1 by anonymous, 5 years ago

$ omc --version
OpenModelica 1.14.0~dev-26754-g0218247

comment:2 by Francesco Casella, 5 years ago

First of all, I recommend you to use the 1.14.0-dev.beta3 release, the nightly build you report is obsolete.

If you are new to Modelica, I also recommend you to use the OMEdit graphical user interface, the command line requires some extra care.

I had to appy some fixes to the test cases (basically, adding .* to import statements) to avoid lookup errors, see attachments.

Having done that, either you load the two .mo files in OMEdit, or, if you want to use the command line, you need to type

omc -d=newInst -s test.mo RlsIdentifier.mo Modelica

The first option uses the new frontend, which is more likely to work correctly, see #4138, though this is not really necessary here. The second is to simulate the model (otherwise you simply get the flat model on stdout). You also need to load the Modelica standard library, unless you add a uses annotation to your model.

Having done that you get:

[D:/Temp/OMEdit/RlsIdentifier.mo:3:3-3:89:writable]
Error: Failed to deduce dimension 1 of x due to missing binding equation.

The problem here is that you left the dimensions of those matrices unspecified, and those can only be inferred from binding equations (e.g. Real x[:] = {1, 2};, not from regular equations

I would suggest you to use Integer parameters to set those matrix dimensions.

Last edited 5 years ago by Francesco Casella (previous) (diff)

by Francesco Casella, 5 years ago

Attachment: RlsIdentifier.mo added

by Francesco Casella, 5 years ago

Attachment: test.mo added

comment:3 by Francesco Casella, 5 years ago

Resolution: invalid
Status: newclosed

in reply to:  2 comment:4 by anonymous, 5 years ago

casella,

Thank you for such a long and detailed answer, I really appreciate that!

All the links and suggestions are quite helpful for me, especially the tip about -d=newInst. Compiler error reports are much more sound now.

And sorry for reporting the false positive bug, I was mislead by the bold COMPILER BUG message.

comment:5 by Francesco Casella, 5 years ago

The COMPILER BUG message was a but by itself :)

Version 0, edited 5 years ago by Francesco Casella (next)
Note: See TracTickets for help on using tickets.