FMU-proxy is a framework for working with Functional Mock-up Units (FMUs) across languages and platforms. This is done by wrapping a set of FMUs inside a server program. Using common and language independent Remote Procedure Call (RPC) frameworks, like Apache Avro, Apache Thrift, gRPC and JSON-RPC over a range of network protocols, the FMU functions are effectively made available from pretty much any language on any platform.

Both Co-simulation and Model Exchange FMUs are supported, with the latter being wrapped as a Co-simulation FMU.

Server implementations exists in C++ and for the JVM. The C++ implementation is cross platform and builds just as easy on both platforms thanks to vcpkg and CMake.
For handling the FMUs, the C++ version relies on FMI Library, while the JVM version uses FMI4j.

Clients exists for C++, Python, JavaScript and for the JVM. Clients in other languages can easily be implemented as most of the code will be auto generated by your chosen RPC framework using the available schemas.
On the JVM, FMU-proxy shares the same interface as FMI4j – making local and remote execution of FMUs almost indistinguishable from one another.

Only FMI 2.0 and onward are planned to be supported.

7 thoughts on “FMU-proxy

  1. Thanks for good new stuff. Unfortunately due to no previous experience with server/client type program implementation, I get disoriented when I try to make a first small step forward. Any easy dummies tutorial for step-by-step setup?

    1. Thank you for your interest in FMU-proxy. May I ask what you want to use it for? Perhaps most importantly which client and server language you want to use.
      Unfortunately FMU-proxy should still be considered work-in-progress, so getting it up and running can be daunting.

      For the JVM server implementation, you have to build the executable using the bundled grade wrapper (./gradlew installDist in the java/FMU-proxy directory)
      For the JVM clients, you have to build them from source. I will eventually make them available through maven central.

      Python clients have to copy the source code in the python directories. I do not have the knowledge to distribute these as a library (pip install).

      The C++ implementation will soon be updated, an I plan to make both the server and clients available through vcpkg. (./vcpkg install fmu-proxy)

      Looking forward to your reply.

      1. Actually, for the JVM server it is better to run ./gradlew shadowJar. Then you get a standalone executable .jar located under fmu-proxy\build\libs.

        1. Thanks. Firstly I am not a software engineer. I am a modeler and just start to touch FMU in general.

          Normally I get used to open source softwares. e.g., I found using openmodelica is good for generally export a FMU without involving any commercial ones. But I did not find very good way to simply wrapping FMU for presentation case, i.e. focusing on “What” is available in FMU outcome and the straightforward user interface with selected interactions as a standalone. Discussing “How” the FMU is made is interesting but distracting as I may get endless irrelevant comments all the time on the physics I knew well or the software issues I did not know well.

          It is frustrating to check different obsolete or discontinued Wrapping methods, for example, a web interface using Javascript wrapping for openmodelica remains buggy as it was several years ago.

          I think I roughly understand the server/client idea behind FMU proxy. The vision may be a central server for FMU library and app-like interfacing. Quite cool šŸ™‚ but then I get lost in Software Engineering implementations. šŸ™

          1. I see. It’s my understanding that you are looking for a tool where you can import, connect and simulate different FMUs?
            Whereas FMU-proxy is a low-level API/tool for software engineers enabling distributed access to FMUs with little effort in basically any language on any platform.
            Or if you just need to simulate an FMU locally, you can use a library for that purpose in a given language. E.g. FMI Library for C/C++, FMI4cpp for C++, FMI4j for Java, FMPY for Python.

  2. Thanks.

    I have another question, if a particular user who is obsessed with matlab/simulink or other certain high-level language/environment, How will you interpret your distributed access vision into such framework? Is it straightforward to align with certain web access function in Matlab/simulink or the overhead is too heavy to be worthwhile?

    1. I don’t know about Simulink, but since Matlab can run Java libraries out of the box, one could simply use one of the available JVM clients. I don’t know what the overhead of this would be (compared to a pure JVM stack). Another approach would be to use HTTP or TCP/IP in conjunction with JSON-RPC. You can code this directly in Matlab. I know it is possible as I have done it before, but it would require some work to wrap it into a user friendly API. Probably the JVM client approach using grpc/thift over tcp/ip would be better.

Leave a Reply to Yaohui Chen Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.