Creating a Waveform Step Type using LabVIEW
Overview
This tutorial demonstrates how to create a custom step type using LabVIEW. Before starting, it is important to differentiate between the terms step and step type. A sequence developer creates (instantiates) steps of a particular Step Type in a sequence file. This is analogous to creating a variable of an integer or Boolean data type. Sometimes, the default Step Types do not provide the necessary features for a test application. TestStand allows you to create custom step types for your application.
The step type you create in this tutorial is similar to the Numeric Limit Test step type, with a couple exceptions:
- The code module must return a numeric array to a step property, Step.Waveform.
- A Post Substep, rather than the Status Expression, is used to evaluate the status.
- This step type contains a custom step property, Step.Result.RMSvalue, which you will display in the report.
See Creating a Waveform Step Type using LabVIEW -- example VIs, for LabVIEW VIs that complement this entry.
Table of Contents
Setting Up the Example
Create a new directory named Waveform in your TestStand\Components\USER\StepTypes directory. Copy the contents of the zip file for this tutorial to your new directory. This zip file contains EditLimits.vi which displays an edit dialog box and SetStatus.vi which sets the step status. The zip file also contains Get Waveform.vi which is the code module that the step calls. Get Waveform.vi creates a sinusoidal waveform and returns the waveform to the step property, Step.Waveform. The zip file also contains Start Modal Dialog.vi and End Modal Dialog.vi which are used in the Edit substep. Creating the Waveform Step Type
1. In the sequence file window, click the Type Palette button in the toolbar or select View>>Type Palette.
2. In the Type Palette, right-click in the right pane of the Step Types tab and select Insert Step Type from the context menu. Name this step type “Waveform”, as shown below.

3. In the left pane of the Step Types tab, click on the Waveform step type. Right-click in the right pane of the Waveform step type and select Insert Field>>Container and name the property Limits.
4. Under the Limits container, create two new numeric fields. Name them High and Low, as shown below. You can assign initial values to Limits.High and Limits.Low, if you like.

5. Under the Waveform step type, create a new numeric array property. Name the array Waveform.
6. Under the Waveform step type, create a new string property. Name the string property Comp. Give the string property a default value of “GELT” which corresponds to Greater than or Equal – Less Than. This matches LabVIEW’s In Range function which is used in the SetStatus.vi. The Comp property will be used to evaluate the precondition when the report includes the high and low limits.
7. Under the Result container, insert a new numeric property and name it RMSvalue. When the step executes, the TestStand engine automatically copies any step properties under the Result container to the ResultList. The report generation sequence creates the report from the entries in the ResultList. Later in this tutorial, you will modify the report generation sequence to include RMSvalue in the report.
8. Your new step type properties should appear as shown below.

9. Save the Type Palette.
Configuring the Waveform Step Type Properties
1. In the Type Palette, right-click on the Waveform step type in the left pane and select Properties from the context menu. This displays the Step Type Properties dialog box. The Step Type Properties dialog box is for configuring the properties, code modules, and default actions for a step type. For more information on the Step Type Properties dialog box, refer to Chapter 9 of the TestStand User Manual.
You will now examine several tabs and configure the properties for the new step type.
General Tab
This tab contains the default name, description, icon, and adapter type associated with a step type.
2. In the Default Step Name Expression control, enter “Waveform”, as shown below. When a step is created from this custom step type, it will have this default name. The sequence developer can later change the name of the step.

3. In this tutorial, leave the Step Description Expression as “%adapter”. When a step of this step type is created, the description will be the name of the code module that the step calls.
4. Do not designate an adapter. If you designate an adapter for this step type, any steps created from this step type can only use the specified adapter. If you designate an adapter, you could further restrict the step type to call a specific code module of your choice. Under the Disable Properties tab, you can enable Specify Module which prevents sequence developers from specifying a different code module. If you do not want to call any code module from your step type, designate the None adapter.
Menu Tab
5. Click on the Menu tab. The Menu tab specifies the text that appears in the Insert Step context menu when a step is inserted into the sequence file. Enter "Waveform" in the Item Name Expression control, as shown below.

