2024-07-11 –, Method (1.5)
The Functional Mock-Up Interface is a tool-independent standard for implementing and describing models given by differential algebraic equations with events. FMIExchange.jl integrates such models with DifferentialEquations.jl, thereby retaining the full capabilities of that package. The resulting functionality forms a powerful extension to that of the existing FMI.jl package, allowing the user to simulate complex systems with multiple native and FMI-compliant components.
The Functional Mock-Up Interface (FMI) standard allows to exchange models between different software programs. To simulate FMI-compliant models (functional mock-up units, FMUs), Julia currently relies on the FMI.jl package and its subpackages, but these packages do not cover all use cases: FMI.jl does not allow to simulate multiple FMUs simultaneously, nor to cosimulate FMUs and native Julia differential equations. FMI.jl implements basic input/output functionality to interact with FMUs, but the interface is difficult to use when FMU inputs change at different timescales. More advanced functionality requires directly interacting with FMU objects, which is not user-friendly. FMIExchange.jl aims to solve these issues by leveraging the well-known interface of DifferentialEquations.jl and combining it with the functionality of the existing FMI simulation suite.
FMIExchange.jl wraps FMUs in structs such that they can be used in a traditional differential equation (DE) solver as implemented in the SciML ecosystem. FMIExchange.jl automatically generates appropriate callbacks to detect and trigger events in the FMU, and mimics the traditional DifferentialEquations.jl interface for obtaining derivatives. FMU inputs and outputs are handled by using the parameter argument "p" as a memory buffer to store them. Manipulating this buffer using the callback library provided by the SciML ecosystem provides many ways to interact with the simulation. Typical examples are implementing digital controllers or defining interactions between different models.
It is possible to combine multiple FMUs and native Julia DEs in one simulation by subdividing the memory buffer into sections. To simplify this process, FMIExchange.jl provides tools to automatically assign and keep track of addresses and to perform common operations such as connecting model inputs and outputs. All this functionality is available for both native DEs and FMUs, such that the user can interact with all simulation components in an implementation-agnostic way.
The presentation will briefly introduce the FMI standard and then discuss the design of FMIExchange.jl. The package will be demonstrated on a case study involving model-predictive control of multiple flexible electrical loads in a residential building. The case study combines multiple FMUs and native ODEs in a single simulation, showing FMIExchange.jl in action in a realistic context.
Lucas Bex obtained his Bachelor's in electrical engineering (2020) and Master's in energy engineering (2022) from KU Leuven. He is currently pursuing a PhD in Electrical engineering at Electa - ESAT KU Leuven. His research interests are demand response, energy systems modelling, and advanced control methods for electrical power systems.