Opened 7 years ago

Closed 4 years ago

#4273 closed enhancement (fixed)

FMU for co-simulation , Available Solvers

Reported by: robha67 Owned by: AnHeuermann
Priority: blocker Milestone: 1.16.0
Component: FMI Version: v1.12.0
Keywords: Solvers, CVODE, FMU export Cc: adrpo, adeas31, niklwors, Karim.Abdelhak

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 Changed 6 years ago by anonymous

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 Changed 6 years ago by anonymous

  • Component changed from *unknown* to FMI
  • Owner changed from somebody to lochel
  • Version set to v1.12.0

+1

comment:3 Changed 6 years ago by tknodt@…

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

comment:4 follow-up: Changed 6 years ago by casella

  • Cc wbraun niklwors 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.

comment:5 in reply to: ↑ 4 Changed 6 years ago by niklwors

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 Changed 4 years ago by lochel

  • Milestone changed from Future to 1.16.0
  • Status changed from new to accepted

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

comment:7 Changed 4 years ago by AnHeuermann

  • Owner changed from lochel to AnHeuermann
  • Status changed from accepted to assigned

comment:8 Changed 4 years ago by AnHeuermann

  • Cc Karim.Abdelhak added; wbraun 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 AnHeuermann (previous) (diff)

comment:9 Changed 4 years ago by AnHeuermann

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 Changed 4 years ago by AnHeuermann

  • Resolution set to fixed
  • Status changed from assigned to closed

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.