This paper introduces PythonFMU, an easy to use framework for exporting Python 3.x code as cosimulation compatible models compliant with version 2.0 of the Functional Mock-up Interface (FMI). The framework consists of a set of helper classes and a command line utility for transforming compliant python source into ready to use cross-platform FMUs. PythonFMU seamlessly takes care of a number of lowlevel FMI functions such as getting and setting variable values, and state handling, including serialization and deserialization. Furthermore it provides pre-built binaries for Windows and Linux 64-bits, generates the required modelDescription.xml containing meta-data about the model and packages all related files into a Functional Mock-up Unit (FMU) ready to be imported into any FMI compatible simulation tool. The framework can be effortlessly installed using de-facto standard Python package managers pip and conda. While PythonFMU is more geared towards ease of use and enabling Python driven co-simulation models, it is shown to have adequate performance compared to much more low-level alternatives targeting other programming languages.
[1]
Stéphane Vialle,et al.
Toward an accurate and fast hybrid multi-simulation with the FMI-CS standard
,
2016,
2016 IEEE 21st International Conference on Emerging Technologies and Factory Automation (ETFA).
[2]
Andreas Junghanns,et al.
Functional Mockup Interface 2.0: The Standard for Tool independent Exchange of Simulation Models
,
2012
.
[3]
Eilif Pedersen,et al.
Virtual Prototyping of Maritime Systems and Operations
,
2016
.
[4]
Geir Hovland,et al.
FMI 4 j : A Software Package for working with Functional Mock-up Units on the Java Virtual Machine
,
2018
.
[5]
Travis E. Oliphant,et al.
Python for Scientific Computing
,
2007,
Computing in Science & Engineering.