Tutorial: FMU Import and Export
Learn how to import the FMU (Functional Mock-up Unit) into your model for data exchange, and export the FMU for co-simulation.
Files for This Tutorial
Controller.scm; Controller_FMU.scm; sb_controller_.fmu
About FMI and Requirements
The Functional Mock-up Interface (FMI) is a tool-independent standard that supports both model exchange and co-simulation of dynamic models using a combination of XML files and compiled C-code.
- Activate supports FMI 1.0 import and FMI 2.0 import and export processes.
- A Functional Mock-Up Unit (FMU) can be imported into an Activate model as a single block. Additionally, an Activate super block can be exported as an FMU in order to be exchanged and co-simulated with other tools supporting the FMI standard.
- The use of the Functional Mock-up Interface with Activate requires the selection of a solver and installation of a compiler.
Compiler Requirements
Activate requires a C-compiler to compile super blocks into C-code and the FMU. Activate detects if Microsoft Visual Studio or GCC is installed on your system and automatically invokes the compiler toolchain without any manual intervention.
If you do not have one of the supported compilers installed, you can complete the tutorial by loading the FMU that is provided with the tutorial model files: <installation_directory>\tutorial_models\sb_controller.fmu. If loading this file, skip the section, Exporting a Super Block to the FMU, and proceed to Importing the FMU through Model Exchange.
Supported Compilers on Windows Platforms
TCC is the default compiler provided for Windows. Some use cases require the installation of a third-party compiler. The following are the supported compilers for the Functional Mock-Up Interface (FMI), Modelica components, and C-code generation.
Compiler | FMI Export | Modelica Support | C-Code Generation |
---|---|---|---|
Microsoft® Visual Studio 2019: Community, Professional | Yes | Yes | Yes |
Microsoft® Visual Studio 2017: Express, Community, Professional | Yes | Yes | Yes |
Microsoft® Visual Studio C++ Build Tools 2019; 2017;
2015 Note: The option for Windows 10 SDK must be
selected.
|
Yes | Yes | Yes |
Microsoft® Visual Studio C++ 2015 (VC 14.0 Community and Professional) | Yes | Yes | Yes |
Microsoft® Visual Studio C++ 2013 (VC EXPRESS/VC Pro 12.0) | Yes | Yes | Yes |
Microsoft® Visual Studio C++ 2012 (VC EXPRESS/VC Pro 11.0) | Yes | No | Yes |
Microsoft® Visual Studio C++ VC 10.0 (VC Pro 10.0) | Yes | Yes | Yes |
Microsoft® Visual Studio C++ SDK 7.1 (VC EXPRESS 10.0) | Yes | No | Yes |
TCC (default provided with Activate installation) | No | No | Yes |
Supported Compilers on Linux Platforms
Compiler | FMI Export | Modelica Support | C-Code Generation |
---|---|---|---|
GCC | Yes | Yes | Yes |
FMU Export on Linux Platforms
FMU exporting on Linux requires ld version 2.27 or greater.
To export an FMU in Activate on Linux platforms, the
compilation and linking of the C code requires ld version 2.27 or greater. You can ensure
that you are working with a compatible version of ld by installing or updating Binutils with
the command: yum install binutils
.
Selecting a Solver
Importing the FMU through Model Exchange
Import the FMU into a controller model with the Model Exchange option.
Importing the FMU Through Co-Simulation
Import the FMU into a controller model with the Co-Simulation option.
Exporting a Super Block to the FMU
Export a super block from the controller model into the FMU.