Declaring Variables in a Real-Time Sequence

NI VeriStand 2018 Help

Edition Date: May 2018

Part Number: 372846M-01

»View Product Info
Download Help (Windows Only)

A real-time sequence is a program that runs within a stimulus profile and defines a specific task to execute on a unit under test (UUT). The code of a real-time sequence primarily contains expressions that act on different types of variables. As in any programming language, you must declare and define the variables the sequence can access and act on.

Real-time sequences can contain four different types of variables, all of which appear in the Variables pane:

  • Return Variable—The value the real-time sequence returns after it executes.
  • Parameters—The parameters, or inputs and outputs, that the sequence accepts when called and can pass out to other sequences or the stimulus profile.
  • Local Variables—Variables you want to access from statements within the current sequence. You cannot access a local variable outside of the sequence that declares it.
  • Channel References—Channel references allow you to read/write system definition channels directly from a real-time sequence. Note that channel references bind to specific system definition channels when added to a real-time sequence, and therefore the sequence that contains them is also bound to that system definition file. If you want to write a sequence that you can reuse across multiple system definition files, use parameters instead.

After you declare variables, you can include them in expressions that you add to the sequence code. When you begin entering an expression in the Expression field of the Property Browser, NI VeriStand automatically includes the names of defined variables to the type-ahead list of values that appears.

Declaring a Return Variable

  1. Select the type of value you want the sequence to return:
    • Boolean—To return a true/false value that indicates whether the sequence passes.
    • Void Return Value—If you do not need to perform a pass/fail evaluation on the sequence.
  2. Drag the appropriate data type from the Variables folder on the Primitives palette to the Return Variable section of the Variables pane.
  3. Select the variable in the Variables pane and use the Property Browser to configure its name and, for a Boolean, default value.

Declaring a Parameter

  1. To conserve space in memory, select the smallest possible data type that can hold the value you want to pass into or out of the sequence.
    Tip  Use Double or Boolean primitives to create parameters to map to system definition channels. All channels in NI VeriStand are 64-bit floating point numbers (doubles), but many can also accept Boolean values.
  2. Drag the appropriate data type from the Variables folder on the Primitives palette to the Parameters section of the Variables pane.
  3. Select the variable in the Variables pane and use the Property Browser to configure its Default Assignment, which is the channel to which it maps.

Declaring a Local Variable

  1. To conserve space in memory, select the smallest possible data type that can hold the value you want to pass into or out of the sequence.
  2. Drag the appropriate data type from the Variables folder on the Primitives palette to the Local Variables section of the Variables pane.
  3. Select the variable in the Variables pane and use the Property Browser to configure its Default Value.

Declaring a Channel Reference

  1. In the Variables pane, right-click the Channel References section, and then click Insert Channels.
  2. Use the configuration tree to select the channels you want to add as Channel References, and then click OK.

Related Links

WAS THIS ARTICLE HELPFUL?

Not Helpful