LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Question on data acquisition, sampling speed and queue operation

Hello,

 

I have tried to use the DMA FIFO to pass the data, and my new block diagram is shown below. The size of the FPGA DMA FIFO is 1024 and in the host end I set the FIFO depth as 4096 and want to read 1000 data at a time.  

 

What I want to do is to put the DMA channel in a single loop, the math calculation in another loop, and pass the data to the TDMS file in a third loop. However, as the data output from the DMA channel is in the form of 1D array and it seems like I can not directly use the array to do the mathematical calculation in loop 3, I want to extract the elements in the array to do the math calculation and present them on the waveform. I use the 'index array' function, but I think it may only give me the first element of the array, right? But if it is not feasible, what should I do, or which function should I use without changing the function in loop 3?

 

Another problem I met is the loop and sampling time. I use loop 1 to measure the sampling time by measuring the number of iterations of loop 2 per second, multiplied by 1000 (as I set the number of elements as 1000 in the DMA channel). What I get is about 400k to 500k samples/s if I do not write data to the TDMS file in loop 4. If I enable the boolean button and write data to the TDMS file, the sampling rate increases to 1M Sample/s. Why is there such a difference?

 

When I observe the TDMS file, I found the speed is much slower than the sampling rate I measured. For example, I run the program and write to the TDMS file for 10 seconds, I only get less than 1000000 data, which means the data speed into the file is less than 100 K/s and it is much slower than the sampling rate. Is there anything that I did wrong in my program? If I keep writing to the TDMS file, it will finally show me an error indicating there is not enough memory. Is that because I read out of the queue too slow and the queue fills too fast? If it is, should I read finite number of data out of the queue at once and which function should I use to realize that?

 

XunZou_0-1644705632572.png

 

XunZou_1-1644705642562.png

 

 

0 Kudos
Message 1 of 6
(763 Views)

Hello,

 

I tried to pass the sampled data using the producer/consumer loop and write the data into a TDMS file. But it seems that the speed of data entering the queue is much faster than the speed of it read out of the queue, and I met the error indicating there is not enough memory if I write to the TDMS file for a while. So I want to read multiple data out of the queue at once (for example read 10000 data per iteration), but I do not know how to do it. What should I do, or which function should I use to I realize that?

 

0 Kudos
Message 2 of 6
(762 Views)

We can't really analyze blurry pictures. Please attach your VIs instead.

0 Kudos
Message 3 of 6
(742 Views)

Hello,

 

I am currently using a producer/ consumer loop and using the dequeue function to extract the element in the queue one by one. But the queue fills up quickly and there will be an error saying 'no enough memory'. Is there any method by which I can read multiple elements from the queue at once (for example, read 1000 elements each time)?  

0 Kudos
Message 4 of 6
(709 Views)

Hi altenbach,

Sorry about that but it is clear on my side. I will upload the VI as soon as I have the access to the computer.

0 Kudos
Message 5 of 6
(699 Views)

@XunZou wrote:

Hi altenbach,

Sorry about that but it is clear on my side. I will upload the VI as soon as I have the access to the computer.


The embedded pictures are only ~550x350 pixels and unreadable. I now noticed that the attached pictures are a bit better but still not suitable for debugging. (You have case structure where we cannot see what's in the other case, you have silly things such as turning a scalar into an array with one element for no really good reason. Your big loop is a greedy loop, spinning as fast as possible, mostly enqueueing the same one-element array as fast as the computer allows. Shouldn't that only spin when the "element" changes value? etc. etc. Shoudn't terminals have reasonable names? ("Element", Numeric", "Appended array 2" are NOT reasonable names. We cannot see the front panel, but LEDs ("SAVE") are typically indicators, not controls, etc.)

0 Kudos
Message 6 of 6
(669 Views)