FMUException: Error loading the binary. Could not load the DLL: A dynamic link library (DLL) initialization routine failed

NiPapen

I'm using pyfmi for loading the Modelica generated model in Python. Once I load the model I want to perform an optimization and parameter estimation. The issue is that for every parameter estimation (optimization iteration) the FMU needs to be loaded ususally it needs around 300-400 itterations but it is not converging because of binary loading error.Where should I look for soultions? Any hints are welcome.

def fun2optim(theta):##  Funtion to optimize with the initial guess of paramameter values theta
    model = load_fmu("MOdel_0IV_0curves.fmu")## LOAD THE FMU
    res = model.simulate(input=foo(theta),final_time=1)
    results_VV=np.array([]) ###SAVE THE OUTPUT IN ARRAY
        for i in range(200,400):
        out=(res[output_IV[i]])
        results=out[0::5] #Dymola FMU has 5 same IV curve points
        results_VV=np.append(results_VV,results)
    return(results_VV)

def RMSE (theta): ## results_V are the ideal values
    tt=sum(np.sqrt((fun2optim(theta)-results_V)**2).mean())
    return(tt)

from scipy import optimize
res11=optimize.minimize(RMSE,thetaInit,method='nelder-mead', options={'xtol':   1e-4, 'disp': True})

After 50-60 itterations I got an error:

FMUException: Error loading the binary. Could not load the DLL: A dynamic link library (DLL) initialization routine failed.
Christian Winther

I've experienced similar problems before with Dymola FMUs and my best guess is that something is not unloaded correctly which in the end leads to the problem.

I'd suggest to change your code to:

model = load_fmu("MOdel_0IV_0curves.fmu")## LOAD THE FMU
def fun2optim(theta):##  Funtion to optimize with the initial guess of paramameter values theta
    global model
    model.reset()
    res = model.simulate(input=foo(theta),final_time=1)
    results_VV=np.array([]) ###SAVE THE OUTPUT IN ARRAY
    for i in range(200,400):
       out=(res[output_IV[i]])
       results=out[0::5] #Dymola FMU has 5 same IV curve points
       results_VV=np.append(results_VV,results)
    return(results_VV)

In this way you do not reload the FMU each time (you just reset it) which also will lead to a performance boost.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation

From Java

Tensorflow error : DLL load failed: The specified procedure could not be found

From Java

"import torch" giving error "from torch._C import *, DLL load failed: The specified module could not be found"

From Javascript

Electron Uncaught Error: A dynamic link library (DLL) initialization routine failed

From

Calling Golang from Java using JNI on Windows leads to "A dynamic link library (DLL) initialization routine failed"

From Dev

php: loading oracle driver gives error "Unable to load dynamic library - The specified procedure could not be found."

From Dev

How can I bypass kivy module error: ImportError: DLL load failed: The specified module could not be found?

From Dev

Pyinstaller: Import Error: DLL load failed: The specified module could not be found

From Dev

could not load library plpython3.dll

From Dev

Unable to load dynamic library php_zmq.dll - The specified module could not be found

From Dev

Electron running SQLlite 3 on Windows - A dynamic link library (DLL) initialization routine failed

From Python

Cannot import from pywinauto: ImportError: DLL load failed while importing win32ui: A dynamic link library (DLL) initialization routine failed

From Dev

Error importing numpy from Anaconda, using conda (DLL load failed: The specified module could not be found)

From Dev

Error while importing Tensorflow. A dynamic link library (DLL) initialization routine failed

From Dev

The ordinal 3283 could not be located in the dynamic link library libmysql.dll

From Dev

Tensorflow : DLL load failed: A dynamic link library (DLL) initialization routine failed

From Dev

Could not load SSL library - dll not found

From Dev

Load PowerPoint Object Library on Excel - 'Error in loading dll'

From Dev

Trying to use win32ui with pywin32 gives: A dynamic link library (DLL) initialization routine failed

From Dev

