NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable sockets to call VI at the same time

Solved!
Go to solution

I have parallel model with 8 sockets. Each of sockets has VI called "Open_Excel_File.VI" that openes excel file and read/write data to it. If Any of 8 testsockets open VI at the same time, i get error that excel file is not available. 

 

How can I disable the same open/close of excel file in all 8 test sockets, so if one of sockets opens excel, others has to wait that excel is again availabe and then open it?

 

0 Kudos
Message 1 of 8
(2,505 Views)
Solution
Accepted by topic author Skoda3

For the step that is calling your VI click on Synchronization in the Properties tab.  Then check the Use Lock to Allow Only One Thread at a Time to Execute the Step.

 

This should fix it.

 

Cheers,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 2 of 8
(2,490 Views)

Hi Skoda3,

 

I guess you got your answer from jigg.

Kudos to him and mark as a solution to post! 🙂 Let's keep it clean here.

 

Regards,

Patrik
CTA, CLA
Helping (sharing) is caring!

If the post was helpful - Kudo it.
If the post answered your question - Mark it as Solution.
Message 3 of 8
(2,461 Views)

Thank you for your solution.  

 

What is difference between Selecting "Use Lock to Allow only One Thread at a Time to Execute the Step" and "Batch Synchronization -> Serial (one thread at a time)" ?

0 Kudos
Message 4 of 8
(2,416 Views)

Thank you for your solution.  

 

What is difference between Selecting "Use Lock to Allow only One Thread at a Time to Execute the Step" and "Batch Synchronization -> Serial (one thread at a time)" ?

0 Kudos
Message 5 of 8
(2,416 Views)

"Use Lock to Allow Only One Thread at a Time to Execute the Step"

  • The engine looks for the unique ID of the step and if any other steps with that unique ID are encountered it won't execute them until the lock is released (i.e. the locking step is done).  NOTE: If you put a name in the Lock Name it will use that instead of the step ID.  Using this you can put the lock on different steps if they share a resource
  • Ideal for use with parallel model

"Batch Synchronization"

  • Thread must belong to a batch
  • Ideal for use with batch process model
  • Waits for all sockets to reach that step before entering and executing step

 

Here is from the TestStand help:

https://zone.ni.com/reference/en-XX/help/370052W-01/tsref/infotopics/pane_step_settings_sync/

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 6 of 8
(2,398 Views)

Thanks again. But I have one more question.

 

I have PreUUT.seq defined like this:

if("TestSocket"==0){
 "Open_ExcelFile_And_Read/Write_To_it"
}
elseif("TestSocket"==1){
"Open_ExcelFile_And_Read/Write_To_it"
}
elseif("TestSocket"==2){
"Open_ExcelFile_And_Read/Write_To_it"
}
elseif("TestSocket"==3){
"Open_ExcelFile_And_Read/Write_To_it"
}

Soo any case belongs to socket number and all cases are in one sequence (PreUUT.seq).

My question:

If I want each of the socket to wait for excel file to be free for use (that it is not used by other socket) the only think that I have to do is to check "Use Lock to Allow Only One Thread at a Time to Execute the Step" at all four VI Calls of "Open_ExcelFile_And_Read/Write" ? Or do I have to define "Lock Name of Reference expression" and pass it to all four VI Calls of "Open_ExcelFile_And_Read/Write"?

 

 

0 Kudos
Message 7 of 8
(2,377 Views)
Solution
Accepted by topic author Skoda3

Just define a lock name and it should be fine.  Like the help says "NOTE: If you put a name in the Lock Name it will use that instead of the step ID.  Using this you can put the lock on different steps if they share a resource"

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 8 of 8
(2,327 Views)