LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Improving performance

Solved!
Go to solution

I have this code that isn't keeping up with the data inputs and was wondering how I could optimize it.  Specifically, the NEU1 and NEU2 portions of the data frame are each 24 bytes that need to be handled quickly enough to keep up with the data stream.  Each frame comes in with a frequency of 950kHz, so each frame loop needs to finish in sometime less than 1ms.

 

I've only been using labview for a couple of weeks, so I don't really have a clue how to optimize the code.  I've attached the relevant vi and sub-vis in the NEU1 and NEU2 trees.  There is another interpolation sub-vi but I can only attach 3 files.  I may ask about this one later.  I have this problem even when I remove interpolation.  Any help would be appreciated.

Download All
0 Kudos
Message 1 of 5
(3,206 Views)
The first thing I would do is to separate your data acquisition from your data processing. Place the data acquisition in one loop and use queues to pass the data to a second parallel loop to actually process the data. You could further separate out the displaying of the data into a third parallel process if necessary. At the moment you effectively have all your eggs in one basket. You are trying to do everything in the same process. You can take a look at the producer/consumer examples to get a better feel for how this might look.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 5
(3,192 Views)

I've now done this and I still have the same problem. Its clear that the analysis loop isn't able to keep up with the data gathering loop because each update to the various plots gets a little bit slower. I've attached this new vi separating my data gathering from data analysis (which I was hoping to be able to do anyway, thanks).

 

I've also attached the last sub-vi in the critical path (the NEU signals).

Message Edited by was1984 on 10-01-2009 04:20 PM
Download All
0 Kudos
Message 3 of 5
(3,164 Views)
Solution
Accepted by was1984
Part of the problem may be that your For loop is using uninitialized shft registers for the arrays. Do you really want this? Perhaps you should initialize the shift registers each time you have new data. By using uninitialized shift registers your arrays are constantly growing. If you run this application long enough you will eventually consume all the memory. In addition, as the arrays grow in size your operations on them will get slower and slower because of the large size of the arrays.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 4 of 5
(3,154 Views)

If you are using say LV 2009 then you can use the Performance Monitor (under Tools - I think) to at least establish which VIs in your application are consuming the most time.  This will help you to pin-point the VIs you need to focus your effort on.

 

I can tell you from experience any of the little things you can do to optimise the performance such as disabling VI debugging will not help you.  As perviously suggested you need to address the architecture and/or the processing operations or logic.

 

In the case of UI the best way to improve performance is to use an Event structure.  In your case, since you're using DAQ, this will not help.

0 Kudos
Message 5 of 5
(3,140 Views)