FMI Interface

Introduction

The FMI Interface is only available in Game4Automation Professional

The Functional Mock-up Interface (FMI) is a free standard that defines a container and an interface to exchange dynamic models using a combination of XML files, binaries and C code zipped into a single file. It is supported by 150+ tools and maintained as a Modelica Association Project on GitHub. The code is released under the 2-Clause BSD, the docs under the CC-BY-SA License. (Source https://fmi-standard.org).

Based on the FMI interface you can connect integrate very detailed simulation models which have been developed for special domains with tools like Mathlab, Modelica, Amesim, Dymola and others into your Unity - Game4Automation solution.

This FMI interface is implemented based on the Unity-FMI-Addon by CATIA Systems which is licensed based on the BSD 3-Clause License. For more information see here https://github.com/CATIA-Systems/Unity-FMI-Addon.

We implemented this interface for and during the ITEA Project AITOC (https://itea3.org/project/aitoc.html)

FMU / FMI Background

The FMI interface is a standard interface to so called FMUs (Functional Mock-up Units). FMUs are compiled C code in the form of DLLs which can be created by a lot of tools. An FMU can be everything which is having different Signals like Parameters, Input and Outputs. The detailled behaviour of a Pneumatic Cylinder or an Electrical drive can be for example an FMU. But an FMU could be also a very large Simulation model of a whole machine for example.

In Game4Automation FMUs are called each Physics cycle. First the Inputs of the FMU are set by the Game4Automation PLCInputs and then the FMU is called to calculate the next step in the size of the Physical timestep (Time.fixedDeltaTime). After this all FMU Output signals are transfered to the Game4Automation PLCOutputs.

Each FMU is handled as one FMUInterface. This means, that you need to define as much interfaces as the number of FMUs you want to use in your model.

Import and Usage of FMUs

FMUs are distributed as *.fmu files. This is a ZIP file with the needed DLL and additional information about the parameters, inputs and outputs included.

To use an FMU in Game4Automation you need first to add an FMU interface to your scene:



After this you can select the FMU path and load the FMU into your project by selecting the button Import FMU & create signals.



Now the FMU is imported into your project and all signals of the FMU are created as PLCInputs or PLCOutputs:



During the FMU import the ZIP-File is opened and the included FMU data is placed to Assets/StreamingAssets/FMU/[FMUName]. This assures, that the DLL is included in your project and can be delivered with your Game4Automation build. Additionally a ScriptableObject including the needed parts of the model description is created under Assets/game4automation/private/Interfaces/FMI/Resources. This scriptable object is referenced by the FMU interface.

If you don’t need all the imported signals you can delete them. They are only recreated upon a new import of the FMU. You can now use the FMU as all other interfaces for example by connecting the FMU outputs or inputs to Game4Automation behavior models like drives and sensors.


© 2019 in2Sight GmbH https://game4automation.com - All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including printing, saving, photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher.