Support of CasADi's FMI interface

Hi,

in CasADi there is an interface to import FMUs according to the FMI standard 2.0 (for model exchange), especially by the DaeBuilder class. Is it possible to use the FMI interface also in Acados, e.g. for an optimal control problem for which the system dynamics (ODE form) is provided in an FMU? If yes, is there an example available?

Thanks.

Hi,

in acados, we use CasADi to nonlinear functions together with their derivatives as C code.
Thus, this topic ultimately boils down to the question, if one can generate code from DaeBuilder with FMUs inside.
I don’t have experience with this myself, looking at [1], it seems there are 3 ways to do this.
It sounds you specifically have this option in mind

  • One can use the class to import existing models available in the FMI format. As of CasADi 3.6, we support import of standard FMUs, where the model equations are available only by calls to DLLs. The FMU import support has been tested for challenging FMUs, but is still under development as of this writing.

It is probably not possible to generate code for this, since it is just calls a DLL internally.

This option in turn sounds like it is internally a CasADi graph and could be code generated:

  • One can use the class to step-by-step construct a structured system of differential-algebraic equations (DAE), which can then be used to interface to simulation or optimization in CasADi. There is also experimental support for exporting the models in the FMI format for use in other tools.

Alternatively, one could use the external function interface, see e.g. here Possibility of using external jacobian/hessian function for model and constraint? - #3 by HARPERX

Best,
Jonathan

[1] CasADi - Docs

Hi,

thanks for your hints. Yes, my main focus was on the first CasADi feature you listed, because it is the only one for the import of given FMUs.

So, it seems there is no straightforward way to import FMUs in Acados.

Best regards.