Hybrid Simulation Models for Embedded Applications: A Modelica and eFMI approach

Tobias Kamp, Christoff Bürger, Johannes Rein, Jonathan Brembeck · Linköping electronic conference proceedings · 2025

Hybrid simulation models combine physics equations withtrainable components to improve simulation results andperformance. Physics-enhanced neural ordinary differentialequations (PeN-ODE) are a promising type of hybrid modelsthat combine artificial neural networks (NN) with thedifferential equations of a dynamic system. Dynamicalsimulation models are often part of embedded controlalgorithms of cyber-physical systems (CPS); compliance withthe safety and real-time requirements of such embeddedenvironments is, however, challenging.In this work, we propose a workflow to incorporate trainedNNs in Modelica models to form hybrid simulation modelsthat are PeN-ODEs. We thereby focus on the transformationsteps from equation-based trained PeN-ODEs in Modelicatowards causal solutions suited for the embedded domain --up to and including MISRA C:2023 compliance checks andfinal software-in-the-loop (SiL) tests of generatedproduction code in the modeling environment -- for which weleverage eFMI standard compliant tools (Dymola and SoftwareProduction Engineering). It is of particular interest, howthe trained NNs of the hybrid model are implemented. Wepresent two approaches: (1) generation of C code usingexisting Open Neural Network Exchange (ONNX) tooling and(2) pure Modelica code with the tensor-flow represented asmulti-dimensional equations. Both approaches are discussed,highlighting why (2) is, in the long run, a better optiongiven the eFMI technology space.

Read the paper · More papers on PaperTik