Using Microsoft Excel and NI Switch Executive in Test System Development

Publish Date: Apr 02, 2013 | 10 Ratings | 3.50 out of 5 |  PDF


Every automated test system involves some aspect of switching or signal routing. This implementation can span from simple general-purpose relays that control power to a device under test (DUT) all the way to complex matrix configurations that route thousands of test points to dozens of instruments. When the number of relays to control is small, the test code required to control them is straight-forward. When the number of relays and routes enters double-digits or spans multiple switch modules, it becomes advantageous to use some kind of routing database to manage the switch connections.

Typically, customers have chosen either a spreadsheet like Microsoft Excel to handle these routes or used a switch-specific application like NI Switch Executive switch management software. Both methods accomplish the desired task of serving as a “look-up” table for switch routes, but Switch Executive also includes validation, documentation, debugging capabilities, and integration with LabVIEW, LabWindows/CVI, and TestStand for simplified calls to the routing engine. In the past, it was necessary to either choose Switch Executive or Excel to handle the routing, making it difficult for customers who were more comfortable with Excel or had existing route diagrams in Excel to upgrade to the capability of Switch Executive. Starting with Switch Executive 2.1, it is now very simple to integrate the native capabilities of Switch Executive and the spreadsheet functionality of Microsoft Excel (or any other spreadsheet/database). The following document describes the procedure for accomplishing this task and simplifying your automated test code.

Table of Contents

  1. Background on NI Switch Executive
  2. Combination of NI Switch Executive with Microsoft Excel
  3. Why is the Excel Import Capability Helpful?
  4. Simplified Switch Programming with NI Switch Executive
  5. Conclusion

1. Background on NI Switch Executive

NI Switch Executive is an intelligent switch management and routing application. With NI Switch Executive, you gain increased development productivity by interactively configuring and naming switch modules, external connections, and signal routes. You also increase test code reuse and system performance with switch programming in conjunction with National Instruments TestStand, LabVIEW, LabWindows/CVI, and Measurement Studio. Ultimately, NI Switch Executive simplifies switch system configuration and increases test performance, thus lowering your cost to test. It does this through the following features:

Intuitive Configuration Environment
NI Switch Executive has an intuitive configuration environment in which you can create Switch Executive "Virtual Devices". You use the Switch Executive Virtual Device configurations to combine a variety of IVI-compliant NI and third-party switches to create a single virtual switch device. For each switch module, you can specify:

  • Desired channels
  • Hardwires
  • Routes/Route groups
  • Physical attributes

Using NI Switch Executive, you can store the physical attributes associated with each switch configuration and intelligently use the information to help you determine proper switch routes. This helps you protect the large investment in switch hardware from being overdriven or routing a high-frequency signal across a low-frequency switch device.

Rapid Channel Configuration
NI Switch Executive rapid application configuration environment also includes tools for configuring the channels used in complex switching systems. With this, you can create alias names and add unique comments for each channel -- greatly simplifying the management of hundreds or thousands of switch channels in large switch systems because you can refer to a channel as "DMM" or "Scope" instead of "c0" or "c2". You can also take advantage of the channel alias feature when using multiple switch devices.

Easily Connect Channels to Form Routes
Once you have configured all of the required channels, NI Switch Executive provides an interactive utility to assist you in connecting pairs of channels to form routes. With this utility, you simply select two channels to be connected from the list of alias channel names or full channel names and then NI Switch Executive recommends an available route based on the previous specified channel and hardwire information.

The NI Platform
NI Switch Executive integrates perfectly in the complete NI integrated test architecture for a much improved development experience when building ATE test systems. For instance, you can easily integrate NI Switch Executive within the NI TestStand test management environment for controlling your switches on a per test basis. You can also use NI Switch Executive to easily program your switches within individual test modules written in the popular test languages, such as NI LabVIEW, NI LabWindows/CVI, and NI Measurement Studio for Visual Studio.

