This optional module provides support for creation (export) and use (import) of FMUs encapsulating Chrono models and/or simulations.
Read the introduction to modules for a technical background on the modularity of the Chrono project.
Features
The Functional Mock-up Interface (FMI) is a free standard that defines a container (FMU - Functional Mock-up Unit) and an interface to exchange dynamic simulation models using a combination of XML files, binaries and C code, distributed as a ZIP file.
The Chrono::FMI
module currently supports the FMI 2.0 standard, with plans to extend support for FMI 3.0 in the future. Because of limitations of the FMI standard (in terms of defining models described by DAEs), only FMUs for co-simulation can be exported from Chrono.
Unlike other Chrono modules, Chrono::FMI
does not produce a new Chrono library, but rather exposes support for exporting Chrono co-simulation FMUs and importing FMUs for use in co-simulation with other Chrono models.
If the Chrono::Vehicle
module is also enabled, several FMUs encapsulating vehicle-related models are generated and made available for use. New Chrono::Vehicle FMUs will be added in the future.
Requirements
There are no explicit dependencies to build Chrono FMI support. The Chrono::FMI
module makes use of a generic FMU export/import tool (fmu_tools), also developed and maintained by the ProjectChrono team, but that library is used as a git sub-module and as such need not be separately downloaded and installed.
Chrono::FMI
module can be enabled only if Chrono is configured to create static libraries. Furthermore, when building Chrono with FMI support on Windows, make sure to compile Chrono with a multi-threaded statically-linked runtime library (/MT
or '/MTd', for Release and Debug modes, respectively). Both of these conditions can be set during CMake configuration, see the building instructions below. The requirement of using Chrono static libraries means that not all Chrono modules can be used in a build with
Chrono::FMI
enabled. While this issue will be further investigated, it is currently recommended not to enable any of the GPU-based Chrono modules. The
Chrono::FMI
module has been tested (on both Windowsc and Linux) in conjunction with the following other Chrono optional modules: Chrono::Vehicle, Chrono::Irrlicht, Chrono::Postprocess, and Chrono::PardisoMKL. It is possible that other modules can also be built, but that will require some experimentation. The
Chrono::FMI
module has not been tested on MacOS.
Building instructions
- During CMake configuration, ensure that
BUILD_SHARED_LIBRARIES
is set toOFF
. This will force building Chrono static libraries. - On Windows, also ensure that
USE_MSVC_STATIC_RUNTIME
is set toON
. This will force using a multi-threaded statically-linked runtime library. - Set
ENABLE_MODULE_FMI
toON
. - Set other CMake variables as desired/needed and press/invoke
Configure
until all CMake dependencies are satisfied. Then press/invokeGenerate
to create the build scripts. - Proceed with the building of Chrono as usual.
How to use it
- Consult the documentation of
fmu_tools
for the generic functionality for exporting and importing FMUs. - Look at the documentation of the Chrono extensions for exporting (
chrono::FmuChronoComponentBase
) and importing (chrono::FmuChronoUnit
) FMUs that encapsulate Chrono models. - Look at the C++ source of Chrono::FMI demos to learn how to use the functionality of this module.