LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

scan backlog

Hello,
When I'm using Ai- C-Scan vi.
If i set the scan rate to let say 100 Hz, with a buffer of 1000 and 10 sample to number of scan to read.
If i understand it right, each iteration 100 scans insert into the buffer but i read only 10, so the scan backlog will be 90 and increace each iteration and data in the buffer will soon be overwrite.
Do i have to read All data that was scan each time, i mean does "Scan rate" must be equel to "number of scans to read"?
0 Kudos
Message 1 of 5
(2,990 Views)
Hi,
in a buffered acquisition you allocate a memory buffer in which the acquired data are directly stored at a rate (samples/second) you set by the scan rate.
The AI READ.VI reads a number of scans at once from the buffer and releases the space occupied for further acquired samples. Normally you read continously from the buffer (AI READ is in a while loop, therefore to avoid filling the buffer, the read rate must be higher than the write rate. Note that the read rate corresponds to the number of scans you read at each iteration multiplied the number of iterations/second.

In your example you have an acquisition at 100Hz, if you acquire only one channel, the buffer would fill after 10 seconds (when the buffer is full you get an error and the data will be overwr
itten). But as long as you are reading 10 samples at each loop iteration, if the while loop runs fast enough (more than 10 loops/second), you won't run-out of buffer space and the acquisition process will be stable.
You can check the scan-backlog, this is the number of scans remained in the buffer after each read operation. If during acquisition this value is stable or better tends to zero, you are reading at a rate fast enough.
If you see the scan-backlog increase continously, you have to increase the read rate by increasing the number of scan to read at each iteration.
Another nice trick you can see in the LV example Cont Acq&Chart (buffered).vi; as you see the scan-backlog is compared to the control Scans to read, the higher is connected to the input of the AI READ; this avoids buffer filling.
I hope I was clear enough, if not just ask.

Alberto
Message 2 of 5
(2,990 Views)
Hi,
Thanks for your answer, you were clear.
What I understand is that the stability of the acquisition depend also on the computer I'm using and how many task running parallel.

About the buffer, you mentioned that if I acquire only one channel.....
How the number of channels affects the time the buffer will be full.

Thanks.
0 Kudos
Message 3 of 5
(2,990 Views)
Hi again,
on this point I was not clear enough.
The buffer size is expressed as the number of scans the buffer can store; according to the number of channels to be acquired, the memory allocated for the buffer changes. But this does not affect the time the buffer will fill if you are not retriving data fast enough.
The difference is that if you are doing processing of the acquired data, a higher number of channels would take obvioulsy a longer time, this could increase the loop iteration time reducing the read rate.

Alberto
0 Kudos
Message 4 of 5
(2,990 Views)
thanks
0 Kudos
Message 5 of 5
(2,990 Views)