As discussed in this document, there are several options available to control switches from TestStand. The following section describes the advantages and disadvantages of each.
1) Code Module
Writing test sequences which perform switch operations from code modules is the recommended method for controlling switches from TestStand. This option is the most modular approach, as test developers can modify the code which performs the switch operations with minimal affect on the rest of the test sequence. Using either the instrument-specific driver or the Switch Executive API in code modules give access to low-level IVI sessions as well as additional functionality that the other options do not expose. Use NI Switch Executive to simplify and streamline the configuration and control of your IVI-compliant switches.
Note: The NI Switch Executive API requires the purchase and installation of NI Switch Executive software.
Using this method has the potential disadvantage of increased likelihood of user error. Test developers must be familiar with the instrument driver or NI Switch Executive API and ensure that they implement proper test system architecture to create maintainable and expandable test sequences. For example, niSE Connect and Disconnect should be used to decrease switching time and increase device lifetime in automated test systems.
Figure 10: Use niSE Connect and Disconnect to specify which routes/route groups to control from code modules
2) Step Switching Property
Installing NI Switch Executive gives test developers the ability to add switching functionality to any step within a TestStand sequence using the Step Switching Property. A clear advantage of the Switching property is code reusability. For example, imagine you have a particular test that requires multiple routes to be connected. If you perform that test in several different test routines, you can simply create a step template and reuse that step in another sequence. All of the properties that come with the step (including switching) get included in the step template. In order to add a step to the Templates list, simply drag the step from the Steps Pane and drop into the Template list.
Figure 11: The Templates list is part of the Insertion Palette Pane. Drag and drop a step from the Steps Pane to the Templates list in order to reuse the step in another sequence.
A potential disadvantage to the Step Switching Property is decreased test sequence readability. When using the Switching property, make sure to document your TestStand sequences. When modifying step properties from the default behavior, TestStand will automatically document this change in the Steps Pane. For example, if you Enable Switching for a LabVIEW Action step, TestStand will enter Switch into the Settings category for the step in the Steps Pane.
Figure 12: Enable Switching has been checked for this LabVIEW Action Step. Notice that TestStand has automatically inserted Switch in the Settings category for the Action step in the Steps Pane.
You can also document your sequences by using the step Comment field and Label steps.
Figure 13: Enter comments into the Comment field in the General Panel of the Properties tab for the step settings.
Figure 14: Further document the step with a preceding Label step and comments (appear above the step name)
IVI Switch Step Type: Switch Executive Mode
The IVI Switch step in Switch Executive mode has very similar functionality to the Step Switching Property. One advantage that the IVI Switch Step has over the Step Switching property is the ability to find routes and determine whether the virtual device is debounced using the Get Information operation.
Figure 15: Get Information operation of the IVI Switch Step: Switch Executive Mode
Test developers can specify the same step properties available to the other built-in step types (e.g. Preconditions, Looping, etc.).
Note: You cannot use the Step Switching property with the IVI Switch Step type.
Additionally, the IVI Switch step has the advantage of being self documenting, as users can determine at a glance whether the test sequence involves switching. However, the Step Switching property is generally preferred over the IVI Switch Step. Use the documentation practices discussed in the previous section to create readable test sequences when using the Step Switching property.
The main disadvantage of the Switch Executive options in TestStand (Step Switching Property and IVI Switch Step) is that you do not have full access to the Switch Executive API (such as the ability to programmatically import/export Switch Executive configurations and generate XML reports). In order to develop test sequences with maximum customizability and expandability, use code modules which call the NI Switch Executive API.
IVI Switch Step Type: IVI Switching Mode
The IVI Switch step in IVI Switching mode gives access to the basic operations supported by the IVI Switch Class driver. For more information regarding the functionality available through the IVI Switch step in IVI Switching mode, refer to:
NI TestStand Help: Edit IVI Switch Step Dialog Box - IVI Switching Mode
The IVI Switching mode for the IVI Switch Step has its disadvantages. If your application employs multiple switches, you must use a unique step for every switch module. Therefore you cannot use this method to create complete routes across multiple switches. Also, creating a desired switching configuration requires the use of multiple steps. In general, controlling switches from code modules or the Switch Executive options is preferred over using the IVI Switch Step: IVI Switching mode.
Note: The instrument handles that TestStand IVI step types create cannot be used within code modules that execute using their respective development environment. The underlying C-based handle can only be used within the TestStand process. If your test sequence includes code modules which invoke IVI class and driver-specific VIs or functions, NI does not recommend using the TestStand IVI step types at the same time.