The Menu tab contains other controls. When a string is placed in the Submenu Name Expression control, the value of Item Name Expression appears under a submenu in the Insert Step context menu. The Singular Item Name Expression control on the Menu tab replaces the submenu name if only one item exists under the submenu.
If you examine any of the default TestStand step types, you will notice that the function ResStr() is used in the expression controls on the General and Menu tabs. The ResStr() function looks up resource strings in language resource files. You can easily translate the resource files to another language, i.e. German, and all of the displayed strings will then appear in German.
Substeps Tab
The Substeps tab specifies substeps for the step type. It is possible to call code modules as Pre Steps and Post Steps for each step type. This is not the same code module that can be specified for each step instance. The sequence developer cannot customize the substeps for a particular step. If a Pre Step or Post Step is specified, that code module is called at every execution in every instance of the step type. During execution, TestStand calls the Pre Step substep before calling the step module and the Post Step substep after calling the step module. You can use any of the TestStand adapters when specifying code modules in the Substeps.
The default step types use the Status Expression to set the step status at run time. In this tutorial, you will use the Post Substep to set the step status of the Waveform step type.
6. In the Post Step area, click on the Create button. In the Create New Substep dialog box, select the LabVIEW Standard Prototype Adapter and click OK.
7. In the Post Step area, click Specify Module. In the Edit LabVIEW VI Call dialog box, click the Browse button and browse for SetStatus.vi in the TestStand\Components\USER\StepTypes\Waveform directory. If prompted, select Use a Relative Path for the file shown above. Click OK to return to the Edit LabVIEW VI Call dialog box. Enable the Sequence Context ActiveX Pointer checkbox.

The diagram of SetStatus.vi is shown below where the RMS Value of the waveform is compared to the high and low limits. If the RMS Value is within the high and low limits, the status is set to Passed, otherwise the status is set to Failed.
8. In the Edit Step area of the Substeps tab, click on the Create button. In the Create New Substep dialog box, select the LabVIEW Standard Prototype Adapter and click OK.
9. The Menu Item Name Expression control specifies the text that appears on the Edit Limits button in the Properties dialog box for the step type. Change this text to “Edit Limits”.

10. In the Edit Step area, click Specify Module and the Edit LabVIEW VI Call dialog box will appear. Click the Browse button and browse for EditLimits.vi in the TestStand\Components\USER\StepTypes\Waveform directory. If prompted, select Use a Relative Path for the file shown above, and click OK to return to the Edit LabVIEW VI Call dialog box. Enable the Sequence Context ActiveX Pointer checkbox, but do not select Show VI Front Panel When Called. The Edit Limits.vi will open its front panel when running.

The EditLimits.vi is shown below. All edit substeps must be modal to the sequence editor.

Disable Properties Tab
The Disable Properties tab allows you to prevent sequence developers from modifying certain step properties. In this example, you will prevent sequence developers from setting a Status Expression because that would override the status the SetStatus function sets.
11. Enable Status Expression in the Disable Properties tab.

12. Click OK to close the Waveform Step Type Properties dialog box and save the Type Palette.
See Also:
TestStand User Manual
Creating a Step from the Waveform Step Type
1. To create a new sequence file, set the Adapter Selector ring to LabVIEW Standard Prototype Adapter and insert a new step of the Waveform step type.
2. Double-click on the Waveform step type and click on the Edit Limits button from the dialog box. Set the High Limit to 1.0 and the Low Limit to 0.0 and click OK.
3. On the Properties dialog box, click on the Specify Module button and select Get Waveform.vi from the
TestStand\Components\USER\StepTypes\Waveform directory. Enable the Sequence Context ActiveX Pointer checkbox and the Show VI Front Panel When Called checkbox. Click OK to close the Edit LabVIEW VI Call dialog box. Click OK to close the Properties dialog box.

