JorgeLLH / Resairchia-External-C-Functions-Library-for-Modelica

Collection of examples related to the use of C code in Modelica developed by Jorge L. L. and Resairchia
GNU General Public License v3.0
0 stars 0 forks source link

How to use External C functions to call Python functions in Modelica #1

Open Balbu3 opened 7 months ago

Balbu3 commented 7 months ago

Hello Jorge, I watched your video on External C functions and it really helped me understand how to make them work.

I am now interested in making python functions work in Openmodelica models. My main objective is to be able to use the CoolProp python library inside modelica models for an easier way of obtaining the thermophysical properties of less usual substances.

I guess the way to do it is to run python from C and then call the C code as in the way you showed. I do not have very good knowledge of how to make this work since I am not a computer programer. Can OMCompiler run this? Do I have to modify it in someway so it is able to run the python code?

Any insight into this would be very helpful. Thank you in advance.

JorgeLLH commented 4 months ago

Hi @Balbu3 , sorry for the late reply. I had several personal issues and I have not been able to keep an eye on the different notifications. I will come back to you with a proper answer soon! My apologies! :)

JorgeLLH commented 4 months ago

Hi again @Balbu3 What you are asking is something I have in my TODO list for videos. I will try to make one. In the meantime, try the following:

https://github.com/adrpo/OMCallPython

I hope it helps! Let me know how it goes please :)