Sending Notifications from LabVIEW to TestStand Sequences.
Overview
TestStand offers notifier objects to synchronize across multiple threads of execution. This example shows how to send notifications from LabVIEW to a TestStand Sequence to impact the flow of an executing sequence.
Downloads
Filename: sendnotifiertoteststand.zip
Requirements: View
Introduction:
TestStand offers notifier objects to synchronize across multiple threads of execution. These TestStand notifiers can be created, accessed, and controlled in LabVIEW using the Synchronization Server API. You may have a situation in which a developed LabVIEW routine has multiple stages that correspond to multiple stages of testing that needs to be done. This LabVIEW routine might need to "tell" the TestStand sequence when to proceed with testing.
The most simple solution to this problem is polling a variable in your TestStand sequence that is updated from LabVIEW using the TestStand - Set Property Value VI. There are many reasons this is a bad idea, the most obvious related to inefficiency. Polling is computationally expensive and can result in slowed execution or unexpected timing results. Using notifiers to control progress in LabVIEW and TestStand is robust, elegant, and recommended if your architecture requires it.
By way of example: you may have a LabVIEW module that controls the level of an output signal based on the external environment. That signal must achieve a certain level before moving on in the testing stages without stopping that control algorithm until the end of the entire testing sequence. The time it takes to satisfy successful testing conditions is likely indeterminate. Notifiers can be used to solve this problem efficiently.
Important Note:
In general, this is not a best practice for a testing architecture. The best practice is to keep TestStand in control of execution flow by keeping your modules highly cohesive. There are, however, times where this may be difficult to architect or require significant code rework to achieve and thus using notifiers to help control execution flow may be the best idea.
If the answer to the question, "What is the right way of doing this?" calls for communication between the executing testing sequence and other code in a different thread to control timing, then this example program is a good place to start understanding the concept.
Recommendations:
Making code modules thread-safe, and as cohesive and independent as possible will result in the most efficient use of system resources. Following this recommendation will help you see the largest gains in parallel testing and will help take full advantage of multicore systems.
When synchronous behavior is needed, synchronizing inside your TestStand sequence will help keep your modules as asynchronous as possible. TestStand has its own synchronization objects for coordinating the execution of multiple test sockets. In general, it is recommended to use these objects in your sequence alone as opposed to trying to synchronize the execution of multiple threads from within code modules.
Requirements
Filename: sendnotifiertoteststand.zip
Software Requirements
Application Software: LabVIEW Full Development System 7.1.1, NI TestStand Development System 4.0
Language(s): LabVIEW
Reader Comments | Submit a comment »
Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program 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 program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM 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/).
