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: 

doing a moving avarage over 6 min with a sampling rate of 25 us using queues or array???

No a buffer is just an array.  As for the performint the calculation in different loops, you can do this but is it necessary?  Each itteration has to complete in 25us to be done in realtime, this should be possible, there is not alot of calculations going on here.  if there is a timeout issue, bacause you are not reading the data fast enough, you could go with a producer consumer architecture, where the data is read from the dma and passed to the consumer loop which does the processing, and a queue would be a good method for this.  I do this with daq all the time, read and queue up data in one loop, and process it in the consumer loop.  This is why you run into a timeout. 

 

So producer loop is simply read dma and queue data, consumer loop, is dequeue data and process (cascade mentioned earlier).  The process loop will only run as fase as data is sent to it and should not mess with the dma loop.

 

The only thing to keep in mind is if the processor is slower than the acquisition loop (DMA Reads) which should be reading 32KSamples/second.  A PC should be able to keep up with this data load.

 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 11 of 13
(470 Views)

Hi Paul,

 

thank you for your advice  using a producer Loop and a consumer loop. But this was infact my idea. If you look at the first example which I posted you will see that I have two loops.The two loops communicate using a queue.The first reads the DMA Fifi does some corrections of the values before beeing passed to the queues for averaging. But when I use queues I get a timeout in my DMA Fifo. Are the queues so slow?? This was my primary question.

0 Kudos
Message 12 of 13
(442 Views)

I have not had an issue with queues and their speed, you should probably though simplify the code by making the producer loop just run as fast as possible and move all processing to the consumer loop.  This will let you know if you can run without any timeouts.  I would set up a simple test, top loop, read dma and pass all data on the queue (single queue of data type) and run the bottom queue to just dequeue all data but put in a small wait to simulate data processing.  This should work tell you if its the queuing or the architecture causing the issue.  I would be supprised if the queue was an issue. 

 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 13 of 13
(432 Views)