LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

async call to initialize equipment

I have a bunch of oscilloscopes and several are in a chassis.  Thier initialization takes forever.  I was hoping to start them all initializing at once with the async call and collect methodology.  I am using the IVIScope initialize function to perform the initialization.  I created a wrapper vi for this and I use the "start Async Call" in a for loop to initiate them all and then wait on them wit the "Wait on Async Call" to collect all the data.  I am passing options 0x100 and 0x40 to allow for parallel running and collecting.  The scopes do a lot of clicking and flashing when they initialize so it is easy to see which one is working.  The code works, but they still only operate in serial, one at a time.  Why is this not working?

 

I have parallelism turned on the for loop and I set the option on the called vi to reentrant execution.

 

0 Kudos
Message 1 of 6
(3,888 Views)

When you feel sick and go to the doctor, do you just give him a picture of yourself and say "What's wrong, doc?"?  If your VI isn't doing what you expect (possibly because some setting somewhere is not quite right), do you think showing us a picture is the best way for us to help you?

 

I think we need to see the actual code (meaning the VI itself) that launches the Scope Initialization sub-VI, and the Scope Initialization sub-VI, as well.  How do you specify individual scopes?  [I see a "scopes" string array, but don't know what it should contain).

 

Bob Schor

 

P.S. -- do you know if IVIScope Initialize is reentrant, or can be made reentrant?

0 Kudos
Message 2 of 6
(3,874 Views)

Well I did not go posting a ton of pictures because there is really nothing to see.  As i stated this code is calling my VI which simply calls "IVIScope initialize".  That vi calls "IVIScope Initialize with options".  that vi calls a DLL.  Pretty standard for all IVI drivers.  The "Scopes" array shown in the picture is of course just passing in logical names for each scope.  I did not think that needed explaination.  I was worried about the reentrant ability of the IVIScope VIs.  I was hoping they would take on the parent callers settings, but I did change them to reentrant as well and that did not help.  Perhaps the DLL call is blocking the ability?

 

I was really looking for a much broader response to know if it is even possible to call IVI functions in this maner.  Has anyone ever done it?

0 Kudos
Message 3 of 6
(3,864 Views)

@Muffin wrote:

Well I did not go posting a ton of pictures because there is really nothing to see.  As i stated this code is calling my VI which simply calls "IVIScope initialize".  That vi calls "IVIScope Initialize with options".  that vi calls a DLL.  Pretty standard for all IVI drivers.  The "Scopes" array shown in the picture is of course just passing in logical names for each scope.  I did not think that needed explaination.  I was worried about the reentrant ability of the IVIScope VIs.  I was hoping they would take on the parent callers settings, but I did change them to reentrant as well and that did not help.  Perhaps the DLL call is blocking the ability?

 

I was really looking for a much broader response to know if it is even possible to call IVI functions in this maner.  Has anyone ever done it?


Its possible the dll is blocking multiple thread access simultaneously. You could tell by setting a break-point at each dll call and see whether execution is sitting there for each scope call. Also - what mode is the IV dll call set to? Run in any system or run only in the UI execution system? There is only one thread in the UI execution system; this feature is utilised by some Win32 dll calls in VIs to enforce single thread access.

 

Note that even if the dll call can run in the VI host execution system (rather than forced to the UI thread) each execution system has a limited number of threads available (unless you edit the configuration) and the dll calls will be blocking, consuming each thread.

0 Kudos
Message 4 of 6
(3,852 Views)

The DLL is set to "Run in any thread'

0 Kudos
Message 5 of 6
(3,848 Views)

subVIs of the reentrant VI also should be reentrant to run in parallel.

I would first try to make it parallel manually - put 2-3 initialization VIs in parallel. Determine which subVI forces sequential execution.

 

One more thing, check visa read mode in the initialization (more details in VISA read help).

Right-click the node and select Synchronous I/O Mode»Synchronous from the shortcut menu to read data synchronously. 

 

Also technically you do not need to open by reference - you are waiting for all instances to finish anyway. In parallelized loop it should open new instance of reentrant subVI for every iteration.

 

0 Kudos
Message 6 of 6
(3,829 Views)