FMU 3 does not contain all API functions. This leads to an error when using with FMPy

27 ビュー (過去 30 日間)
Karel Viaene
Karel Viaene 2024 年 10 月 17 日
コメント済み: Hitesh 2024 年 10 月 25 日
I created a FMU from a Simulink model with the following settings:
- Matlab version: 2024b (Simulink compiler and FMU add-on is installed)
- FMI version: 3.0
- FMI type: Co-Simulation
I'm using the Python toolbox FMPy (0.3.21) to interact with the FMU. I run into a problem when initializing the FMU: "Function fmi3InstantiateModelExchange is missing in shared library". Apparently in the FMI spec 3.0.1 it states that the FMU must implement all API functions declared in fmi3Functions.h even f they are only needed for interface types or optional capabilities that the FMU does not support. Could it be possible to add the missing functions?
Best regards
  1 件のコメント
Hitesh
Hitesh 2024 年 10 月 18 日
Could you share your simulink file as well as python file where you are using FMPy library to use exported FMU as I am not encountering any such issue?

サインインしてコメントする。

回答 (2 件)

Bavo
Bavo 2024 年 10 月 21 日
Hi Hitesh
I included a zip file containing:
  • requirements.txt (defining the Python libraries; FMPy = 0.3.21)
  • main.py (Python script using the FMU)
  • A screenshot of the Simulink model
  • testModel.slx (Simple Simulink model to export as FMU3)
  • testModel.fmu (FMU3 of the Simulink model)
I'm executing the Python script with Python 3.11.4.
The line where the FMU slave is created an exception is thrown: "Function fmi3InstantiateModelExchange is missing in shared library".
According to the FMI spec 3.0.1 it states that the FMU must implement all API functions declared in fmi3Functions.h even if they are only needed for interace types or optional capabilities that the FMU does not support.
Best regards

Hitesh
Hitesh 2024 年 10 月 21 日
編集済み: Hitesh 2024 年 10 月 21 日
Hi Bavo,
Based on my understanding of the error, it looks that the function "fmi3InstantiateModelExchange" is absent from the shared library linked to the FMU.This function is required for instantiating a Model Exchange FMU, and its absence suggests that the FMU might not support Model Exchange or there's an issue with the FMU file itself.
Since FMI is a third-party tool, they have recognized this issue on their forum and are currently addressing it. You can find more information at the following link:
  2 件のコメント
Bavo
Bavo 2024 年 10 月 21 日
Hi Hitesh
The absence of "fmiInstantiateModelExchange" indeed suggests that there is something wrong with the FMU generated by Matlab. I posted this issue also on the Github FMPy issue list, but they say the Matlab FMU should follow the FMI 3.0.1 specifications. (Compatibility Matlab FMU3 with FMPy 3 · Issue #700 · CATIA-Systems/FMPy)
I was hoping to get the attention of Matlab (Simulink compiler toolbox), so they can provide an updated version of the FMU builder add-on.
Best regards
Hitesh
Hitesh 2024 年 10 月 25 日
Hi Bavo
I think this might be best handled with MathWorks tech support. Could you submit a technical support request?

サインインしてコメントする。

製品


リリース

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by