NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run teststand and the vi called by one of its steps at the same time

The function I want to achieve: a window is always displayed during the program running, and the data in this window will be refreshed in real time during the running process.
The method I thought of: insert a vi in ​​a certain step in teststand, call vi when running here, keep vi running in the background, and teststand continues to execute the subsequent steps.
My question: 1. Can teststand realize that vi and teststand program of a certain step can be run at the same time, instead of having to finish vi in ​​this step before continuing to execute the subsequent steps
2. What kind of program structure is needed to achieve this function

0 Kudos
Message 1 of 6
(537 Views)

There are several ways to achieve something like this.

 

Is "the VI" to be used as an Operator Interface?

 

Starting a VI to be run in the background is one thing, how do you plan to stop it?

 

I'd like to understand your UseCase a bit better, before throwing options at you 😉

 

0 Kudos
Message 2 of 6
(500 Views)

Hello Oli Wachno,

Thanks for your reply. Regarding your questions:

  1. "The vi" in this case refers to a program VI (used as an Action step in TestStand), not the "Operator Interface". However, if the "Operator Interface" can solve this issue, that would also be acceptable.
  2. I hope it will stop when the TestStand sequence stops.

 

 

 

 

 

0 Kudos
Message 3 of 6
(494 Views)

I'd suggest to set up the VI as an DQMH module. 

 

It enables you to start and stop the module with a simple VI call (Action Step) from anywhere within the sequence. And you can create a nice API to enable easy communication between TestStand and the module.

 

Also check out  Cyrils Video 

https://youtu.be/gSErNHAn_HY?feature=shared

 

 

0 Kudos
Message 4 of 6
(475 Views)

As Oli mentioned, there are several ways to achieve this. I suggest two native methods for TestStand: the "Run VI Asynchronously" step and the "Sequence Call" step with the Execution Option "Use New Thread". Additionally, custom solutions can be considered, such as using synchronization mechanisms native to LabVIEW (e.g., as recommended by Oli) or those native to TestStand. There is a ready-made wrapper for SyncManager available here.

 

Run VI Asynchronously Step: This method seems best suited for your case. It will launch a VI asynchronously (creating a new subsequence call under the hood and running it in a new thread) and, depending on the configuration, can use the caller context or create a new one. See more details here. When using the caller context, you can share variables between threads. However, this approach requires additional synchronization mechanisms (under the hood), which might impact performance. It is recommended to use a new context and store a reference to the new thread in a variable. This way, you can control the new thread using the API (e.g., you can terminate it if needed). See examples here and here.

 

Sequence Call Step (Use New Thread): This method is similar to the previous one but involves calling a subsequence in a new thread instead of a VI (although in the previous method, this also happens under the hood). In this method, it is best to store a reference to the new thread in a variable, allowing you to control it using the API. More details can be found here and here.

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 5 of 6
(453 Views)

Try:

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 6 of 6
(452 Views)