Skip to content

Latest commit

 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FMI Beginner's tutorial

FMI-tutorial-logo

This repository contains the agenda and materials for the FMI Beginner's tutorial presented at the Asian Modelica & FMI Conference 2026.

A Video Recording from a similar tutorial at the Modelica and FMI Conference 2025 is available on YouTube

Prerequisites for the Hands-on-part

Agenda

Part 1: Introduction to the FMI (45 min)

Presentation covering

  • a general introduction to FMI
  • explanation of the example model for part 2 + 3

Part 2: Working with FMUs

Live demo + Hands On

  • Do the fmusim tutorial: https://modelica.github.io/fmusim/tutorial/
  • Simulate the FMU ControlledElectricDrive_FMU_3.fmu in the part2 folder with fmusim
  • Start the fmpy GUI with python -m fmpy.gui
  • Inspect the FMU
  • Simulate the fmu
  • Build a platform binary (assumption: cmake and compiler installed)
  • Generate a Jupyter notebook from for the FMU and run it

Part 3: Connecting Multiple FMUs

Live demo + Hands On

  • Open your Modelica Tool (e.g. OpenModelica)
  • Load the Library "C:\hub\fmi-beginners-tutorial-2026\FMI\package.mo" (a preview of the next release of https://github.com/modelica/Modelica-FMI)
  • We will import our FMUs to a package Import_FMUs_Library (It was created as a Modelica package stored in multiple files.
    • cd C:\hub\fmi-beginners-tutorial-2026\part3
    • C:\hub\fmi-beginners-tutorial-2026\FMI\Resources\Library\win64\modelica-fmi .\fmus\Drive_FMU_3.fmu .\Imported_FMUs_Library\Drive_FMU_3.mo --overwrite
    • C:\hub\fmi-beginners-tutorial-2026\FMI\Resources\Library\win64\modelica-fmi .\fmus\Controller_FMU_3.fmu .\Imported_FMUs_Library\Controller_FMU_3.mo --overwrite
    • C:\hub\fmi-beginners-tutorial-2026\FMI\Resources\Library\win64\modelica-fmi .\fmus\Stimuli_FMU_3.fmu .\Imported_FMUs_Library\Stimuli_FMU_3.mo --overwrite
  • (Re-)load the Imported_FMUs_Library in your Modelica tool from the hub\fmi-beginners-tutorial-2026\part directory
  • Create a new Modelica model Connected_FMUs in your Modelica tool in the package Imported_FMUs_Library
  • Insert the three FMus from the Imported_FMUs_Library to the Connected_FMUs model
  • Connect the inputs and outputs (fitting by name)
  • Simulate for 1s and plot the variable w of the Drive FMU
  • vary the communicationStepsize of the FMus to 0.1s, 0.01s, 0.001s to see the effect of the communication stepsize
  • Optional: Re-load the package in a different Modelica tool.
  • optional: Create a container FMU out of the the FMUs and run it in fmpy.

Part 4: New features of FMI 3.0 and outlook

Slides can be downloaded here.

FMI 3.0 examples:

  • Change to the C:\hub\fmi-beginners-tutorial-2026\part4\fmi3-features direrctory
  • in a Python enviroment run jupyter notebook

Copyright and License

Code and documentation copyright (C) 2026 the Modelica Association Project FMI. fmusim and fmpy and cde released under the 2-Clause BSD License. Docs released under Attribution-ShareAlike 4.0 International.

Acknowledgments

This tutorial is based on previous versions of the tutorial given by Claudio Gomes, Maurizio Palmieri and Christian Bertsch. We are thankful to Torsten Sommer for his contributions to this tutorial materials, and to Kenneth Lausdahl as well as the other developers of the INTO-CPS tool and Maestro. In addition, part of this work has been supported by the DIGIT-Bench project (case no. 640222-497272), funded by the Energy Technology Development and Demonstration Programme (EUDP).

About

FMI Beginner's tuturial

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages