2

Do you know if there is a C library to handle FMU and run simulations including a good solver?

As far as I know there are:

  • FMUSDK from QTronic
  • FMI Library from Modelon

Both can open FMUs, but only let running FMU for co-simulation with a simple Euler solver.

Libraries including a good solver handling discontinuities, but not in C, are:

  • PyFMI from Modelon: For Python
  • JFMY from Ptolemy: For Java (not sure if this includes a good solver)
jrhodin
  • 659
  • 5
  • 14
Koldo
  • 43
  • 1
  • 6

2 Answers2

4

I don't think the FMUSDK is really maintained, so the FMI Library is probably the better choice between those two.

To improve the solver, you'd probably have to pair the FMI Library with a solver like Sundials and figure out how to stitch those two together. Note, this is exactly what Modelon has done with the PyFMI library. While it is a Python library, I suspect you could probably find a relatively easy way to integrate into a non-Python project as long as you were able to use C code to integrate them (which apparently you are).

I suspect calling PyFMI from C is going to be easier than stitching FMIL together with Sundials on your own.

Michael Tiller
  • 9,291
  • 3
  • 26
  • 41
  • Thank you Michael. I agree. Redoing PyFMI in C/C++ would e a project by itself.A little of the record: How can be called Python from C? – Koldo Jun 22 '13 at 06:19
  • Hi Michael. About question "How to do co-simulation with two FMU models", the models are for model exchange and for co-simulation, because two are Modelica based and the third one is a CFD simulation. – Koldo Jun 25 '13 at 06:32
0

see also

  • I have experience with FMI4cpp and it is easy to install and use. Claytex provide a training course on how to use this https://www.claytex.com/services/training/. – user2024223 Jun 23 '23 at 14:40