Skip to content

stoljarjo/FMI.jl

 
 

Repository files navigation

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, simulate and plot FMUs seamlessly inside the Julia programming language!

Dev Docs Test (latest) Test (LTS) Examples (latest) Build Docs Run PkgEval Coverage ColPrac: Contributor's Guide on Collaborative Practices for Community Packages

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.6) pkg> add FMI

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

(@v1.6) 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
myFMU = fmiLoad(pathToFMU)

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

# plot it!
fmiPlot(simData)

# free memory
fmiUnload(myFMU)

What is currently supported in FMI.jl?

  • importing the full FMI 2.0.3 and FMI 3.0.0 command set, including optional specials like fmi2GetState, fmi2SetState and fmi2GetDirectionalDerivatives
  • parameterization, simulation & plotting of CS- and ME-FMUs
  • event-handling for imported discontinuous ME-FMUs
FMI2.0.3 FMI3.0
Import Export Import Export
CS ✓✓ ~~ ~
ME (continuous) ✓✓ ✓✓ ~
ME (discontinuous) ✓✓ ✓✓ ~
SE - - ~
Explicit solvers ✓✓ ✓✓ ~
Implicit solvers (autodiff=false) ✓✓ ~~ ~
Implicit solvers (autodiff=true) ~~ ~~ ~
get/setState ✓✓ ~ ~
getDirectionalDerivatives ✓✓ ~ ~
getAdjointDerivatives - - ~

✓✓ supported & tested

✓ beta supported, untested

~~ work in progress

~ planned

- not supported by the corresponding FMI standard

x 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:

  • FMI.jl: High level loading, manipulating, saving or building entire FMUs from scratch
  • FMIImport.jl: Importing FMUs into Julia
  • FMIExport.jl: Exporting stand-alone FMUs from Julia Code
  • FMICore.jl: C-code wrapper for the FMI-standard
  • FMIBuild.jl: Compiler/Compilation dependencies for FMIExport.jl
  • FMIFlux.jl: Machine Learning with FMUs (differentiation over FMUs)
  • FMIZoo.jl: A collection of testing and example FMUs

What is further under development in FMI.jl?

  • FMI Cross Checks (as soon as the successor is available)
  • nice documentation & doc-strings
  • more examples/tutorials
  • ...

What is planned for FMI.jl?

  • SSP 1.0 support
  • ...

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) and Ubuntu latest (64-bit). Mac and Julia (32-bit) should work, but untested. For the best performance, we recommend using Julia >= 1.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 exisitng code, one will have to make design decissions that influence the library performance and usability. The following priorization should be the basis for decision-making:

  • #1 Compliance with standard: It is the highest priority to be compliant with the FMI standard (fmi-standard.org). Identifiers described in the standard must be used. Topologies should follow the specification as far as the possibilities of the Julia programming language allows.
  • #2 Performance: Because FMI.jl is a simulation tool, performance is very important. This applies to the efficient use of CPU and GPU, but also the conscientious use of RAM and disc space.
  • #3 Usability: The library should be as usable as possible, as long as being fully compliant with the FMI standard.

Interested in Hybrid Modelling in Julia using FMUs?

See FMIFlux.jl.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Julia 100.0%