modelica-3rdparty / ExternalMedia

The ExternalMedia library provides a framework for interfacing external codes computing fluid properties to Modelica.Media-compatible component models.
53 stars 36 forks source link

Call ExternalMedia from OMPython #104

Open freddyUC opened 8 months ago

freddyUC commented 8 months ago

I've tried to call ExternalMedia library from OMPython with the next commands

` _from OMPython import OMCSessionZMQ from OMPython import ModelicaSystem

omc = OMCSessionZMQ()

lib1 = "~LocalPath/ExternalMedia/package.mo" model_sim = 'ExternalMedia.Test.CoolProp.CO2.TestStatesSupercritical' mod=ModelicaSystem(lib1,model_sim, [])

mod.simulate()_ ` And I get the next message

The code execution cannot proceed because ExternalMediaLib.dll was not found. Reinstalling the program may fix this problem

I found the .dll files located in ~\ExternalMedia\Resources\Library\win64 , so I'm not sure what is the problem when loading the library.

My softwares: Windows 11 Python 3.11 OMPython 3.4.0 OpenModelica v1.22.1

I've loaded other external libraries without any problem.

Hope you can help me!

ibeyers commented 5 months ago

What worked for me is to copy the ExternalMediaLib.dll into the directory where my python scripts are located (which is then also my working directory).