12-04-2013 08:39 AM
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
Solved! Go to Solution.
12-04-2013 09:42 AM
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.
12-04-2013 10:36 AM
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
12-10-2013 09:43 AM
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
12-12-2013 07:06 AM
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.