Python and .NET adapters for HLA-based co-simulations of CPS
BASTIAN CORNELSEN and DENNIS WELLER
Research Summary:
Co-simulations are widely accepted as key tools for evaluating cyber-physical systems (CPSs). It requires integrating a variety of heterogeneous simulations from many different system domains such that they can exchange data and be executed in a time-synchronized manner. These heterogeneous simulations may use different modeling languages and can have many different execution semantics such as discrete time, continuous time, and finite-state machines. The IEEE High-Level Architecture (HLA) standard is designed specifically for creating large-scale interoperable distributed simulations and provides several mechanisms and a high degree of flexibility for executing simulations. Portico software is an open-source implementation (a.k.a. Run-Time Infrastructure (RTI)) of the HLA standard. The CPS Wind Tunnel (CPSWT) framework developed at ISIS is a high-level model-based integration framework that automatically generates HLA-adapters from top-level system-of-system (SoS) models depending on which types of simulation tools are used. The Portico RTI (written in Java) currently provides APIs for the Java and C++ languages.
Another co-simulation tool developed at University of Oldenburg is called MOSAIK, which is mainly targeted toward smart-grid co-simulations. Mosaik is written in Python and has a centralized discrete-event simulation core. It provides a very lightweight API for connecting various simulations through a very small set of core functions that control simulation’s time-progression and allows exchange of data at pre-defined time-steps. The lightweight approach of Mosaik can be useful for use-cases where complex timed behavior is not very critical. In addition, part of the SoS can be co-simulated in Mosaik, while the rest is co-simulated using the CPSWT framework. However, to integrate Mosaik co-simulation as an HLA simulation, we need to first extend the Portico RTI to create a Python API.
In this lecture, we present our work on developing methods for HLA adapters for Portico RTI using the Python and C# languages:
- The approach to create a Python wrapper with Py4J, which creates a bridge to Java, proved to be promising and the implementation already advanced to prototype status. Consequently, an integration of the MOSAIK framework as an HLA compatible simulation is within reach.
- A connection to the .NET framework on Linux turned out to be more intricate. Since HLA supports C++ federates, connecting these to .NET seemed obvious, yet problematic, and various ideas had to be dismissed. Therefore, we decided to switch the target platform to Windows which enabled more promising solutions. One of those is a direct connection between Java and .NET via jni4net.
About Bastian Cornelsen and Dennis Weller: They are computer science students at the Carl von Ossietzky-University of Oldenburg (Germany) and are interning at the ISIS as part of an international exchange program for eight weeks. They are both student assistants at the OFFIS (Computer Science Research Institute) in Oldenburg, where the MOSAIK framework has been developed.