Generating FMI Models from The MathWorks®, Inc. Simulink® for NI VeriStand

Updated Nov 5, 2020



  • VeriStand
  • Simulink

Operating System

  • LabVIEW Real-Time (NI Linux Real-Time)

This article will explain and walk through how to generate FMI models from the MathWorks®, Inc. Simulink® for NI VeriStand.

The Functional Mockup Interface (FMI) is an API standardization for exchanging dynamic system models. NI VeriStand 2019 and higher versions enable configuration and execution of FMI 2.0 Co-Simulation models on Windows and NI PXI Linux Real-Time systems. This support requires FMI models to have the proper executable binaries available. For Windows targets, win32 binaries are required. For NI PXI Linux Real-Time targets, linux64 binaries are required.

MATLAB R2020a and higher versions enable generating standalone FMI models, but only support win64 and linux64 binaries now. Therefore, we introduce an open-source 3rd-party toolkit, FMIKit-Simulink from Dassault Systèmes®, for exporting win32 FMI models. The following table shows a summary of toolkits' capability to generate models for NI VeriStand model deployment.
Table 1. Toolkits' Capability to Generate Models for NI VeriStand Model Deployment
Toolkit for Simulink®Generated Model FormatDeploy to
Deploy to
Phar Lap
Deploy to
MATLAB Compatibility
VeriStand Model Framework*.dll/*.soüüüVeriStand Modeling Version Compatibility
Simulink® Compiler™*.fmuxNot supportedüR2020a - latest
FMIKit-Simulink*.fmuüNot supportedüR2012b - latest

Setting up the Software Environment

  1. Install MATLAB®
    • For Windows targets, install MATLAB in a Windows system.
    • For NI PXI Linux Real-Time targets, install MATLAB in a compatible Linux system.
  2. Install Compiler

Simulink® Compiler™: Generate FMI Models for NI PXI Linux Real-Time Targets

  1. Refer to External Link: Export Simulink Model to Standalone FMU - MathWorks® Help Center

FMIKit-Simulink: Generate FMI Models for Windows and NI PXI Linux Real-Time Targets

  1. Download FMI Kit for Simulink and decompress the zip file, refer to External Link: The Latest Release of FMIKit-Simulink - GitHub
  2. Initialize FMI Kit for Simulink. Open MATLAB and execute the following code in the Command Window.   
    % add the FMIKit-Simulink folder to the MATLAB path, replace the path as your own 
    % initialize FMIKit 
  3. Open the Simulink model.
  4. Open the Configuration Parameters window. The Simulink menu differs in different MATLAB versions. The following figure shows the condition in MATLAB R2020a.   

  5. Configure Solver. Navigate to Solver tab. Configure Solver selection > Type as Fixed-step, and specify a proper Fixed-step size.  

  6. Configure Code Generation. Navigate to Code Generation > Target selection > System target file. Choose grtfmi.tlc (based on the Generic Real-Time target). 
  7. For Windows systems, configure the compiler. Navigate to CMake > CMake generator. Choose one of the win32 compilers shown in the following figure.  
    For Linux systems, use the default configuration.

  8. Save Configuration Parameters and close the window.
  9. Build.
  10. It will report an error that CMake is not installed when compiling for the first time. You can click grtfmi_install_cmake in the Diagnostic Viewer window to download and install CMake. Then build the model again.

Next Steps

Import the FMI models into NI VeriStand, refer to Adding and Configuring a Model - NI VeriStand Manual.