LabVIEW 2017 Model Interface Toolkit Help
»View Product Info
Complete the following steps to convert your model you created in The MathWorks, Inc. Simulink® software into a compiled model that the Model Interface API can run.
1. Verify That the NI VeriStand Model Framework Is Installed
The NI VeriStand Model Framework must be installed on the computer with the Simulink software. The NI VeriStand Model Framework adds tools to the Simulink software that you use later in this procedure. More information.
2. Ensure You Have the Correct Compiler
Answer the following questions to determine which tools you must use to convert and compile Simulink models:
- What real-time operating system (RTOS) does my target run?
Refer to the following KnowledgeBase at ni.com for a list of RT targets and the RTOS that each runs, then continue to step 2: What Operating System is my Real-Time Controller Running and Why? (Windows) If you want to create a compiled model that runs on Windows, just continue to step 2.
- Given the OS my target runs, what tools do I use to compile my model and what output do I create?
||Required Output Type
- Microsoft Visual C++
- The MathWorks, Inc. Simulink ® Coder ™ software
||Note NI VeriStand 2015 also supports the older version of the Simulink Coder, called the Real-Time Workshop ®.
|Phar Lap ETS
- Wind River GNU Toolchain
- The MathWorks, Inc. Simulink Coder software
|NI Linux Real-Time
- C/C++ Development Tools for NI Linux Real-Time, Eclipse Edition
- The MathWorks, Inc. Simulink Coder software
- Which versions of these tools are compatible with the version of the Model Interface Toolkit I am using?
Refer to the following KnowledgeBase document at ni.com for a list of the versions of the LabVIEW, Windows, model compiler, and The MathWorks, Inc. software you can use with the Model Interface Toolkit: NI VeriStand Version Compatibility.
||Note The Model Interface Toolkit shares several components with the NI VeriStand software, such as tools for compiling models designed in third-party modeling environments.
3. Select the Correct Compiler in MATLAB
- (Phar Lap ETS, Windows) Run mex -setup in the MATLAB software and select the option number for a compatible version of Microsoft Visual C++.
- (VxWorks) Go to the next section. You will select the compiler in a later step.
- (NI Linux Real-Time) Go to the next section. You do not need to select a compiler for NI Linux Real-Time when you install C/C++ Development Tools for NI Linux Real-Time, Eclipse Edition.
4. Build the Compiled Model in Simulink
After you have the correct compiler set up and selected, complete the following steps to build the compiled model:
- Launch the Simulink software and load your model you want to convert.
- Select Simulation»Model Configuration Parameters to launch the Model Configuration Parameters dialog box.
- Click the Solver tab and configure the following options:
- Stop time: inf
- Type: Fixed-step
- Solver: discrete (no continuous states)
- Click the Code Generation tab.
- Click the Browse button to launch the System Target File Browser dialog box.
- Select the correct option for your target from the list:
- (ETS, Windows) NIVeriStand.tlc—NI Real-Time Target
- (NI Linux Real-Time)
- (ARM-based targets) NIVeriStand_Linux_ARM_32.tlc—NI Real-Time Target
- (Intel x64-based targets) NIVeriStand_Linux_64.tlc—NI Real-Time Target
||Note The Model Interface Toolkit is not supported on x64 Intel-based cDAQ controllers running NI Linux Real-Time.
- (VxWorks) NIVeriStand_VxWorks.tlc—NI Real-Time Target
||Note If the appropriate .tlc is not visible, the MATLAB software files might be read-only, and the Model Interface Toolkit installer is not able to provide this option. To display the option, add the following lines to the matlabrc.m file, a file that is installed by the MATLAB software:
where X is the drive letter on which you installed the NI VeriStand Model Framework.
The Model Interface Toolkit shares several components with the NI VeriStand software, such as tools for compiling models designed in third-party modeling environments.
- (VxWorks) On the NI Configuration tab, which is located under the Code Generation tab, specify the setup path for the Wind River GNU Toolchain.
- Click the OK button.
- Click the Build button in the Category section to begin building the compiled model. The MATLAB software command window displays the status of the build process. The following message in the MATLAB command window indicates that the Simulink Coder software has completed building the compiled model.
### Successful completion of build procedure for model:ModelName
Including External Source Code in the Compiled Model
If your model you are converting specifies any .c or .h files, you must specify the locations of these files so they are included in the compiled model. Specify the source files and include directories in the Simulink software, on the Code Generation tab of the Configuration Parameters dialog box.