1. Help Center
  2. Twin Builder
  3. Functional Mockup Unit (FMU)

Why does my Python-generated FMU model fail to load model's DLL when Analyzing in Twin Builder?

If one tries to analyze a Python-generated Functional Mockup Unit (FMU) model that is not self-contained, Twin Builder may issue a message such as "Error - Failed to load model's Dll for " model.

The error message means that the FMU is not self-contained.  It means that the FMU has external dependencies that cannot be satisfied.  Files are likely missing from the binaries\win64 folder of the FMU.   

It should be noted that an FMU file is a compressed folder file that contains folders and files much like a .zip file.  Below is a procedure to provide the missing files, assuming the user is using Windows OS with version 3.12 of Python.

Steps to generate a self-contained FMU

  1. Rename the FMU file to change the extension from .fmu to .zip.



  2. Extract all...   to extract files out of the .zip file.
  3. Navigate into the FMU folder and to the binaries\win64 folder, and check if there is only one .dll file.  There should be two additional .dll files.  In this situation, there are two missing files.



  4. Open another File Explorer window and navigate to the Python installation folder.
    For example, the Python installation folder may be at:
    C:\Users\UserName\AppData\Local\Programs\Python\Python312

    Note the following files.  These files also need to be in the FMU binaries\win64 folder.
        python3.dll
        python312.dll



  5. Copy these two files (python3.dll and python312.dll) to the binaries\win64 folder of the FMU.
    Confirm the files have been copied to the binaries\win64 folder.



  6. Go up the directory structure one step above the FMU folder. 
    Rename the FMU folder.
    Right click the folder name and Compress to...  ZIP file.



  7. Rename the new .zip file to include the .fmu extension.