NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TestStand variables scope for parallel and batch model

Solved!
Go to solution

Dear TestStand community!

 

I have the following problem.

 

I use the batch model. In ProcessSetup callback I initialize hardware references, and write them to FileGlobals.

 

But, when sequence is entered to MainSequence callback, and two threads start, FileGlobals are empty (I used Breakpoint and debugging tools to verify it).

 

Does it mean, that FileGlobals for Batch model have some another scope? That before MainSequence callback there is one scope of these variables, and after test sockets are initialized, new scope appears.

And, in parallel model parallel threads share same FileGlobals. But, in Batch model, it seems, that each thread have its own FileGlobals scope. Is it so, please?

 

Thanks in advance!

0 Kudos
Message 1 of 2
(5,182 Views)
Solution
Accepted by topic author kosist90

Hi,

I could elaborate but there is a greate paper here:

http://digital.ni.com/public.nsf/allkb/2F2CEB590F22BC07862575F4007478D1

 

Hope that awnser your question.

 

And for future reference if the link is broken a raw past:

Why Don’t my File Globals Share Information Between UUTs in the Batch Model?

 



Primary Software:
Primary Software Version: 4.2.1
Primary Software Fixed Version: N/A
Secondary Software: N/A


Problem:
When executing my sequence under the Batch UUT process model, I update a File Global Variable from one UUT in the batch, but the other UUTs do not see the update.  It is as if each UUT has its own separate File Global. Why is this happening?

Solution:
This is expected behavior because each UUT in the batch does, in fact, have its own separate copy of the file global variable by default.  This is because each UUT in the batch has its own execution, and by default, sequence files do not share file globals between executions.  So if you have a sequence file with a file global named FileGlobals.Global1, and run your sequence under the batch model with 3 UUTs, then there will be three separate copies of FileGlobals.Global1 opened in memory, one for each UUT.

 

If you want, you can override this behavior by following the instructions in KB29TEE5IJ: How Do I Share Data Stored in a File Global Between Different Executions?.  This will force all executions (UUTs) in a batch model to look to one memory space for the file global and not create a separate memory space for each UUT in the batch. 

If you do not wish to make the scope of your file global open to all UUT executions but still wish to share data between executions, consider the use of queues, notifications, or station global variables.



Related Links:
KnowledgeBase 29TEE5IJ: How Do I Share Data Stored in a File Global Between Different Executions?
KnowledgeBase 3VNGIHDR: Programmatically Creating Variables in TestStand?

Attachments:
pic1.jpg


Message 2 of 2
(5,175 Views)