06-08-2009 10:08 AM
Hi, I have a question about notifiers and queues. I try to do a moving average for 6 min, having data with a sampling rate of 25 us. I use a producer/ consumer architecture. The producer loop reads 3 DMA Fifos from my FPGA vi and writes them in three diferent queues. Each queue is beeing read again in three consumer loop, one for each queue. I thought this might be faster??!! If I limit my queue to a certain size than after some minutes I get a timeout error, if I say 0 ms for timeout. I wanted to make sure that nothing will get lost. If I don't limit my queue size ( -1) after 10 minutes I get a message that I don't have enough memory to operate. I also can see that that in Task manager the page file is getting bigger and bigger until 2 gb. So from this poit of view I would assume that my average calculation is to slow and data has to be stored inbetween. So my consumer loop is to slow. Well I don't have any idea how to make my code faster. I also do a cascade for the averaging and the average is beeig calculated adding the new value and subtract the oldest value in the array.
Than I tryed using the notifiers. As I read you can not size a notifier. But what happens if the consumer loop is slower than the producer loop? Do I loose data? When using notifiers I don't get any error messages, like don't have enough memory . So what is the diference between notifiers and queues?
Has also someone any idea how to make the code faster ?
Thanks
06-08-2009 10:29 AM - edited 06-08-2009 10:30 AM
Hi elh,
a notifier has no buffer. It's like a queue with size of one, but without the full error.
You can receive a notifier on different places at the same time, this isn't possible with a queue.
Hope it helps.
Mike
06-08-2009 10:44 AM
06-08-2009 10:50 AM
Hi elh,
yes that's correct. See the attached example.
Mike
06-08-2009 10:56 AM
Hi Mike,
thanks for your advice. Are there other posibilities comparing to the queues??
Irina
06-09-2009 10:27 AM
In terms of functionality, a queue is similar to an array.
Think of a queue as an array, without a UI, that can only be operated on from either the front or back (unless you do a little LV magic).
Due to how it is constructed, it is faster than an array as well.
06-09-2009 12:45 PM
Hi,
Back to your original post.... did you know that you can do averaging on the FPGA board itself? There is a NI shipping VI for LV FPGA that can calculate an average, RMS, etc... Maybe a suitable alternative would be to do the calculations there and spare your host computer..
Mike R
06-09-2009 01:15 PM
Check the number of elements in the queue when running your vi, so you can see if your queue is running full.
Furthermore, your code looks a bit 'dirty'. From that I guess, there is still a lot of improvements that can be made to get the performance you need.
Take a look at the 'ptbypt Mean.vi' (I don't remember the exact name).
Felix