Why do I get an error regarding a missing "Dynamic libary file" when importing an FMU in Simulink?

When trying to import an .fmu  into a Simulink model by selecting it in the FMU block, I get the following error:
Error parsing FMU 'myFMU.fmu'
Caused by:
Error in supplied FMU: Dynamic library file ('.dll') does not
exist in FMU 'myFMU.fmu'. For more information, see the FMU troubleshooting documentation.
I might also see the following error when trying to start the simulation in Windows:
Error in supplied FMU: Unable to load dynamic library
'<...>\slprj\_fmu\<...>\myFMU\binaries\linux64\myFMU.so':
<...>\slprj\_fmu\<...>\myFMU\binaries\linux64\myFMU.so is not a valid Win32 application.
. For more information, see the FMU troubleshooting documentation.
When starting the simulation in older releases, the error message may be:
Failed to load FMU for FMU block myModel/myFMUImportBlock.
Warning: Could not find binary file for this platform.
Make sure that the FMU is supported for this platform.

 Accepted Answer

These errors can occur if:
  1. The FMU doesn't contain the platform-specific binary, or
  2. The FMU contains the platform-specific binary, but it is invalid, or
  3. The FMU is malformed or not FMI-compliant.
Step 1: Verify FMU Contents
As a first quick step, verify the FMU contents by renaming the .fmu file to .zip and extracting it. Confirm that a platform-specific binary for your desktop operating system and architecture exists in the binaries subfolder:
For FMI 1.0 and FMI 2.0 based FMUs, expected binaries include:
binaries/win64/myFMU.dll
binaries/linux64/myFMU.so
For FMI 3.0 based FMUs, expected binaries include:
binaries/x86_64-windows/myFMU.dll
binaries/x86_64-linux/myFMU.so
If the platform-specific binary for your desktop computer running MATLAB/Simulink is missing, contact the FMU vendor to provide the binaries for your platform.
NOTE: By upgrading to MATLAB R2024a or later, you can use additional FMU workflows that allow importing FMUs without the platform-specific binary:
  • Auto-Compile Binary (requires the FMU source code): If the FMU is FMI 2.0/3.0 based and contains source code in the sources folder, Simulink will automatically generate the binary for your current desktop platform into the slprj folder. You can also use the fmudialog.compileFMUSources (R2024a+) function.
  • Cross-platform simulation (requires Simulink Compiler): If you are on Windows and the FMU contains only a Linux binary, you can use the cross-platform FMU workflow with WSL, as described in Simulate FMU with Linux Binary on Windows (R2024a+).
.
Step 2: Use FMU Compliance Checker
If the FMU already contains a platform-specific binary, the FMU may still be malformed or not FMI-compliant. In that case, validate the FMU using the FMU Compliance Checker on the same computer where you plan to import it into Simulink. See the following MATLAB Answer for instructions:
If the platform-specific binary is missing, the Compliance Checker may return an error such as:
[FATAL][FMILIB] The FMU contains no binary for this platform.
If the platform-specific binary is included, but invalid, the Compliance Checker may return an error such as:
[FATAL][FMICAPI] Could not load the DLL: %1 is not a valid Win32 application.

More Answers (0)

Categories

Products

Release

R2018a

Community Treasure Hunt

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

Start Hunting!