Use Simulink Model for Windows Target With LabVIEW Model Interface Toolkit

Updated Sep 29, 2023

Environment

Software

  • LabVIEW Model Interface Toolkit
  • MATLAB

Models can be executed and communicated with using the Model Interface VIs provided by the LabVIEW Model Interface Toolkit. This tutorial will show you how to compile a Simulink Model in MATLAB for a Windows target and use it with the LabVIEW Model Interface Toolkit.

 

Software Setup

  • MATLAB R2019a
  • Microsoft Visual Studio 2017 (select Desktop development with C++) - Compiler
  • LabVIEW 2021 SP1 (64-bit)
  • LabVIEW Model Interface Toolkit 2021 - VeriStand 2021 Model Framework will be included


Steps to Compile Simulink Model

  1. First make sure that you have installed compatible MATLAB, Compiler and LabVIEW versions by referring to this link: VeriStand LabVIEW Modeling and Legacy Simulink Modeling Version Compatibility.
  2. Open MATLAB, and make sure that it shows the version of VeriStand Model Framework.
  3. Run mex -setup in the MATLAB software and select a compatible version of Microsoft Visual C++. In this case, since we using LabVIEW 2021 SP1 we need Microsoft Visual Studio 2017 (select Desktop development with C++) as the compiler.
2023-02-13_10h16_56.png
  1. Create a simple model in Simulink, for example in the picture below:
2023-02-13_17h06_27.png
  1. Set the correct compiler setting for Windows target, please refer to Build the Compiled Model in Simulink subtopic from this link: Compiling a Model from MathWorks Simulink® Software (Model Interface Toolkit) .
  2. Press the Build Model to compile the Simulink model and make sure that the build process is completed successfully. It will generate the DLL file for the Windows target.
2023-02-13_10h18_24.png
 

Use Simulink Model with LabVIEW Model Interface Toolkit

  1. Run the LabVIEW software and open the MIT Get Model Information VI from the LabVIEW example finder.
2023-02-14_10h51_18.png
  1. Find the file path for your compiler model, in this example is add.dll. Then, run the example and it will verify the model and report the properties of Inports, Outports, Parameters and Signals. 
2023-02-14_10h52_06.png

2023-02-14_10h52_32.png