12-06-2016 01:14 PM
In the "setup group" of my main sequence I'd like to call a subsequence in a new thread which continuously polls for communication to the Unit Under Test (UUT) every 5 seconds. In parallel, I'd like to have the main sequence to continue running steps in the "main group."
Test sequence handling:
1. If the new thread subsequence detects a communication error, I'd like the subsequence to tell the main sequence to stop immediately and then run the main sequence's "cleanup group."
2. If the main sequence comes upon a step where the UUT needs to be communicated with, I'd like the main sequence to tell the new thread subsequence to stop, then have the main sequence step communicate with it, and then tell the subsequence to begin polling again.
What is the most efficient way to do this? Thanks so much for everyone's help!
12-06-2016 03:29 PM
I have done this before this way
so you launch the subsequence on a new thread. You will communicate between threads with at notifier
on the new thread running parallel Do a While loop to poll data from whatever you want to validate.. if it fails you send a notifier to the main sequence and then set a flag to exit the loop
12-07-2016 10:20 AM
Buton,
Thanks for the reply. That makes sense in creating a notification and then waiting for the notification to get set to exit.
What I want to do is:
1. Create a New Communcation Poll Thread
2. Continue Running Main Sequence Thread at the same time
3. If the Communcation Poll Thread Fails, I want it to notify the main sequence immediately to shutdown. What is the best way to do this?
Thanks for your help.
12-07-2016 10:45 AM
Are you going to be looping on the main sequene all the time? or it will execute and exit ?
12-07-2016 11:19 AM - edited 12-07-2016 11:19 AM
Had an idea
what if you place a SequenceFilePostStep Callback and there you check the notification and in case it activates you jump to cleanup or RunState.Execution.Terminate() to terminate and it will force teststand to run cleanup step.
that way after each step is executed it will check for that flag
12-07-2016 03:13 PM
I will not be looping in the main sequence. Within the main sequence, I plan on starting the new thread with the polling and shutting it down in the main sequence in the cleanup section (after all the main sequence steps finish).
The PostStep Call Back would be great but this polling is only specific for certain DUTs and not all DUTs to be tested.
01-21-2017
10:57 AM
- last edited on
10-20-2024
06:06 PM
by
Content Cleaner
Hello,
I found this rather interesting, I've included some documentation below. Based on my research I would suggest to as mentioned, use sequence call to call a subsequence or other sequence file to run in a new thread or execution. Depending on how you would like your thread to operate, is whether to select a new thread of execution. I have included some documentation on setting this up, selecting the execution type and also on the wait settings:
1. https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YILtCAO&l=en-US
4. https://forums.ni.com/t5/NI-TestStand/How-to-Stop-Thread-Within-TestStand/td-p/1137385
The next step is how to efficiently communicate between the two, as mentioned in the thread above you can pass a parameter by reference to use in pre-expressions or use notification. I would recommend a parameter by reference, you could pass two, one is the HaltMain boolean and another is HaltThread boolean.
The Main will set HaltThread which the new thread can check in pre-expressions for steps and potentially move to a subsequence which will the run the synchronization step to wait on a notification from the Main sequence to return. I have included some documentation which refers to an example on the wait on notification step:
Best regards,
Ed