Server library could not be loaded and the dynamic link library LIBPQ.dll

From Dev

Could not be located in dynamic link library php4ts.dll

From Dev

The procedure entiy [email protected] could not belocated in the dynamic link library jvm.dll

From Dev

VSTOInstaller.exe error 0x8007007F The procedure entry point GetFileVersionInfoExW could not be located in the dynamic link library VERSION.dll

From Dev

Error loading Office.dll COMException: 'Errorloading type library/DLL'

From Dev

The procedure entry point ... [email protected]@Qt3DRender ... could not be located in the dynamic link library ... *.dll

From Dev

C#: A dynamic link library (DLL) initialization routine failed

From Dev

Could not load dynamic library 'cudnn64_8.dll'; dlerror: cudnn64_8.dll not found

From Dev

How to fix Java 15 JNI "UnsatisfiedLinkError: A dynamic link library (DLL) initialization routine failed"

From Dev

Python.NET & TensorFlow & CUDA: Could not load dynamic library 'cublas64_11.dll'

Related Related

  1. 1

    Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation

  2. 2

    Tensorflow error : DLL load failed: The specified procedure could not be found

  3. 3

    "import torch" giving error "from torch._C import *, DLL load failed: The specified module could not be found"

  4. 4

    Electron Uncaught Error: A dynamic link library (DLL) initialization routine failed

  5. 5

    Calling Golang from Java using JNI on Windows leads to "A dynamic link library (DLL) initialization routine failed"

  6. 6

    php: loading oracle driver gives error "Unable to load dynamic library - The specified procedure could not be found."

  7. 7

    How can I bypass kivy module error: ImportError: DLL load failed: The specified module could not be found?

  8. 8

    Pyinstaller: Import Error: DLL load failed: The specified module could not be found

  9. 9

    could not load library plpython3.dll

  10. 10

    Unable to load dynamic library php_zmq.dll - The specified module could not be found

  11. 11

    Electron running SQLlite 3 on Windows - A dynamic link library (DLL) initialization routine failed

  12. 12

    Cannot import from pywinauto: ImportError: DLL load failed while importing win32ui: A dynamic link library (DLL) initialization routine failed

  13. 13

    Error importing numpy from Anaconda, using conda (DLL load failed: The specified module could not be found)

  14. 14

    Error while importing Tensorflow. A dynamic link library (DLL) initialization routine failed

  15. 15

    The ordinal 3283 could not be located in the dynamic link library libmysql.dll

  16. 16

    Tensorflow : DLL load failed: A dynamic link library (DLL) initialization routine failed

  17. 17

    Could not load SSL library - dll not found

  18. 18

    Load PowerPoint Object Library on Excel - 'Error in loading dll'

  19. 19

    Trying to use win32ui with pywin32 gives: A dynamic link library (DLL) initialization routine failed

  20. 20

    Server library could not be loaded and the dynamic link library LIBPQ.dll

  21. 21

    Could not be located in dynamic link library php4ts.dll

  22. 22

    The procedure entiy [email protected] could not belocated in the dynamic link library jvm.dll

  23. 23

    VSTOInstaller.exe error 0x8007007F The procedure entry point GetFileVersionInfoExW could not be located in the dynamic link library VERSION.dll

  24. 24

    Error loading Office.dll COMException: 'Errorloading type library/DLL'

  25. 25

    The procedure entry point ... [email protected]@Qt3DRender ... could not be located in the dynamic link library ... *.dll

  26. 26

    C#: A dynamic link library (DLL) initialization routine failed

  27. 27

    Could not load dynamic library 'cudnn64_8.dll'; dlerror: cudnn64_8.dll not found

  28. 28

    How to fix Java 15 JNI "UnsatisfiedLinkError: A dynamic link library (DLL) initialization routine failed"

  29. 29

    Python.NET & TensorFlow & CUDA: Could not load dynamic library 'cublas64_11.dll'

HotTag

Archive