Using LabVIEW VIs as Models

NI VeriStand 2018 Help

Edition Date: May 2018

Part Number: 372846M-01

»View Product Info
Download Help (Windows Only)

You can convert LabVIEW VIs into compiled .lvmodel or .lvmodelso files that add system simulation, closed-loop control, and other functionality to NI VeriStand applications. You then can use the configuration-based NI VeriStand environment to configure hardware I/O, stimulus profiles, custom device, and other features supported by NI VeriStand, and to deploy your model to real-time targets.

You can convert LabVIEW VIs, or convert simulation subsystems you create using the LabVIEW Control Design and Simulation Module. The following sections describe how NI VeriStand supports these models.

Verifying Support for Your Hardware Target

Before you convert a LabVIEW VI into a compiled .lvmodel or .lvmodelso, answer the following questions to determine whether your target supports these models:

  1. Do you want to run the model on a Windows computer or an RT target?
    • (Windows)—Windows targets support .lvmodel files. You can skip the remaining questions.
    • (RT)—Support depends on the real-time operating system (RTOS) the target runs. Continue to the next question.
  2. What RTOS does my RT target run?

    Refer to the KnowledgeBase at ni.com for a list of RT targets and the RTOS that each runs, and then continue to the next question.
  3. Given the RTOS my target runs, are.lvmodel or .lvmodelso files supported?
    • (Phar Lap ETS).lvmodel files are supported as long as the source VI does not contain code with certain Windows function calls that are not supported by the RTOS.
    • (NI Linux Real-Time).lvmodelso files are supported as long as the source VI does not contain code with certain Windows function calls that are not supported by the RTOS.
      Note  You must install additional software to enable LabVIEW models for targets running a Linux Real-Time OS. For more information about how to use LabVIEW models with Linux, visit the NI website.
    • (VxWorks)—Neither .lvmodel or .lvmodelso files are supported.

Preparing VIs to be Converted to Models

In LabVIEW, you must assign front panel controls and indicators in VIs to the connector pane so NI VeriStand can identify them as inports, outports, and parameters when you add the compiled .lvmodel or .lvmodelso to a system definition file. Build the VI connector pane according to how you want each control or indicator to work in NI VeriStand, as the following table describes.

Desired component in NI VeriStand VI connector pane assignment Is default value in LabVIEW
imported into NI VeriStand?
Inport Required input No
Outport Any output No
Parameter Optional or Recommended input Yes

Supported LabVIEW Data Types

Ensure that front panel controls or indicators assigned to the VI connector pane have only the following data types:

  • Numerics
  • Booleans
  • 1D arrays of numerics
  • 1D arrays of Booleans
  • Clusters containing the previous data types

If you use an unsupported data type, LabVIEW returns an error when you try to convert the VI to a compiled .lvmodel or .lvmodelso. Note controls and indicators not assigned to the connector pane can have other data types because these objects are not part of the compiled model.

Configuring Global and Local Parameters

A compiled .lvmodel or .lvmodelso you add to a system definition file can contain global parameters and block parameters:

  • To ensure a front panel control in the source VI becomes a global parameter in NI VeriStand, do not place that control in a cluster.
  • If you want a front panel control in the source VI to become a local parameter in NI VeriStand, place that control in a cluster shell before you compile the VI into a .lvmodel or .lvmodelso.

Considerations for VIs with Array Terminals

If a VI contains an array control or indicator you want to include in the .lvmodel or .lvmodelso, enter a value in the nth element of the array, where n is the desired number of elements. Then, right-click the array control and select Data Operations»Make Current Value Default. Otherwise, the array appears in NI VeriStand with a single element.

Related Links

Generating Compiled Models for NI VeriStand

Purchase the Control Design and Simulation Module

Assigning Terminals to Controls and Indicators

Setting Required, Recommended, and Optional Inputs and Outputs

Differences Between Local and Global Parameters

WAS THIS ARTICLE HELPFUL?

Not Helpful