LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Asynchronous call still slowing down main VI

Solved!
Go to solution

Hi!

 

I currently have a "main VI" running quick processes, and I have a subVI which is essentially a device collecting data. However, this subVI runs at 1 Hz, while my main VI runs much faster.

 

I have created an asynchronous call for this subVI, and set it such that the main does not expect any incoming data. I followed these very simple instructions: http://zone.ni.com/reference/en-XX/help/371361L-01/lvhowto/acbr_call_and_forget/

 

However, when I run this, my main VI is as slow as if I didn't use an asynchronous call. For your information, the only node inside my main while loop is the "Start Asynchronous Call" node.

 

Is there something I am missing on how running this subVI without slowing down my main VI?

 

Thank you very much!

0 Kudos
Message 1 of 10
(5,380 Views)
You should show your project first of all. It is impossible to help without seeing your code... I hope you do not call the subVI at every iteration? 🙂
0 Kudos
Message 2 of 10
(5,374 Views)

Are you calling "start asynchronous call" once or with every iteration of the loop?

How fast is "much faster"? How do you measure the loop rate?

0 Kudos
Message 3 of 10
(5,359 Views)

Sure!

 

See below. The "Start Asynchronous call" node is inside the loop since I believe it is needed to make calls to the subvi at every iteration, otherwise the subvi state shows as "subVI waiting to run" and doesn't do anything.

 

Thanks!

Download All
0 Kudos
Message 4 of 10
(5,356 Views)

can you attach the subVI instead? Does it complete quickly?

0 Kudos
Message 5 of 10
(5,352 Views)

See below for the subVI.

 

It is basically interfacing with a Thermocouple reader (Pico tc08). It works, but takes a second or so collecting the voltage of every thermocouple attached to it. Even when I get rid of the signal part and only replace it with indicators, there is no difference in the execution time.

 

For now I am just focusing on getting my main VI running without being slowed down by this subVI.

0 Kudos
Message 6 of 10
(5,343 Views)

The subVI seems to be running on it's own (unless there is an error or stop is pressed), so there is no need to call it over and over again.

 

(Are you aware that stacked sequences with sequence locals are an indication of poor coding skills? Do you know that index array is resizable? Do you know that you can chart without using dynamic data? Your "close&exit" button does not seem to work as you expect)

0 Kudos
Message 7 of 10
(5,334 Views)
Solution
Accepted by olamarre

I would guess your main issue is the DLL calls are set to run in the UI thread.  This could keep your main VI from updating until that DLL call is complete.  Try setting them to "Run in any thread".

 

Also, you do not need to keep telling this VI to run over and over again.  It just needs called once.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 10
(5,326 Views)

The subVI node was retrieved from another source and is a bit hard to work with, I agree. The previous VIs posted were just an illustration of the issue I am running into. The ones posted below are the actual VIs (main and subvi of concern) I am working with right now.

 

Hopefully you can see the asynchronous call in the main one, same format as the examples posted above. The subvi was modified (signals removed, while loop removed, stop signal managed by a functional global variable). I'm unfortunately not proficient enough in LabVIEW to modify this subVI properly to make the process faster, hence the need of an asynchronous call.

 

But that returns to the same initial problem: regardless of the subVI or how it is coded, why is my main VI slowed down by this subVI, despite of the asynchronous call? I thought an asynchronous call would make these two loops run independently from each other.

 

Thanks again!

Download All
0 Kudos
Message 9 of 10
(5,316 Views)

@crossrulz wrote:

I would guess your main issue is the DLL calls are set to run in the UI thread.  This could keep your main VI from updating until that DLL call is complete.  Try setting them to "Run in any thread".

 

Also, you do not need to keep telling this VI to run over and over again.  It just needs called once.


Yep, it is very likely, I had also some trouble before with a DLL ( link ), after setting the dll call to "run in any thread" fixed the GUI speed issue...

 

 

0 Kudos
Message 10 of 10
(5,308 Views)