/FMU-proxy

Tool that allows Functional Mock-up Units (FMUs) to be accessed through language independent RPC calls by wrapping the original FMU into a new one with network capabilities.

Primary LanguageKotlinMIT LicenseMIT

FMU-proxy (work in progress)

License: MIT contributions welcome

Join the chat at https://gitter.im/NTNU-IHB/FMU-proxy CI

The main goal of the Functional Mock-up Interface (FMI) standard is to allow simulation models to be shared across tools. To accomplish this, FMI relies on a combination of XML-files and compiled C-code packaged in a zip archive. This archive is called a Functional Mock-up Unit (FMU) and uses the extension .fmu. In theory, an FMU can support multiple platforms, however this is not always the case and depends on the type of binaries the exporting tool was able to provide. Furthermore, a library providing FMI support may not be available in a particular language or platform, and/or it may not support the whole standard. Another issue is related to the protection of Intellectual Property (IP). While an FMU is free to only provide the C-code in its binary form, other resources shipped with the FMU may be unprotected.

In order to overcome these challenges, we present an open-source framework for working with FMUs across languages and platforms.

FMU-proxy is different from other frameworks for distributed FMU invocations such as DACCOSIM, FMI GO! and Coral in that it completely separates itself from the master algorithm (logically and physically). FMU-proxy is a completely standalone project, which provides access to FMUs over the wire. And just that.

The idea is that other applications should use FMU-proxy whenever FMUs are required to run distributed, rather than having each application creating their own solution.


fmu-proxify

fmu-proxify is a CLI that transforms a co-simulation FMU compatible with either version FMI 1.0 or 2.0 into a proxified version of the same FMU. Internally, the proxy FMU wraps the original FMU in a server program. Each new instance of the original FMU runs in a separate process.

This allows you to:

  • Import FMI 1.0 models in software that otherwise only supports FMI 2.0.
  • Instantiate multiple instances of FMUs that only allows one instance per process.
  • The ability to run the FMU on some remote resource
    • Which in turn allows FMUs to run on otherwise unsupported platforms.
Usage: fmu-proxify [-h] [-d=<destFile>] [-r=<remoteAddress>] FMU-FILE
      FMU-FILE            Path to the FMU to proxify.
  -d, --dest=<destFile>   Where to save the FMU (defaults to current folder).
  -h, --help              Print this message and quits.
  -r, --remote=<remoteAddress>
                          Optional host to connect to. e.g. 127.0.0.1:9090

By default, the generated FMU seemingly behaves like a regular FMU. However, internally the FMU is communicating with the original FMU over TCP/IP. When targeting localhost, this all happens automatically.

To install the necessary tools, run ./gradlew build. The CLI tool is then located under fmu-proxify/build/install
Likewise, the booter executable needed to spawn processes on a different computer when not targeting localhost is located under fmu-proxy-booter/build/install

Running the FMU on another computer

  1. The target computer needs to start fmu-proxy-booter
    ./fmu-proxy-booter <port>

  2. Generate the FMU with the option --remote <hostname:port>
    (or modify proxySettings.txt inside an existing FMU)

  3. Load the FMU as usual.

Environment setup

FMU-proxy relies on Java and thus requires a suitable environment to run.

Windows
  1. JAVA_HOME should point to a JDK8+ installation.
  2. %JAVA_HOME%\jre\bin\server must be added to PATH.
Linux

On linux things should just work after installing the JDK.

Publications


Want to import FMUs in C++? Check out FMI4cpp
Want to develop or import FMUs in Java? Check out FMI4j
Want to develop FMUs in Python? Check out PythonFMU
Need a complete co-simulation framework with SSP support? Check out Vico