ThummeTo / FMI.jl

FMI.jl is a free-to-use software library for the Julia programming language which integrates FMI (fmi-standard.org): load or create, parameterize, differentiate and simulate FMUs seamlessly inside the Julia programming language!
MIT License
86 stars 24 forks source link
co-simulation fmi fmu julia model-exchange scheduled-execution simulator

FMI.jl Logo

FMI.jl

What is FMI.jl?

FMI.jl is a free-to-use software library for the Julia programming language which integrates the Functional Mock-Up Interface (fmi-standard.org): load or create, parameterize, differentiate, linearize, simulate and plot FMUs seamlessly inside the Julia programming language!

Documentation Build Docs Dev Docs
Examples Examples (latest)
Tests Test (latest) Test (LTS) Aqua QA
FMI cross checks FMI2 Cross Checks
Package evaluation Run PkgEval
Code coverage Coverage
Collaboration ColPrac: Contributor's Guide on Collaborative Practices for Community Packages
Formatting SciML Code Style

Breaking Changes in FMI.jl (starting from v0.14.0 until release of v1.0.0)

If you want to migrate your project from FMI.jl < v1.0.0 to >= v1.0.0, you will face some breaking changes - but they are worth it as you will see! We decided to do multiple smaller breaking changes starting with v0.14.0, instead of one big one. Some of them are already implemented (checked), some are still on the todo (unchecked) but will be implemented before releasing v1.0.0.

πŸŽ‰ After all listed features are implemented, v1.0.0 will be released! πŸŽ‰

How can I use FMI.jl?

1. Open a Julia-REPL, switch to package mode using ], activate your preferred environment.

2. Install FMI.jl:

(@v1) pkg> add FMI

3. If you want to check that everything works correctly, you can run the tests bundled with FMI.jl:

(@v1) pkg> test FMI

4. Have a look inside the examples folder in the examples branch or the examples section of the documentation. All examples are available as Julia-Script (.jl), Jupyter-Notebook (.ipynb) and Markdown (.md).

How can I simulate a FMU and plot values?

using FMI, Plots

# load and instantiate a FMU
fmu = loadFMU(pathToFMU) 

# simulate from t=0.0s until t=10.0s and record the FMU variable named "mass.s"
simData = simulate(fmu, (0.0, 10.0); recordValues=["mass.s"])

# plot it!
plot(simData)

# free memory
unloadFMU(myFMU)

What is currently supported in FMI.jl?

FMI2.0.3 FMI3.0 SSP1.0
Import Export Import Export Import Export
CS βœ”οΈβœ”οΈ 🚧 βœ”οΈβœ”οΈ πŸ“… πŸ“… πŸ“…
ME (continuous) βœ”οΈβœ”οΈ βœ”οΈβœ”οΈ βœ”οΈβœ”οΈ πŸ“… πŸ“… πŸ“…
ME (discontinuous) βœ”οΈβœ”οΈ βœ”οΈβœ”οΈ βœ”οΈβœ”οΈ πŸ“… πŸ“… πŸ“…
SE 🚫 🚫 🚧 πŸ“… 🚫 🚫
Explicit solvers βœ”οΈβœ”οΈ βœ”οΈβœ”οΈ βœ”οΈβœ”οΈ πŸ“… πŸ“… πŸ“…
Implicit solvers (autodiff=false) βœ”οΈβœ”οΈ βœ”οΈβœ”οΈ βœ”οΈβœ”οΈ πŸ“… πŸ“… πŸ“…
Implicit solvers (autodiff=true) βœ”οΈ βœ”οΈβœ”οΈ βœ”οΈ πŸ“… πŸ“… πŸ“…
get/setFMUstate βœ”οΈβœ”οΈ πŸ“… βœ”οΈβœ”οΈ πŸ“… 🚫 🚫
getDirectionalDerivatives βœ”οΈβœ”οΈ πŸ“… βœ”οΈβœ”οΈ πŸ“… 🚫 🚫
getAdjointDerivatives 🚫 🚫 βœ”οΈβœ”οΈ πŸ“… 🚫 🚫
FMI Cross Checks βœ”οΈβœ”οΈ πŸ“… πŸ“… πŸ“… 🚫 🚫
64-bit binaries in FMUs βœ”οΈβœ”οΈ βœ”οΈβœ”οΈ βœ”οΈβœ”οΈ πŸ“… 🚫 🚫
32-bit binaries in FMUs βœ”οΈ πŸ“… πŸ“… πŸ“… 🚫 🚫

βœ”οΈβœ”οΈ supported & CI-tested

βœ”οΈ beta supported: implemented, but not CI-tested

🚧 work in progress

πŸ“… planned

🚫 not supported by the corresponding FMI standard (not applicable)

❌ not planned

What FMI.jl-Library to use?

FMI.jl Logo To keep dependencies nice and clean, the original package FMI.jl had been split into new packages:

What Platforms are supported?

FMI.jl is tested (and testing) under Julia Versions 1.6 LTS (64-bit) and latest (64-bit) on Windows latest (64-bit, 32-bit) and Ubuntu latest (64-bit). Mac (64-bit, 32-bit) and Ubuntu (32-bit) should work, but untested. For the best performance, we recommend using Julia >= 1.7, even if we support and test for the official LTS (1.6.7).

How to cite?

Tobias Thummerer, Lars Mikelsons and Josef Kircher. 2021. NeuralFMU: towards structural integration of FMUs into neural networks. Martin SjΓΆlund, Lena Buffoni, Adrian Pop and Lennart Ochel (Ed.). Proceedings of 14th Modelica Conference 2021, LinkΓΆping, Sweden, September 20-24, 2021. LinkΓΆping University Electronic Press, LinkΓΆping (LinkΓΆping Electronic Conference Proceedings ; 181), 297-306. DOI: 10.3384/ecp21181297

Related publications?

Tobias Thummerer, Johannes Stoljar and Lars Mikelsons. 2022. NeuralFMU: presenting a workflow for integrating hybrid NeuralODEs into real-world applications. Electronics 11, 19, 3202. DOI: 10.3390/electronics11193202

Tobias Thummerer, Johannes Tintenherr, Lars Mikelsons. 2021 Hybrid modeling of the human cardiovascular system using NeuralFMUs Journal of Physics: Conference Series 2090, 1, 012155. DOI: 10.1088/1742-6596/2090/1/012155

Notes for contributors

Contributors are welcome. Before contributing, please read, understand and follow the Contributor's Guide on Collaborative Practices for Community Packages. During development of new implementations or optimizations on existing code, one will have to make design decisions that influence the library performance and usability. The following prioritization should be the basis for decision-making: