modelon-community / PyFMI

PyFMI is a package for loading and interacting with Functional Mock-Up Units (FMUs) both for Model Exchange and Co-Simulation, which are compiled dynamic models compliant with the Functional Mock-Up Interface (FMI)
http://jmodelica.org/pyfmi
GNU Lesser General Public License v3.0
163 stars 37 forks source link

Unzip directory for the fmu after load_fmu #269

Open hamidL3S opened 4 days ago

hamidL3S commented 4 days ago

I have developed a generation FMU tool that creates FMUs for Linux on co-simulation mode. I am wondering where the extracted files are located when PyFMI loads an FMU.

I am asking this question because we export several dynamic libraries (.so files) within the binaries/linux64 directory and not just for th emodel :

...... MyFMuLib.so depends on other libraries that I provide in the binaries directory (lib1.so and lib2.so). I should explicitly load these two libraries using dlopen, but I need to know where they are located after pyfmi dezipped the fmu. I supposed that when PyFMI calls MyLib.so, it will provide the "resourceLocation", and I need to go to resourceLocation/../binaries/linux64 to find where the other libraries are. Can someone please correct, answer or help? Thanks!
PeterMeisrimelModelon commented 4 days ago

Hi hamidL3S,

by default it will be unzipped to a temporary directory. There is the option that you unzip the FMU and then provide the path to the unzipped FMU to load it from there. This sounds like it would be the most suitable approach for you, giving you control over where your unzipped FMU is.

Usage is: load_fmu("path/to/your/unzipped/fmu", allow_unzipped_fmu = True) or respectively FMUModelCS2("path/to/your/unzipped/fmu", allow_unzipped_fmu = True).

Please try and see if that works for you!

/Peter