LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Averaging and Writing Data+Collection Speed

My research involves monitoring a sample's pressure and temperature. The labview program ASAP_base collects data,  displays a waveform of it in real-time and writes it to a LVM file. However the vi was cobbled together over 5 years and there are 3 main issues that have become too significant to ignore. My questions are:

 

1. Is there a way to control the averaging of the data? ASAP_base displays data every two seconds, while ASAP_10sec_revision shows a 10 second running average and ASAP_100 a 100 second running average. Can I make one program that has an averaging period as a real time control. My current method is to use shift registers, which is both unwieldy and means that we have several different programs for one job.

 

2. Can I control when the vi writes to the LVM file? Some of our experiments take days and I want the option of grabbing a chunk of data and shifting it for analysis, while still having labview running. A temporary solution I have found is to have the vi write to a succession of files but to change that requires stopping the program and going into the block diagram. Is there a real-time/more flexible way to control this?

 

3. Lastly, our data collection speed is problematic. The vi seems to be only updating every 1.5 seconds. Since this was inconsistent, i put in a "Wait" command set to 2 seconds so that our "labview time" would correspond to actual time. Why is data collection so slow and could we collect data much faster.

 

I would greatly appreciate help on any of these questions. Thanks in advance

Download All
0 Kudos
Message 1 of 2
(2,190 Views)

Sufun,

 

I'll do my best to answer your questions, as there are numerous items that you could look into for cleaning up your program and making it a bit more efficient.

 

1.) If you are looking for one overhead program that brings together the data found on each of the three VIs, you can simply create a VI that calls all three of your programs as SubVIs.  This essentially means that all three programs can run concurrently, but this created program runs over them and pulls data from all three of them.  For more information on how to utilize SubVIs effectively, please read into the following link:

 

http://www.ni.com/white-paper/7593/en

 

If what you are trying to do is take a moving running average of the data by condensing the three VIs into one, you could look into utilizing case structures to determine what values you keep for different moving averages.  Each case can essentially build an array of data that can be used for a separate moving average (if said average is going back further than your standard five point moving average that can be seen in ASAP_10sec_revision).  For more information on moving averages, please check out the following example:

 

http://zone.ni.com/devzone/cda/epd/p/id/82

 

Honestly, shift registers are the easist item to use here.  However, I would definitely look into using a compound arithmatic function as opposed to the separate addition functions.

 

2.) I would use a case structure to determine when you write to the measurement file.  You can use almost any input for this, but using a method such as this would be the best way to actually specify when you would actually write data to a measurement file.  For more information on case structures, please look here:

 

http://zone.ni.com/wv/app/doc/p/id/wv-2212

 

3.) There are a ton of options here to increase the speed of your program.  If you are running this on a Real-Time operating system (whether it be a cRIO, PXI controller, or RT PC), you could look into utilizing a Timed Loop structure to actually control the timing of your code's iterations.  More information on Timed Loops can be found here:

 

http://zone.ni.com/reference/en-XX/help/371361J-01/glang/timed_loop/

 

For more information on LabVIEW Real-Time in general, please check out this video:

 

http://zone.ni.com/wv/app/doc/p/id/wv-1349

 

If you are not using LabVIEW Real-Time, your options will be limited.  However, there are numerous components that you can fix in your code.  I would suggest looking into using reentrant VIs, or at least making some of the VIs you use as SubVIs reentrant.  Also, avoid the use of Express VIs, which may slow down your execution time because they load numerous functions that you are not using.  It is almost always more beneficial to code your algorithms or processes yourself as far as programmatic speed is concerned.  However, if you are satisfied with your Express VIs' performances, than this may be something that you're not interested in.  For more information on other items that you can try, please look here:

 

http://zone.ni.com/reference/en-XX/help/371361H-01/lvconcepts/vi_execution_speed/

 

Hopefully this is enough to get you moving in the right direction.  I would highly recommend reading through some of our data acquisition read-throughs to learn a bit more about the process.  If you'd like a good starting point, you can navigate to a lot of helpful resources via the following page:

 

http://www.ni.com/labview/applications/daq/

 

Thanks for posting on here, and good luck developing your application!

 

Regards,

 

Keith M.

Applications Engineer

0 Kudos
Message 2 of 2
(2,162 Views)