- The UEFMI plugin allows for the use of dynamic simulation models via Functional Mockup Units (FMUs) directly in an Unreal Engine project.
- An FMU is code that has been packaged according to the Functional Mockup Interface, a free and open-source standard for exchanging dynamic (i.e., time-dependent) simulation models.
- Common examples of models that get packaged into FMUs are:
- Physics based vehicle simulators (e.g., drive train, HVAC, water vehicles, etc.)
- Energy systems (e.g., power plants, buildings)
- Space systems (e.g., solar sail mechanics, propulsion systems)
- And many many more...
This work was tested using the following. It may work on something else but no guarantees.
- Windows 10
- Unreal Engine 5.1+
- Visual Studio 2022
- An unzip utility on path, currently supported are unzip, 7z, tar
A_FMU under UEFMI C++ Classes/UEFMI/Public contains the magic to make the FMU run. Users are highly encouraged to look at A_FMU.cpp if they need to understand more intimately the implementation. A couple important notes are:
PathFMUis the location of the FMU and supports relative or absolute paths.mResultsreturns the results requested from the variables added tomStoredVariables.mResultsonly returns values whenmAutoSimulateTick= True. Else it is empty and variables must be be retrieved using theGetReal()function.
mModelVariablesare the names of all availble variables found in the model which could be added tomStoredVariables.
As a plugin, UEFMI is intended to be used inside an existing Unreal Engine project!
The process below will go through the steps to adding the plugin to a new Unreal Engine project.
-
Create an Unreal Engine project. Fror illustration purposes let's call it
MYPROJECT.- Go to the project
MYPROJECTfolder and create aPluginsfolder if it doesn't exist.
cd MYPROJECT mkdir Plugins - Go to the project
-
Clone the repository and submodules. To do that, in the ``MYPROJECT/Plugins` folder:
cd Plugins git clone https://github.com/ORNL-Modelica/UnrealEngine-FMIPlugin.git UEFMI cd UEFMI git submodule init git submodule update- Note:
git submodule update --remoteto grab the latest commits instead of specific commit
- Note:
-
Copy the files from the submodule to the
UEFMIplugin source folder (choose one option). InMYPROJECT/Plugins/UEFMIfolder:- Auto:
- Run
setup.bat(Windows) orsetup.sh(Linux)
- Run
- Manual:
- Copy files:
FMU.cpp,FMU1.cpp,FMU2.cpp - From:
ThirdParty/fmikit/src - To:
Source/UEFMI/ThirdParty/fmikit/src
- Copy files:
- Auto:
-
Run the Unreal Engine project
- Double click
MYPROJECT.uprojectand rebuild the plugin if prompted. - Or right-click
MYPROJECT.uprojectand selectGenerate Visual Studio project filesand then openMYPROJECT.sln
- Double click
These examples use the test.fmu included in the repo. The FMU provided will be extracted to a temporary folder called fmus at the top level of the UE project folder.
test.fmuis a Lorenz System model model created from the Modelica source code test.mo
Level_0- This level provides example blueprints (
BP_FMU) demonstrating the automatic and manual options for simulating an FMU. BP_FMUimplements theA_FMUclass.
- This level provides example blueprints (
Level_1- Simple use of
A_FMUand printing a variable to the screen via the level blueprint.
- Simple use of
- Currently only floats and booleans (i.e., 0/1) are supported variables in
A_FMU. - Has not yet been tested on non-Windows OS.
Copyright 2019 UT-Battelle. The code is released under the Apache License, Version 2.0.