#6002 closed defect (fixed)
Undefined variable units when using FMUs
Reported by: | Owned by: | Lennart Ochel | |
---|---|---|---|
Priority: | critical | Milestone: | 1.16.0 |
Component: | FMI | Version: | |
Keywords: | fmpy | Cc: |
Description
Dear OM team,
When using FMUs (exported with OpenModelica only) within python code and the FMPy library, an error blocks the code run, similar to the one shown here: https://github.com/CATIA-Systems/FMPy/issues/113 .
Any help is appreciated.
Best,
Marwa
Attachments (6)
Change History (20)
comment:1 by , 4 years ago
Milestone: | Future → 1.16.0 |
---|
by , 4 years ago
Attachment: | AixLib.Fluid.FMI.ExportContainers.Examples.FMUs.ThermalZone.fmu added |
---|
OMC FMU
by , 4 years ago
Attachment: | AixLib_Fluid_FMI_ExportContainers_Examples_FMUs_ThermalZone.fmu added |
---|
Dymola FMU
by , 4 years ago
Attachment: | FMU_test.py added |
---|
Test that triggers error message with OMC-exported FMU
by , 4 years ago
Attachment: | Dymola_FMU_log.txt added |
---|
Output after running "FMU_test.py" with Dymola FMU
comment:2 by , 4 years ago
Thanks for the lightening fast reply, casella!
I was using OMC 1.14 and switched to 1.16 as recommended in your links, but the error message still showed up. However, now a different unit is shown as undefined.
Having said that, for a MWE, we can export this AixLib model as an FMU (attached), then run "FMU_test.py" to get the error message shown in "OMC_FMU_log.txt". To give the whole picture, "OMC_FMI.PNG" shows the FMI settings used. (It could be that I missed something there?)
A Dymola FMU exported from the same AixLib model and the output from running the Python script with it are also attached to show how an ideal run could look like.
Thanks for your time :-)
follow-up: 9 comment:4 by , 4 years ago
Status: | new → accepted |
---|
I will take care of the issue. There are two problems (in OpenModelica):
- Unknown units, in this case bar, shouldn't be exported at all.
- The unit bar shouldn't be unknown.
comment:8 by , 4 years ago
No, this one was FMI specific. #4608 seems to fail much earlier in the compiler.
comment:9 by , 4 years ago
Replying to lochel:
I will take care of the issue. There are two problems (in OpenModelica):
- Unknown units, in this case bar, shouldn't be exported at all.
- The unit bar shouldn't be unknown.
I've been wrong with (1). Unknown units should be exported in the UnitDefinitions
but obviously without a BaseUnit
representation.
comment:10 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
I pushed the changes to the master and it will be available in the next nightly build. Please reopen this ticket if the problem isn't solved for you.
comment:11 by , 4 years ago
Again, thank you very much for the quick reponse and fix!
I can't test it yet because the models I'm using still operate with Modelica 3.2.3. However, hope that in the meantime other users could benefit from this OMC update. :-)
comment:12 by , 4 years ago
You can load Modelica 3.2.3 in any number of OpenModelica versions, including the nightly builds. If you have multiple versions of Modelica available, you can change from "default" to "3.2.3" in OMEdit to have it loaded automatically on startup.
comment:13 by , 4 years ago
Even better, just install 1.16.0-dev.03, which does not include MSL 4.0.0, which we still don't fully support. In fact, it's not even been formally approved by the Modelica Association yet.
comment:14 by , 4 years ago
Thanks so much for the helpful suggestions! :-)
I can confirm that it works with both Windows and Linux OMCs. 👍
@marwa, in general it would be really helpful if you could attach one or more minimal working examples to this ticket, that allow us to reproduce the problem. Without a concrete example it is often hard to figure out what's wrong and fix it.
That said, #5845 or #5920 may have fixed that already. Which version of OMC are you using? Could you try the latest nightly build?
Thanks!