Skip to content
FMI4j is a software package for dealing with Functional Mockup Units (FMUs) on the JVM platform
Branch: master
Clone or download
Latest commit cd86278 Jul 2, 2019


License: MIT contributions welcome


CircleCI Build Status

FMI4j is a software package for dealing with Functional Mock-up Units (FMUs) on the Java Virtual Machine (JVM), written in Kotlin.

FMI4j supports both FMI 1.0 and 2.0 for Co-simulation. For Model Exchange version 2.0 is supported.
For Model Exchange, solvers from Apache Commons Math can be used.

Compared to other FMI libraries targeting the JVM, FMI4j is considerably faster due to the fact that we use JNI with manually optimized C++-code instead of JNA or SWIG generated bindings. A significant speedup (2-5x) compared to other FMI implementations for the JVM, such as JFMI and JavaFMI, should be expected.

Software API

class Demo {
    void main(String[] args) {
        Fmu fmu = Fmu.from(new File("path/to/fmu.fmu")); //URLs are also supported
        FmuSlave slave = fmu.asCoSimulationFmu().newInstance();
        // Model Exchange is also supported:
        // Solver solver = ApacheSolvers.euler(1E-3);
        // FmuSlave slave = fmu.asModelExchangeFmu(solver).newInstance(); 
        double stop = 10;
        double stepSize = 1.0/100;
        while(slave.getSimulationTime() <= stop) {
            if (!slave.doStep(stepSize)) {
        slave.terminate(); //or close, try with resources is also supported
        fmu.close(); // <- also done automatically by the library if you forget to do it yourself

Due to how cumbersome it is to publish artifacts to Maven Central, new releases can only be obtained using jitpack.

repositories {
    maven { url '' }

dependencies {
    def fmi4j_version = "..."
    implementation "com.github.NTNU-IHB.FMI4j:fmi-import:${fmi4j_version}"

To get started head over to the Wiki!

You can’t perform that action at this time.