NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Use the same code module for several steps in the sequence

Solved!
Go to solution

Hello All,

 

  I have been trying to set up a sequence that uses the same code module for all of the steps in the sequence, but am having trouble referring back to it when I need to send it commands.  I have gotten as far as calling the VI in a new thread so that it can be run asynchronously.  I can run the simple sequence and it will indeed open the VI, and move on to the next step.  When I close the VI manually from the front panel, the sequence in TestStand completes, as expected.  So it appears that I have that much working. 

 

  My question is how to call the separate thread from the main sequence or other sub sequences when I need to edit the parameters.  If I insert an Action step, I am required to select a VI file, but from what I can tell, it opens a different instance of the file, and does not provide an interface with the other instance running asycronously.  My next guess was to use a Statement step, but I was not able to figure out how to configure the lookup string to call the VI parameters.  Beyond that, I'm not sure how to proceed.  Please advise.   

 

  My intention is to start the code module VI (asynchronously), run several different subsequences within the main sequence that call that same VI and edit it's parameters, close everything and report on the results.  If I am misunderstanding how TestStand is supposed to work, please let me know. 

 

Thanks,

GSinMN    

0 Kudos
Message 1 of 5
(4,119 Views)
Solution
Accepted by topic author GSinMN

What I do is use a Queue to send data to the asynchronous VI.  So it can run and do whatever, but also recieve the commands from the queue.  I use an Action Engine that holds the queue reference and sends the commands.  So you really just have to call the Action Engine from your sequences.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 5
(4,116 Views)

Hello crossrulz,

 

  Thanks for the quick response.  I started checking help files and examples related to queues, and encountered the following statement: "You can use a Queue step to pass data between threads or across executions while avoiding race conditions".  Exactly what I needed.

 

Thanks again,

GSinMN 

 

0 Kudos
Message 3 of 5
(4,111 Views)

Hello again,

 

  I've been reading through the help files, examples and other discussion posts related to queues and parallel threads, and I have been seeing some conflicting information, so I thought I would check back for some clarification.

 

1. When you setup a queue to pass data across threads, do you only create the queue once, or do you create it in both sequences with the same name for each?

 

2. Does the dequeue function need to be in a loop, as with Labview, or does test stand automatically poll the queue continuously?

 

3. Does the data still need to be passed across the thread as a parameter (as when not using a queue), or can it be passed as a variable?

 

Thanks again for the extra help.

 

GSinMN

 

 

0 Kudos
Message 4 of 5
(4,055 Views)

Hi GSinMN,

 

You may want to check out this Community Nugget post on Action Engines, it is an excellent resource for the implementation of AEs in LabVIEW.

Evan See
National Instruments
0 Kudos
Message 5 of 5
(4,019 Views)