ecms_neu_mini.png

Digital Library

of the European Council for Modelling and Simulation

 

Title:

Enabling Python Driven Co-Simulation Models With PythonFMU

Authors:

Lars Ivar Hatledal, Houxiang Zhang, Frederic Collonval

Published in:

 

 

2020). ECMS 2020 Proceedings Edited by: Mike Steglich, Christian Muller, Gaby Neumann, Mathias Walther, European Council for Modeling and Simulation.

 

DOI: http://doi.org/10.7148/2020

ISSN: 2522-2422 (ONLINE)

ISSN: 2522-2414 (PRINT)

ISSN: 2522-2430 (CD-ROM)

 

ISBN: 978-3-937436-68-5
ISBN: 978-3-937436-69-2(CD)

 

Communications of the ECMS , Volume 34, Issue 1, June 2020,

United Kingdom

 

Citation format:

Lars Ivar Hatledal, Houxiang Zhang, Frederic Collonval (2020). Enabling Python Driven Co-Simulation Models With PythonFMU, ECMS 2020 Proceedings Edited By: Mike Steglich, Christian Mueller, Gaby Neumann, Mathias Walther European Council for Modeling and Simulation. doi: 10.7148/2020-0235

DOI:

https://doi.org/10.7148/2020-0235

Abstract:

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.

 

Full text: