01-08-2008 11:48 AM
I am trying to read DAQ data from an external triggered events at 280Hz, and the data needed lasts about 2.8msec each evet, and I wish to analyze (average) the data at the same rate. The normal sequential Vi will spend about 1msec for average/analyze the data, and therefore I will be dropping events.
I wish to read the new data while analyze the previous data, so that I could achieve the full 280Hz rate. After consulting our regional NI engineer, I was referred to use the Producer/Consumer template.
Enclosed, I attached the Vi LIB that I did using Producer/Consumer template with LV7.1.
The DAQ is external triggered at 280Hz, and each DAQ last about 2.8msec. I wish to be able to read and average the DAQ at maximum DAQ rate of 280Hz.
I measured the time to finish 10K averages, and trying to see the time difference when I changes the content in the Producer/Consumer
I found that if I remove the Plot in the Consumer, the time to finish 10K averages dropped from 48 seconds to 38 seconds. If I also remove the “0 delay” in the Producer(not in this vi's producer loop now, but was there originally from the NI template), the time dropped from 38seconds to 36 seconds. So, looks like both Producer and Consumer are rate limiting factors in this design. But, suppose the Producer should keep on producing without considering the Consumer’s speed? I wonder if the Queue is set up correctly?
01-09-2008 05:57 PM
01-09-2008 09:02 PM
01-10-2008
02:02 PM
- last edited on
08-27-2026
03:29 PM
by
Content Cleaner
Hello again Sheng,
I guess I was not clear as to what my point was in my previous post. What I was getting at is that the total runtime of your program is how long it takes for both loops to complete all of their tasks. The reason that it appears that the consumer is the limiting factor (when updating the front panel) is that there is data building up in the queue from the producer (so you are not limiting its rate at all), but it takes more time to empty out the queue after the 10k acquisitions have completed.
This is what the producer-consumer structure is designed for. The consumer (which takes time) does not limit the producer (which runs faster). What we are using it for is really to run both at the same time. We are essentially doing pipelining. We could also program with shift registers like this:
This would do essentially the same thing since the producer portion (the DAQmx vi) takes the longest and the sections do not require another portion to run first.
I hope this clears things up, please post back if I did not answer your question.
Message Edited by Neal M on 01-10-2008 02:03 PM