Environment Preparation

Compiler Setup

Use VeriStand Model Generation Support to create VeriStand compatible models within the MathWorks Simulink® environment.

From the modeling environment you can generate models for Windows Desktop or NI Linux Real-Time platforms. Once generated, VeriStand can import and deploy the model to a target.

Before you can generate models for VeriStand, you need to install the support for Simulink following the instructions from the following link. VeriStand Model Generation Support for Simulink.

Model Compilation

Pre-requisite

  • Install VeriStand Model Generation Support in Simulink
  • Open the Vehicle Model from the Simulink simulation

Procedure

  1. On the Modeling tab, select Model Settings from the menu.

    ../image/model-settings-menu.png

  2. Click Solver in the left-side navigation tree and verify the settings for model compilation.

    ../image/model-settings-menu-solver-example.png

  3. Click Hardware Implementation in the left-side navigation tree and verify the settings.

    ../image/model-settings-menu-hardware-implementation-example.png

  4. Click Code Generation in the left-side navigation tree and select veristand.tlc for the System target file. The option appears only after installation of the VeriStand Model Generation Support Add-on for MATLAB.

    ../image/model-settings-menu-system-target-file.png

  5. On the Code Generation tab select GCC Compiler for VeriStand NI Linux Real-Time targets from the Toolchain drop-down menu.

    ../image/model-settings-menu-toolchaing.png

  6. Click OK to close the Configuration Parameters dialog box.

  7. In the Model Browser, right-click the vehicle dynamics model and select C/C++ Code»Build This Subsystem from the menu.

    ../image/model-build-this-subsystem.png

  8. View the log file from the building process in the Diagnostic Viewer.

    ../image/diagnostic-viewer-code-generated.png

Post-requisite

  • Note the location of the resulting compilation file for import into VeriStand.

    ../image/veristand-model-files-from-simulink-highlighted.png

  • Import the model files into VeriStand

Model Import

Pre-requisite

  • Compile the vehicle model subsystem for VeriStand
  • Locate the .vsmodel file to import into VeriStand

Procedure

  1. Launch VeriStand editor and open the Close loop Control Example - ADAS project.
  2. Place a Simulation Model node on the mapping diagram.

    1. Click Software»Simulation Model. ../image/veristand-simulation-model-on-palette.png
    2. Place the node on the diagram.

    3. In the Open dialog box, select a simulation model and click Open.
  3. Select the model block on the diagram and click the Item tab on the right-side of the window. ../image/model-and-item-tab-in-veristand.png

    • Verify the initial state for the model.
    • Verify the sampling rate.
    • Click the Unhide all channels button to display all input and outputs to the model.
  4. Wire the channels to and from the model node to create mappings. ../image/closed-loop-control-example-veristand.png
  5. Save the system definition file.

You can make changes to the imported model at any time by selecting the node in the Mapping Diagram window and updating the configuration on the Item tab.