LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to counter data skips while acquiring using LabView

"Dear enthusiasts:
I am using PCI-6031E measurement hardware and a self built LabView program to acquire data from a mp3 player. I am using AI configure, AI start and AI clear(Labview commands) in a loop so that buffer is cleared after each second(say). This is an improvement on its earlier version as it doesnot store the whole length of data in a buffer preventing crashes.But since I am configuring and starting data acquisition after each second, my data has skips at the beginning of each second. How do I modify my program to counter this. I am attaching a jpeg file to show the skip and the labview program."
0 Kudos
Message 1 of 2
(2,809 Views)
If I understand your concerns correctly, you would like to correct the issue of data "drop-out" i.e. periods of time durring which no data is recorded.

TO help correct this issue I will suggest a slight archtectual change that should help. But first let me interpret what you are trying to do.

For a fixed period of time, you would like to do a continuous acquisition. The acquired data should be ploted versus time. durring acquisition you would like to perform a power spectrum analysis for a user selected channel. All acquired data should be saved to disk.

What you are doing now is;
For a fixed period of time
{
Configure your I/O
Start your I/O
Read 1 seconds worth of data
display the data
extract the selected channel
Do power spectrum
save data to file
check if done with one update
clear the I/O
}

There are a number of things in this proccess that take more time to analyze than collect. THe long steps are causing the drop-outs. I also suspect there may be some errors being returned by the AI read. You may want to check these.

I would suggest using a different program structure. It could be divded into two parts.
1) Collect data loop
2) Analyze and save loop

Collect data loop
This loop should start up a continuous double buffered acquisition (see LV help). These types of acquistions start up and repeatedly perform two operations, a)Check backlog, b)Read backlog. The check backlog is accomplished be read "0" samples using AI read and getting the "backlog" value. This backlog is then wired into a second AI read to accomplish part "b" Read the backlog. Add a wait to this loop to amke sure you do not burn up all of the CPU.

The data read from the second AI read can pass all reading out via a queue. Queues are now pretty fast and will adapt to whatever data type you are using.

Aside from checking if is time to stop, that is all the "Collect data loop" does.

Anayze and save loop
This loop will continually read from queue the same way your exisiting code runs. It will not stop based on time only but whenever all of the data from the has been proccessed.

Your code should adapt to this structural change rather directly.

Create a queue pass it to both loops.
move you I/O stuf to a new loop that stuffs the queue
convert your exisiting loop to read from a queue instead of the I/O.
Done.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 2
(2,809 Views)