LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

two parallel DAQ while loop, one always getting slow when parallel running

Solved!
Go to solution

I have two parallel while loop for DAQ.

While loop 1 for reading SR830 Lock-In with "FAST2" -128Hz method through GPIB.

While loop 2 for reading current from a device  through TCP/IP.

 

Only while loop 1 running, reading SR830 speed is 128 points per second.

Only while loop 2 running, reading current speed is around 200  points per second.

 

When these two while loops run  parallel,  while loop 1 keeps the same reading speed (128p/s), while loop 2 gets slow er and slower (from ~40p/s down to 12p/s after 1000s continuously running).

 

I tried having 1ms delay or have no delay in both loops, almost the same results. How to increase the while loop 2 speed up to 100p/s at least when parallel running?

 

LV2013sp1, Win7 pro 32bit

WT

0 Kudos
Message 1 of 23
(4,111 Views)

Can you please post some code? It might just be some small detail that is not contained in your description.

What is done with the data once it is read?

0 Kudos
Message 2 of 23
(4,073 Views)

And when you post code, post your VI, not a "picture" of it.  We can't edit, inspect, test, or modify a picture easily (unless you know how to create a LabVIEW Snippet ...).  Note that if you have several VIs, compress the folder that includes them (and the LabVIEW Project file, which I hope you are using) and attach the resulting .zip file.

 

Bob Schor

0 Kudos
Message 3 of 23
(4,047 Views)

Please unzip the files, and open the VI file:

E:\2 while loop for post\E\MFHF_Acquisition\MFHF Acquisition - ver 0.7d-temp.vi

 

Thanks.

 

LV2013

WT

0 Kudos
Message 4 of 23
(4,026 Views)

Here are some (urgent!) Code Suggestions:

  • Create a LabVIEW Project to hold your code!
  • Instead of using Frame Sequences (which 99% of the VIs you write don't need), use the Error Line to serialize Data Flow into and out of Loop Structures.  You may have noticed that almost all functions from NI have Error In and Error Out at the lower outside corners -- they are there for a reason, and should (almost always) be used.

Is Loop 2 (the TCP/IP Loop) the one at the top of your code, with VIs Open Device and Get Current?  You said that, by itself, it runs at 200 Hz, but if Loop 1 is also running, it is much slower.  It sounds as though Loop 1 is "interfering" with the functioning of Loop 2.  I notice in Loop 1 you have a Read of 1000 characters.  This is standard "Good Practice" for VISA Reads where you expect a short string of unknown length + a termination character -- is this how your GPIB is configured?  Could it be that it is "stalling" trying to read 1000 characters and is taking too many cycles away from the TCP/IP loop?

 

Bob Schor

0 Kudos
Message 5 of 23
(4,005 Views)

Thanks for your points.

 

Today I have found some clues. If I disable the XY graph (leaving the two charts work),  the while loop 2 keeps reading speed around 190p/s.

I don't know why the XY graph bothers while loop 2.

 

LV2013sp1

WT

0 Kudos
Message 6 of 23
(3,978 Views)

The Call Library node in Get Current is set to run in UI thread so it'll interfere with redrawing.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 23
(3,974 Views)

Thanks for your comments!

I checked the configuration of the Call Library node in Get Current and it was "Run any thread". How can I solve this problem?

call library node-configuration.PNG

LV2013sp1

WT

 

0 Kudos
Message 8 of 23
(3,970 Views)

If that is true (???) then you should make sure the calling VI is not marked to run in the UI thread

AND

Ensure there are no property nodes involved in the second loop.

 

Property nodes often run in the UI thread.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 23
(3,962 Views)

How to check "the calling VI is not marked to run in the UI thread"?

As for property nodes, I checked, no one are involved in the second loop.

Thanks.

 

LV2013sp1

WT

0 Kudos
Message 10 of 23
(3,957 Views)