Creating Simulation Models Using VeriStand Model Generation Support Add-On

Updated Feb 27, 2023

Environment

Software

  • VeriStand
  • MATLAB
  • Simulink

The VeriStand Model Generation Support add-on for MATLAB® allows the creation of models within the MathWorks Simulink® environment that are compatible with VeriStand.

This article describes how to set up and create a compatible Simulink model using the VeriStand Model Generation Support Add-on for MATLAB and how to import it into VeriStand.

Software required:
  • VeriStand 2021 or newer
  • MATLAB R2020a and later releases

Prerequisites:

Setting up and building a VeriStand compatible Simulink model

  1. Open your model in Simulink, then navigate to the MODELING tab. Open the Model Settings drop-down menu and select Model Settings (you can quickly access this setting using the shortcut <Ctrl+E>).
image.png
 
  1. Go to the Solver section and ensure that in the Solver selection area that Type is set to Fixed-step and the Solver is set to discrete (no continuous states). Also, set the stop time to inf (Infinite) to avoid the model stopping unexpectedly after a certain amount of time. 
image.png
 
  1. In the Code Generation section, select veristand.tlc as the System target file. Consult the VeriStand Model Generation Support documentation to determine the correct Toolchain to be used with your target. You can for more information regarding which toolchain should be used with each type of target. For example, using a NI Linux RT target the settings would look like:
image.png
 
  1. In the Hardware Implementation section, Consult the VeriStand Model Generation Support documentation to ensure that the Device vendor and the Device type settings are set correctly for the target you are using. Additionally, ensure that Support long long is enabled. For example, using a NI Linux RT target the settings would look like: 
image.png
 
  1. Close the Configuration Parameters window and open the Simulink Coder tool located in the APPS tab of the Simulink menu.
image.png
 
  1. In the new C Code tab, press the Build button to start compilation. Once the build process completes you will be notified with a message in the Diagnostic Viewer.

 
  1. The compilation process will output a file with .vsmodel extension and file with SO or DLL extension for a Linux or Windows target respectively.
 

Importing the Simulink model in VeriStand

  1. To import the model, open an existing VeriStand project or create a new project and then open the Software palette in the mapping diagram and drag and drop the Simulation Model function. It is important to mention that, at this moment, Simulink models can’t be imported through the VeriStand system explorer.
image.png
 
  1. Dropping the Simulation Model function in the Mapping Diagram will automatically open a file dialog that you will use to navigate and select the .vsmodel file previously generated.
  2. You will notice that the function will change to include the name of the model, while inports and outports can be shown by expanding the simple model block.
  3. The new unmapped channels can be configured in the system explorer. 
  4. You can change the path of the model and review system definition settings if needed at the right pane.
image.png