From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to check if the number of data points in waveform chart correspomds to scanrate of DAQ

Hi, thanx in advance. I buffer old values (of 10 seconds, 200Hz; means 2000 datapoints )from a DAQ into a waveform chart which have to be written into a ASCII-File, if the actual value is not within the tolerance.
I use waveform chart because an array uses to much capacity. I changed the history-length of the waveform chart into 2000 datapoints.
Do these datapoints, shown in the waveform chart, correspond to the hardware-scanrate? When I run my VI and simulate a value to be out of tolerance before 10 seconds finishes, my file curiously saves 2000 datapoints.
Have a look at my VI for closer understanding.
Download All
0 Kudos
Message 1 of 2
(2,415 Views)
I suggest that you use two parallel loops--one for acquisition and one for processing. The acquisition loop should read its values to an array that slowly grows as the data comes it. If you set your number of scans to acquire to a fixed number, you can read n scans. This means you will know the ultimate size of the array and can create the array ahead of time filled with dummy values. As values come in, the subsections of the array can be replaced. This has the advantage of being fast because LabVIEW only has to allocate memory once and you can have a real copy of your data. 20000 samples at double precision (64 bit) is approx 160 kilobytes. This is a trivial size in modern computers. The array is then periodically passed to the data processing loop that
does the analysis. This way you can quickly scan through the entire array and remove chunks of data at once and not a piece at a time. If the data you want runs over the length of the array, you can flag that the data should be taken out from the next array to be processed. Since you know that each element of the array was recorded on the scan clock, you can calculate exactly when each sample was taken. You can then write the data collected to disk at one time like you already do. The method I suggest has the advantage of not slowing down the acquisition loop.

Jeremy Braden
National Instruments
0 Kudos
Message 2 of 2
(2,415 Views)