Get Waveform.vi will pass a sinusoidal waveform to Step.Waveform. At run time, the user specifies the amplitude and number of cycles for the waveform.
When you run your sequence, the status will be Passed if the RMS Value is greater than or equal to the Low Limit and less than the High Limit. The report includes the limits because the default process model calls the Include Limits in Results step. The report also includes the comparison property, Comp, because the default process model calls Include Comparison Type in Results. However, Step.Result.RMSvalue is not included in the report. You will include this in the next section.
Including Step.Result.RMSvalue in the Text Report
In this section, you will modify the text report generation sequence in the TestStand process model. If you do not want to modify the process model, you can use the ModifyReportEntry callback. Refer to the solution to this tutorial which uses the ModifyReportEntry callback.
1. Select Configure>>Report Options. In the Select a Report Generator for Producing the Report Body section, select Sequence. As you may know, the report body may be generated in either a DLL or a sequence, but this tutorial does not discuss modifying the DLL. If you want to ensure that the report body is always generated with a sequence, you may use a ReportOptions callback. For more information, refer to the solution to this tutorial for more information. Ensure that the Report Format control is set to ASCII Text File, and click OK to close the Report Options dialog box.
2. Do not modify the default process model. Make a copy of the default process model and modify the copy. To copy the process model, use Windows Explorer and browse to TestStand\Components\NI\Models\. Select and copy the TestStandModel folder. Browse to the TestStand\Components\USER\Models\ directory. Paste the TestStandModel folder that you just copied. If the TestStandModel directory already exists, delete it or move it to a temporary directory. By default, TestStand will use files from the Components\USER directory before those kept in the Components\NI directory.
3. In the Sequence Editor, navigate to TestStand\Components\User\Models\TestStandModel\ and open the ReportGen_txt.seq file. This sequence file generates the text report. Select PutOneResultInReport from the sequence file View selector ring.
Each time the PutOneResultInReport sequence executes, it adds a single step result entry to the report. For every step result in the main sequence, this sequence is executed.
4. Click the Parameters tab to see that the details of the report are passed in the Result container, as shown below. Data is placed into this container during execution. Each Statement step (e.g. Add Status step) in this sequence concatenates a string to the ReportEntry string. After this sequence executes, the completed ReportEntry parameter is returned to the calling sequence.

5. Click on the Main tab of the sequence window. Right-click on the Add Numeric Measurement step and insert a Statement step. Name this new step Add RMS Value.
6. Double-click on the new step and enter the expression for the Add RMS Value step as follows:
Parameters.ReportEntry += Parameters.DetailsIndentation + "RMS Value:" + Str(Parameters.Result.RMSvalue) + "\n"

7. Click on the Preconditions button to open the Preconditions dialog box. Click on the Insert New Expression button and set the expression as shown below:
Parameters.ReportOptions.IncludeMeasurements && PropertyExists("Parameters.Result.RMSvalue")
This precondition ensures that this step executes only if Parameters.Result.RMSvalue exists and the user has selected the Include Measurements report option.
Notice that the Preconditions for the Add High Limit and Add Low Limit steps refers to the Comp step property. This is the primary reason that you added the Comp property to the Waveform step type. If you did not add the Comp property, the preconditions for Add High Limit and Add Low Limit would not have allowed these steps to execute and include the limits in the report.
8. Click OK to close the dialog boxes. Save ReportGen_txt.seq.
When you run your new sequence file, you should see the RMS Value included in the text report.
Summary
You may refer to the solution in the Solution directory. The sequence file included in the solution uses a different name for the step type. If you want to use this step type in other sequence files, you can select Sequence File Types from the View ring, and copy the step type to your Type Palette.
You can apply the concepts used in this tutorial when you create your own step types. You can use the step type template example to help when making your own step types. Refer to the examples in the example programs database.
Reader Comments | Submit a comment »
Update to TS 3.5 & 4.0
Anyone using a newer version of TestStand
will not be able to follow this tutorial, due
to the fact the dialog boxes have changed.
- May 21, 2007
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).


