Opened 8 years ago

Closed 4 years ago

#4273 closed enhancement (fixed)

FMU for co-simulation , Available Solvers

Reported by: Robert Hällqvist Owned by: Andreas Heuermann
Priority: blocker Milestone: 1.16.0
Component: FMI Version: v1.12.0
Keywords: Solvers, CVODE, FMU export Cc: Adrian Pop, Adeel Asghar, Niklas Worschech, Karim Adbdelhak

Description

As far as I understand, Euler forward is the only solver currently available when exporting FMUs for co-simulation from OpenModelica. Many of my models do not simulate with this solver. It would be very beneficial if an FMU for co-simulation could be exported with any of the solvers available for simulation in OpenModelica, that way each FMU could utilize the solver kept in mind when developing the model.
Also, having the sundials solver CVODE available both for simulation in OpenModelica as well as for FMU-CS export would be very beneficial. This particular solver is available in Dymola. If it is made available in OpenModelica, then the user will be free to simulate and export Dymola models using CVODE in/from OpenModelica.

Change History (10)

comment:1 by anonymous, 7 years ago

Indeed it would be super to be able to do that. Perhaps this could be contributed to OpenModelica FMU Exporter. Any advice on how to proceed?

comment:2 by anonymous, 6 years ago

Component: *unknown*FMI
Owner: changed from somebody to Lennart Ochel
Version: v1.12.0

+1

comment:3 by tknodt@…, 6 years ago

What is the cause of this limitation to Euler? Is there any documentation about that?
Thanks, Torsten

comment:4 by Francesco Casella, 6 years ago

Cc: Willi Braun Niklas Worschech added

I guess it is only lack of development resources.

Niklas Worschech @niklwors and Willi Braun @wbraun are working on a long-term plan to unify the C runtime, C++ runtime and FMU runtime, they may comment on this topic.

in reply to:  4 comment:5 by Niklas Worschech, 6 years ago

Replying to casella:

I guess it is only lack of development resources.

Niklas Worschech @niklwors and Willi Braun @wbraun are working on a long-term plan to unify the C runtime, C++ runtime and FMU runtime, they may comment on this topic.

At the moment we are working on to support FMI 2.0 ME in the new OMSI runtimes. But it is also planted to support FMI 2.0 CS later. Then we will also support the sundials ODE solvers.

comment:6 by Lennart Ochel, 5 years ago

Milestone: Future1.16.0
Status: newaccepted

We are planing to include CVODE for co-simulation fmus in OpenModelica v1.16.0.

comment:7 by Andreas Heuermann, 5 years ago

Owner: changed from Lennart Ochel to Andreas Heuermann
Status: acceptedassigned

comment:8 by Andreas Heuermann, 4 years ago

Cc: Karim Adbdelhak added; Willi Braun removed

Added CVODE to C runtime (see #5830) and started improving robustness (see #5997).

Started compiling CVODE into FMUs (C target code, FMI 2.0 for CoSimulation) and to use as much as possible of the C-runtime implementation from cvode_solver.c.

To switch between different solvers in a FMU we added an optional JSON file with simulation flags:

<fmu_prefix>.fmu/resources/<fmu_prefix>_flags.json:

{
  "s" : "cvode",
  "nls" : "homotopy"
}

See PR#897 for the current status of flags in FMUs and CVODE inside an CS FMU.

At the moment first examples are compiling with CVODE, allocating and freeing CVODE data works as well.
Next the fmi2DoStep function gets an upgrade to do an integration step with CVODE.

Last edited 4 years ago by Andreas Heuermann (previous) (diff)

comment:9 by Andreas Heuermann, 4 years ago

Simple dynamic linked FMUs with SUNDIALS/CVODE are working fine on Linux.
Models with events not tested yet. CVODE is not allowed to stop on an event in that case, because the CS Simulator will handle events.

Static linked FMUs are a remaining problem and I'm working on it right now.
When those are fixed FMUs with CVODE on Windows should be possible as well.

Remaining problems:

  • Compile FMU with static linking.
  • CVODE needs to disable root function finding on FMI target.
  • CVODE stuff doesn't use correct logging with fmi2CallbackFunctions->logger.
  • CVODE stuff doesn't use fmi2CallbackFunctions->allocateMemory and fmi2CallbackFunctions->freeMemory.

comment:10 by Andreas Heuermann, 4 years ago

Resolution: fixed
Status: assignedclosed

Added CVODE to FMU CS export with commit 1014b60.
Dokumentation and improvements are coming with PR #949.

Note: See TracTickets for help on using tickets.