Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Usage of dassl in FMU export

Usage of dassl in FMU export

Hello,
I'm using OpenModelica to simulate energysystems. Currently I use the "translateFMU" function to export Modelica models into FMUs. The FMU standard allows to integrate the sovler for the equation system. Currently OpenModelica only provides the possibility to export the CVode solver. It would be usefull to export other powerfull solvers like "dassl". Is this possible?

Best regards,
Lukas Koenemann

Re: Usage of dassl in FMU export

Hey Lukas,

Currently there are two solvers available in CS-FMUS: Explicit Euler (default) and Sundials CVODE.

It would be possible to add more solvers to CS-FMUs. But what would be the benefit of Dassl / IDA(same algorithm, newer implementation) over CVODE?

It is a lot of work to add external solvers to FMUs because we want to support source-code FMUs as well and therefore need to add parts of our "normal" runtime to the FMU runtime and create new solver routines because our integrator works differently then a FMU simulator.

Re: Usage of dassl in FMU export

Thank you for the fast response!

If I understand it right, CVODE is just a solver for stiff and nonstiff ordinary differential equation (ODE) systems. Dassl is also a solver for implicit systems of differential equations. I'm not an expert in solvers for differential equations, but in my understanding and experience "Dassl" is much more stable, robuste and have a better performance for different kind of DAE. Thats why it would be useful to export the models also with this solver.

I'm using the FMUs to simulate the models in python (via pyfmi). I coupled the pyfmi interface for FMUs with an artificial intellegence tool which calls the simulation very often and therefore it would be highly usefull to have robuste solvers integrated.

Best regards,
Lukas

Re: Usage of dassl in FMU export

Well that is correct, with DASSL/ IDA you can use the so called DAE mode. So it is possible to solve an differential-algebraic equation with index 1 instead of an ODE system.
In OpenModelica this is not the default behavior, but can be achieved that by using the compiler flag `--daeMode`. The simulation executables (generated equations) and the solver are different in DAE-mode. So adding those to FMUs would be an additional step.

I'm not sure if the FMI standard (2.0.3) allows DAEs at all. At least for model exchanges it is not:


The FMI for Model Exchange is for ordinary differential equations (ODEs) in state space form. It is
not for a general differential-algebraic equation system

Both DASSL/IDA and CVODE are variable-order, variable-coefficient BDF methods (for non-stiff systems CVODE can actually use a  Adams-Moulton formula).
I think for non-stiff problems CVODE could be the better approach and because of that CVODE is the default for our C++ runtime.

So there could be use cases where one method outperforms the other, but I don't think you say that one is better then the other in general. Searching for some publication could give some answer to that question.

But as I said, the work to implement IDA with daeMode into FMUs would be quiet high because the OpenModelica compiler needs to be changed in multiple places and we don't event support CVODE FMUs at 100%.

If all you need is execution speed and some specific solver for robustness I would ditch FMUs completely and use OpenModelica scripting, e.g. mos-scripts, OMPython or OMJulia. Then you have the more sophisticated runtimes, no FMI-overhead and it get's way way easier to debug.

There are 0 guests and 0 other users also viewing this topic
You are here: