3

I am in need of Bessel functions in Modelica along with a host of possible functions in the future that already exist in external C/Fortran/Python/etc libraries.

I know there is some sort of ability to call external functions as that is how LAPACK is used in the Modelica Standard Library.

My question:

Before I spend time trying to figure out the magic of external functions I wanted to know if anyone was aware of efforts that have already integrated something like the GNU ScientificLibrary or Python SciPy and could point me in their direction.

Thanks

Scott G
  • 2,194
  • 1
  • 14
  • 24
  • related: http://stackoverflow.com/questions/7836769/modelica-external-functions-c-versus-c99 – matth Aug 19 '16 at 08:35
  • Those are the library functions built into VS. While that is really nice they are still fairly limited and I'm wanting to know if anyone is aware if someone has already done the modelica side of implementing GSL or scipy to avoid repetition and save lots and lots of time. If it doesn't there should be a community effort (or mine :p) to add this to MSL or a standalone library. – Scott G Aug 19 '16 at 15:09
  • You can access Fortran or C libraries only. If you want to access Python code, you would have to write a C wrapper first. I do not know of publicly available wrappers for the well-known libraries such as GSL, Netlib, Boost and so on. – matth Sep 02 '16 at 13:36
  • @matth. Thanks for your feedback. Yeah I knew only Fortan and C are directly supported. I found an example of a C wrapper somewhere online. I figure it would probably make more sense to go straight to the GSL. I'm fairly unfamiliar with C and browsing the GSL source code to figure out how to call it from Modelica is fairly intimidating due to all the inter-linkage. From my perspective though it seems the Modelica association could devote some resources to develop that work. If people pick up Modelica and can't do 90% of what they could in Python/C it'd likely be a show stopper for adoption. – Scott G Sep 03 '16 at 01:24
  • Is this code helpful? https://github.com/RexFuzzle/qss-solver/blob/master/testsuite/ModeloCompletoFinalEscalado/ModeloCompletoFinalEscalado.mo – matth Jan 06 '17 at 09:10
  • Are you actively working on a Modelica GSL wrapper? Will it be open-source? Are you interested in contributions? – matth Jan 06 '17 at 09:11
  • I do have interest in a GSL wrapper. I recently posted these two questions (https://stackoverflow.com/questions/41166086/external-functions-reference-headers-in-c-script-to-compiled-dll https://stackoverflow.com/questions/41187064/external-functions-alternative-method-to-use-dll-from-a-c-script ) as I delve into the land of external functions and c-code (in which I am a novice). It will be open source and would love contributions. I have my library on [github](https://github.com/greenwoodms06/Modelica-GNU_ScientificLibrary). – Scott G Jan 06 '17 at 14:56

1 Answers1

0

Which Modelica Tool are you using?

It is possible to interface Dymola with Python as described here: http://www.claytex.com/blog/interfacing-dymola-with-python/

However this does not allow you to use Python functions in Dymola but rather provides a way to create Python scripts that interface with Dymola.

user2024223
  • 475
  • 2
  • 10
  • It's not interfacing in Python that is desired but rather the ability to use verified and validated functions libraries like GSL or scipy. Just wanting to know if anyone is aware if someone has already done the modelica side of this to avoid repetition and save lots and lots of time. – Scott G Aug 19 '16 at 15:08