- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Can not Fetch Interface Data from an...
Can not Fetch Interface Data from an FMU generated by OpenModelica
Can not Fetch Interface Data from an FMU generated by OpenModelica
Hi,
I am trying to exploit OpenModelica FMI TLM Co-simulation feature. I am running on OMC 1.14.2. I am quite new in Modelica FMI feature, if my question is very basic, I apologise.
/*EDITED*/
I successfully exported Modelica.Mechanics.Rotational.Examples.Utilities.DirectInertia as an FMU.
As per https://build.openmodelica.org/Document … fFMUs.html , it is said that this model can be used to test import/export FMU feature in Modelica.
The FMU is then imported back to OpenModelica using the toolbar function "import FMU". Then, I drag and drop the FMU into a new composite model "CompositeModel1". However, when I try to fetch the interface data, the fetching process did not progress at all, even after waiting for 30 minutes. The only message in the "output window" is:
Code:
/usr/bin/../OMTLMSimulator/bin/tlmmanager -r /tmp/OpenModelica_philgun/OMEdit/Modelica.Mechanics.Rotational.Examples.Utilities.DirectInertia/CompositeModel1.xml
Is there anything wrong with my OpenModelica? I reckon, since the model that I use is coming from Modelica standard example, it should not contain any error. I am hitting a dead end and could not find any solution available online. Any help will be very appreciated! Thanks!
Cheers,
Phil
Re: Can not Fetch Interface Data from an FMU generated by OpenModelica
I'm not sure how it worked in OpenModelica v1.14.2, but would suggest to use a recent version of OpenModelica, e.g. v1.18.0. At least if there are no reasons why you stick with v1.14.
The way you can import FMUs changed in recent versions.
For v1.18 / v1.19.dev there are two ways to import FMUs in OMEdit:
1) Import FMU via importFMU.
That is what is happening in OMEdit when you run `File->Import->FMU`.
It basically creates a new Modelica model that wraps the FMU. Problem is that this is not always working and the generated Modelica model is not legal Modelica code and OpenModelica will issue errors in some cases.
So yes, there is a serious bug in OpenModelica and it is not fixed yet.
2) Import FMU via OMSimulator through SSP.
Sadly the documentation isn't up to date there. I'll fix it, but it will take a day or so until the documentation online will be updated.
I would recommend the second way, even though it is more complicated to do at the moment, but at least it should work for most composite models.
- AnHeuermann
- 52 Posts
Re: Can not Fetch Interface Data from an FMU generated by OpenModelica
Oh and by the way we created a tutorial on how to export/ import FMUs with OpenModelica and OMSimulator.
It can be found in our OpenModelica/OMTeaching GitHub repository.
Maybe a bit more then what you currently want to do, but could be a good starting point to get going. The tutorial was written using OpenModelica v1.17 but should work with the latest v1.19.dev as well.
- AnHeuermann
- 52 Posts
Re: Can not Fetch Interface Data from an FMU generated by OpenModelica
Hi An,
Thanks for the answers. I will consider to re-install my OM to v1.17.
The reason why I keep using v1.14 is that all the component models in the system were written using OM < 1.14, and it works perfectly on 1.14.
I do not know what complication that it will bring when I change to v.1.17.
My colleague, who is using v 1.17, could not compile the system model which worked perfectly in 1.14. Here is the snapshot of her error:
Code:
[/var/lib/jenkins2/ws/LINUX_BUILDS/tmp.build/openmodelica-1.17.0/OMCompiler/Compiler/NFFrontEnd/NFUnit.mo:883:7-883:68:writable] Error: Internal error function lexer failed
Do you know what the errors mean?
Your thought will be very much appreciated! Thank you so much.
Cheers
Re: Can not Fetch Interface Data from an FMU generated by OpenModelica
Can you post a minimal working example of a model that worked under v1.14 and is not working under v1.18 any more?
Could be that is is just the difference between old and new frontend or that it is a bug.
Also the new description on graphical modeling with SSP in OMEdit is now life (at least in the OMSimualtor User's Guide): https://openmodelica.org/doc/OMSimulato … MEdit.html
- AnHeuermann
- 52 Posts
Re: Can not Fetch Interface Data from an FMU generated by OpenModelica
Hi An,
Sorry to take quite a long time to get back to you. I managed to update my OM to the latest stable version:
Code:
OpenModelica 1.18.0~23-g2c8def3
Then, I proceed by following the tutorial in:
Code:
https://github.com/OpenModelica/OMTeaching
combined by following:
Code:
https://openmodelica.org/doc/OMSimulator/master/html/OMEdit.html
I managed to export system1 and system2 from DualMassOscillator model as FMUs (CS & ME). I then followed the tutorial to use SSP, added both FMUs as sub-models, and finally connected the I/Os. The system looked exactly similar to the one shown in the OMEdit tutorial.
However, when I hit the 'simulate' button in OMEdit, I got the following error:
Code:
/usr/bin/../bin/OMSimulatorPython3 /usr/bin/../share/OMSimulator/scripts/OMSimulatorServer.py --model=/tmp/OpenModelica_philgun/OMEdit//Model.ssp --endpoint-pub=tcp://127.0.0.1:46325 --logLevel=0 --option "--suppressPath=true"
No such file or directorySimulation process finished successfully.
I already double-checked the directory where my Model.ssp was located, the address for --model args was correct. Do you know what might cause this error?
Thanks a lot.
Cheers,
P
Re: Can not Fetch Interface Data from an FMU generated by OpenModelica
Hard to tell what exactly went wrong without seeing your model.
I would suggest to try simulating your Model.ssp with OMSimulator directly (without the Python layer in-between). Could be that the error is somewhere in OMSimulatorPython3 or that my Jupyter Notebook is no longer working (issues with CVODE FMUs or MSL4 vs MSL 3).
So use your shell and run
Code:
cd /tmp/OpenModelica_philgun/OMEdit/
OMSimulator Model.ssp
- AnHeuermann
- 52 Posts
Re: Can not Fetch Interface Data from an FMU generated by OpenModelica
Hi Ann,
Thanks for your reply. Apparently, when I followed your suggestion to run the Model.ssp using OMSimulator directly, I got this error:
Code:
OMSimulator: command not found
It is a bit strange since I follow the installation straight from the OpenModelica website. I started with OM 1.14.2 then running a software update
Code:
sudo apt upgrade
to upgrade my OM to 1.18.0~23-g2c8def3. In OM GitHub, it is written that OMSimulator is part of OpenModelica.
Do I need to uninstall the OM that I have and re-install it again from scratch?
Cheers,
P
Re: Can not Fetch Interface Data from an FMU generated by OpenModelica
I'm not sure, you might want to check your PATH variable. Or maybe OMSimulator wasn't installed/updated. Reinstalling could be an option. If that doesn't work as well you should open a ticket about it.
- AnHeuermann
- 52 Posts
Re: Can not Fetch Interface Data from an FMU generated by OpenModelica
Hi An,
I have re-installed OM 1.18 from scratch following the guidelines posted on
https://openmodelica.org/download/download-linux
However I still got the same problem, OMSimulator can not be found in my machine. I checked my path and it was pointing to .local/bin and other possible locations that store an executable.
Where usually OMSimulator is installed in on a linux machine? Should I open a ticket now?
Cheers,
Phil
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Can not Fetch Interface Data from an...