This work was tested using the following. It may work on something else but no guarantees.
A_FMU
-> The WorkhorseA_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:
PathFMU
is the location of the FMU and supports relative or absolute paths. mResults
returns the results requested from the variables added to mStoredVariables
.
mResults
only returns values when mAutoSimulateTick
= True. Else it is empty and variables must be be retrieved using the GetReal()
function.mModelVariables
are the names of all availble variables found in the model which could be added to mStoredVariables
.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
.
MYPROJECT
folder and create a Plugins
folder if it doesn't exist.
cd MYPROJECT
mkdir Plugins
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
git submodule update --remote
to grab the latest commits instead of specific commitCopy the files from the submodule to the UEFMI
plugin source folder (choose one option). In MYPROJECT/Plugins/UEFMI
folder:
setup.bat
(Windows) or setup.sh
(Linux)FMU.cpp
, FMU1.cpp
, FMU2.cpp
ThirdParty/fmikit/src
Source/UEFMI/ThirdParty/fmikit/src
Run the Unreal Engine project
MYPROJECT.uproject
and rebuild the plugin if prompted.MYPROJECT.uproject
and select Generate Visual Studio project files
and then open MYPROJECT.sln
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.fmu
is a Lorenz System model model created from the Modelica source code test.mo
Level_0
BP_FMU
) demonstrating the automatic and manual options for simulating an FMU.BP_FMU
implements the A_FMU
class.Level_1
A_FMU
and printing a variable to the screen via the level blueprint.A_FMU
.Copyright 2019 UT-Battelle. The code is released under the Apache License, Version 2.0.