NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Use of Batch Synchronization??

Hello,
 
I am trying to run 2 steps at the same time.  Each step calls a subsequence.
 
I tried using the Batch Synchronization step before and after the 2 steps I am trying to execute at the same time (Enter, Exit).
 
I have the Section Type set to Parallel (All Threads Enter Simultaneously).
 
When I run the program, it still seems to run the first step first, and the second step second, in order.
 
Is this the proper use of the step Batch Synchronization?
 
B.W.
 
 
 
 
0 Kudos
Message 1 of 7
(5,792 Views)
Hi Big Will,
 
I'm afraid I misunderstand your issue.  Let's get straight on some terminology so I can help you better.
 
1-"2 steps at the same time" to me means that you have two different steps in your sequence but you want them to execute simultaneously and asynchronously of each other.   OR 
2- it could mean that you have one step and the batch model is set up to run two different testsockets which would create two different threads for the same step.  Then you want those two different threads to run at the same time.  OR
3-it could mean that you have 2 steps in a sequence that execute in order and for those two steps you want a synchronized section in which the steps get executed at the same time within each thread your batch process model spawns.  Which one do you mean?
 
First of all that is the incorrect usage of the Batch Synchronization step.  That step is for different threads of the same sequence.  So like your batch model will spawn 3 testsockets (threads) of the same sequence.  The synch sections are for synchronization among the threads.  Not for steps within a single thread. 
 
I'm attaching a small example of what I think you want.
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 7
(5,779 Views)

Hi jigg,

Thanks for responding.

Looking at your explanations 1, 2 and 3, I am not sure which explanation matches what I am trying to do.

In your example, it looks like the messages almost pop up at the same time, but I think the first one happens first, and the second one happens an instant later.

Whereas if you did not launch the first one in a new thread, the second one would not pop up until you click OK on the first one.

I want to run 2 steps synchronously, simulataneously, at the exact same time.

In my example, I want to set 2 different Analog Outputs at the same voltage at the same time.

If the first one is done first, it causes and error in the system and shuts it down.

I am attaching an example of what I am trying to do.  I would like the steps between the Batch Synchonization (Enter, Exit) steps to execute at the exact same time.

Your example may work, but I think it would execute the step to set the first AO then an instant later execute the step to set the second AO.

I would like both steps to start at the same moment in time.

B.W.

 

 

0 Kudos
Message 3 of 7
(5,761 Views)

Hi,

It sounds like you need to use the Synchronization Step Types.

Check out the example in <TestStand>\Examples\Synchronization.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 4 of 7
(5,750 Views)

What you want is going to be impossible using TestStand only.  Because you want to synchronize two pieces of hardware using software.  You cannot control the processor or the bus that you are communicating with your hardware on to synchronize from TestStand only.  No processor can truly multithread.  So how exact do you have to be?  Within 1 Second?  Within 1 micro second?  Within 1 nano second?  This will be a limitation of your hardware.

The closest you can get with TestStand is to use my example but throw in a rondezvous like Ray suggested.  I'll post an example of what I'm talking about.  If you don't know about Rondezvous' basically they just wait until all threads get to a certain point before moving on.

Let me know if that will work for you or if you have any questions.  Also, look at the examples Ray suggested to see some cool stuff with synchronization.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 5 of 7
(5,735 Views)
Hi jigg and Ray,
 
I tried the Rendevous steps as in the previous example, and got a Run-Time error.  I think the AO subsequences try to open the same database at the same time before setting the voltage.
 
I also tried to set it up like the previous example Flow Properties -New Thread, and got the Run-Time error.
 
Oh well, it was worth a try.
 
B.W.
 
 
0 Kudos
Message 6 of 7
(5,723 Views)
Hey B.W.,
 
What is the AO sequence doing?  Does it call some hardware through like LabVIEW or CVI steps?  You think this is a resource conflict error?  I'm assuming AO is for Analog Output.  If you are trying to write to the same pin at the same time from different threads then I can see this throwing an error.  However, if you have seperate pins and your device allows for multiple writes at the same time then I don't see this as a problem.  Unless both of your threads try to access the hardware at the same time and they aren't allowed to do so?
 
Give us a bit of info on your setup and what hardware, etc... you are using.  There may be a better way to do what you want.
 
Regards,
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 7 of 7
(5,721 Views)