ORNL-Modelica / UnrealEngine-FMIPlugin

27 stars 5 forks source link

Unreal Engine - FMI Plugin (UEFMI)

FMU_BP_example

Background

Prerequisites

This work was tested using the following. It may work on something else but no guarantees.

A_FMU -> The Workhorse

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:

Installation

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.

  1. Create an Unreal Engine project. Fror illustration purposes let's call it MYPROJECT.

    • Go to the project MYPROJECT folder and create a Plugins folder if it doesn't exist.
      cd MYPROJECT
      mkdir Plugins
  2. 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 --remote to grab the latest commits instead of specific commit
  3. Copy the files from the submodule to the UEFMI plugin source folder (choose one option). In MYPROJECT/Plugins/UEFMI folder:

    • Auto:
      • Run setup.bat (Windows) or setup.sh (Linux)
    • Manual:
      • Copy files:
        FMU.cpp, FMU1.cpp, FMU2.cpp
      • From:
        ThirdParty/fmikit/src
      • To:
        Source/UEFMI/ThirdParty/fmikit/src
  4. Run the Unreal Engine project

    • Double click MYPROJECT.uproject and rebuild the plugin if prompted.
    • Or right-click MYPROJECT.uproject and select Generate Visual Studio project files and then open MYPROJECT.sln

Test Installation

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

Known Issues

License

Copyright 2019 UT-Battelle. The code is released under the Apache License, Version 2.0.