System Maintenance
Lastly, automated switch systems are far easier to maintain through the use of NI Switch Executive. The interactive and easy-to-use configuration environment makes it easy to quickly change your switch routes and hardware to reflect changes in the product. Because NI Switch Executive takes advantage of the Interchangeable Virtual Instruments (IVI) standard, you can quickly interchange your IVI-compliant switch hardware with another version of the switch or a switch from a different vendor without having to rewrite any of your test code (assuming you are using IVI Switch Class Driver functions).

Back to Top

2. Combination of NI Switch Executive with Microsoft Excel

Before NI Switch Executive 2.1, there was no option to incorporate pre-existing Excel route maps into a Switch Executive Virtual Device. With the new NI Switch Executive Configuration API, every “behind-the-scenes” function of Switch Executive is exposed to the user so applications or (in the case of Excel) macros can be written to translate configurations in the Switch Executive routing engine. 

Figure 1: Example view of generated Excel sheet from a Switch Executive virtual device. The tabs in the Excel sheet match up with the tabs found in Switch Executive.

The virtual device name is listed in cell A1 of each tab. The information for the IVI device, channel aliases, exclusions, hardwires, buses, routes, and route groups are then displayed on each tab. This is often an easier way to look at the entire virtual device than through the Switch Executive route editor. Although Switch Executive has a “generate report” feature of its own, some engineers feel more comfortable with the spreadsheet layout and printing options. In this case, generating an Excel report of an existing virtual device can be very useful.

Back to Top

3. Why is the Excel Import Capability Helpful?

The ability to import configurations from Microsoft Excel into Switch Executive offers several advantages to the ATE system designer. First, it allows existing Excel routing diagrams to be leveraged; there is no need to scrap existing work to use the Switch Executive environment. Second, the “click-and-drag” capability of Excel makes it easy to create hundreds or thousands of aliases, routes, hardwires, etc. based on a parent name. In other words, if you create DUT1 in your first cell, DUT2 in the second cell, then highlight and drag those items to a new cell, the number at the end of DUT will be incremented. While the Switch Executive environment has a method for batch renaming of channel aliases, it can save time in creating a large number of routes.

Figure 5: Example of consecutive naming capability in Microsoft Excel. When aliases or route names are formed from a parent like "LED_", it is easy to "click and drag" in Excel to create numerically ordered names.

These advantages allow the user to take advantage of Switch Executive’s greater ease-of-use when it comes to communicating with switch hardware or deploying systems in the first place. The hardware abstraction, route grouping, and deployment capability of Switch Executive offer gains in system longevity and reduced programming complexity in ATE systems.

Back to Top

4. Simplified Switch Programming with NI Switch Executive

Once the virtual device is complete, you can use the Switch Executive API available for LabVIEW, LabWindows/CVI, or Visual Studio to call the routes or route groups you’ve created. An example of the LabVIEW code is shown below. The “what to connect” control represents the location of the route or route group to close. For a system requiring dozens of relays to close in every test step, making a single call to the switch hardware is often much easier and maintainable than closing each relay individually.

Figure 6: Screenshot of Switch Executive API in NI LabVIEW.

For systems programmed in NI TestStand, each switch command can be embedded into the property of the test step. The switch programming in these situations is relegated to simply checking the “enable switching” box and then choosing the appropriate virtual device, route/route group, and then selecting the duration of the closure. This method completely separates switch code from the individual test code modules in an ATE system. As switching hardware changes in the future, your instrumentation test code can stay the same in this manner.

Figure 7: Screenshots of NI TestStand sequence editor and step property information. The "switching" tab in the step property allows you to configure all the switching information for a given step without writing a line of code.

Back to Top

5. Conclusion

As the complexity of ATE systems grows, the complexity of the switching inside these systems will likely grow at an even faster rate. Using tools like Switch Executive and Microsoft Excel can make managing switch routes much easier and make the system much more adaptable to future test needs. The ability to integrate pre-existing Excel route maps or use Excel as a compliment to route creation in Switch Executive combines the best of both worlds for an ATE system designer.

Related Links

Products and Services: NI Switch Executive
Developer Zone Tutorial: What's New in NI Switch Executive
Developer Zone Demo: Accelerating Development and Simplifying Maintenance with NI Switch Executive 
Guides to Getting Started: Test Systems

Back to Top

Bookmark & Share


Rate this document

Answered Your Question?
Yes No