#6002 closed defect (fixed)
Undefined variable units when using FMUs
Reported by: | marwa.maghnie@… | Owned by: | lochel |
---|---|---|---|
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 Changed 4 years ago by casella
- Milestone changed from Future to 1.16.0
comment:2 Changed 4 years ago by marwa
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 :-)
comment:3 Changed 4 years ago by casella
- Priority changed from high to critical
@lochel, what do you think of this?
comment:4 follow-up: ↓ 9 Changed 4 years ago by lochel
- Status changed from new to 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:5 Changed 4 years ago by lochel
comment:6 Changed 4 years ago by casella
Thanks!
comment:7 Changed 4 years ago by casella
Is this related to #4608, perhaps?
comment:8 Changed 4 years ago by lochel
No, this one was FMI specific. #4608 seems to fail much earlier in the compiler.
comment:9 in reply to: ↑ 4 Changed 4 years ago by lochel
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 Changed 4 years ago by lochel
- Resolution set to fixed
- Status changed from accepted to 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 Changed 4 years ago by marwa
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 Changed 4 years ago by sjoelund.se
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 Changed 4 years ago by casella
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 Changed 4 years ago by marwa
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!