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