Giter VIP home page Giter VIP logo

unrealengine-fmiplugin's Introduction

UnrealEngine-FMIPlugin

FMUinUE4

  • A MVP (minimally viable product) of simulating FMUs within the Unreal Engine environment.
  • This MVP relies on the FMIKit repository (non-simulink portion)
  • Special thanks to Torsten Sommer for his work on FMIKit!
  • Short Demo video

Prerequisites

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

  • Windows 10
  • Unreal Engine 4.25+
  • Visual Studio 2019
  • An unzip utility on path, currently supported are unzip, 7z, tar

FMU

  • The included example FMU, test.fmu, and is a Lorenz System model.
    • The Modelica file is included in the Modelica folder.
  • This FMU is generated using Dymola 2021 with Binary Model Export License (i.e., license free FMU)

Regarding A_FMU

In this current version, the A_FMU under FMIKit C++ Classes/FMIKit/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.

  • mResults returns the results requested by the user mStoredVariables.
    • mResults only returns values when mAutoSimulateTick = True. Else it is empty and variables can be retrieved using the GetReal() function.
  • mModelVariables are the names of all the variables found in the model.

Installation

Follow the following steps to get this project up and running on your own computer. This project uses symbolic links (Method 2) but those can be tricky. So if you are not familiar with them it is recommended to use Method 1.

Method 1

  1. Clone the repositoy with FMIKit submodule
    • git clone https://github.com/ORNL-Modelica/UnrealEngine-FMIPlugin.git
    • cd to repo
    • git submodule init
    • git submodule update
  2. Fix the symbolic links
    • From UnrealEngine-FMIPlugin/FMIPlugin/Plugins/FMIKit/ThirdParty/fmikit/src copy the files FMU.cpp, FMU1.cpp, and FMU2.cpp and replace the same names files in UnrealEngine-FMIPlugin/FMIPlugin/Plugins/FMIKit/Source/FMIKit/ThirdParty/fmikit/src
  3. Launch the FMIPlugin.uproject rebuilding the project when prompted.
  4. Have fun!

Method 2

  1. Clone the repository
  • "git submodule update --init"
  • FMU[1/2].cpp are symlinks
    • copy the submodule files over the links (text files) OR
    • it may be necessary to turn symlinks = true in .git/config
    • it may be necessary to have installed git with enable symlinks.
    • it may be necessary to clone or run "git reset HEAD --hard" as administrator
  • Open the project FMIPlugin.uproject by double-clicking the file.
  • When prompted, rebuild the project click Yes.
    • The project will build and then launch Unreal Engine.

Test Installation

These examples use the test.fmu included in the repo.

For both levels, the user must replace the M Path variable of the actor component in the details panel with the path on your system to the test.fmu located at the root of the repo.

  • Level_0
    • This level provides example blueprints (BP_FMU) demonstrating the automatic and manual options for simulating an FMU.
    • BP_FMU implements the A_FMU class
  • Level_1
    • Simple use of A_FMU and printing a variable to the screen via the level blueprint.

Known Issues

  • Currently only floats and booleans (i.e., 0/1) are supported variables in A_FMU.

License

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

unrealengine-fmiplugin's People

Contributors

greenwoodms06 avatar lewinj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.