01-14-2009 02:19 AM
In the attached vi, a queue is used for data transfer.
The upside loop will keep pull data from device. The downside loop will process the data.
It works allright. But after I add a wait function in the downside loop, it cannot receive data from queue any more. But there is data inside from the screenshot.
01-14-2009 02:36 AM - edited 01-14-2009 02:36 AM
Hi turbot,
i can't open your vi at the moment, but maybe this are to many element you want to transfer.
Did you try it with less elements?
Mike
01-14-2009 03:12 AM - edited 01-14-2009 03:12 AM
Hi TurboT,
Why do you want to use a wait time in the consumer loop (downside loop)?
When using the Producer / consumer pattern, the producer loop will gather the data from the device (DAQ board or whatever), and the comsumer looop will process the data. The consumer loop is event driven:
I hope this answers your question.
Best regards,
Peter S.
01-14-2009 03:29 AM
It has a lot of data, just as it is running in debug mode, accumulate a lot of data.
If run normally, there is less data, but still no display.
01-14-2009 03:35 AM
Hi Peter S,
So you mean that if there is no data, it will auto keep with there by the queue, right?
01-14-2009 03:45 AM
Hi TuboT,
Indeed, the Read from Queue function will wait until there is data on all of it's inputs (where as the queue is one of it's inputs). So if there is no data to process, the function will wait until there is data available again.
Best regards,
Peter S
01-14-2009 04:05 AM
Hi Peter,
how can it change the situation shown in the first picture. The 100ms are additional to the wait time. As i can see in the picture there is no timeout connected, so it should be -1, wait for data. Am i missing something?
Mike
01-14-2009 04:56 AM
Hi Mike,
You are not missing anything 😉
You are correct regarding the Timeout. I have used the Producer / Consumer pattern to reproduce the output, but somehow I do not get the 0 output if I used a Wait until next ms multiple function; which is, of course, a good thing, since there should be no output at all if the timeout input on the dequeue element is not wired.
Best regards,
Peter S
01-14-2009 08:13 AM
Hi Peter,
How does the timeout in the de queue element been used. Thanks.
01-14-2009 08:43 AM
First of all, highlight mode messes all timings esp. in parallel loops.
That being said, your screenshot in the first post tells us nothing, turbot. We don't know how many elements are in the queue and how many iterations each loop has already run through at the moment you made the screenshot.
But there is one thing we can tell for sure: Most propably, the package you "just received" from the dequeue element is not the the same as the one which is "just recently sent" by enqueue.
I never saw a queue loosing data except:
- Limited queue which is full
- Instead of dequeueing a single element all elements where read and all except of one was discarded
- System ran out of memory (2GB per application for 32-bit OS regardless of RAM size [special settings allow up to 3GB])
The first two reasons are custom made, the last one is a limitation of the addressspace and therefore there is nothing LV can do about.
I asume the following:
Your producer is an untimed loop containing some logic and a DAQmx read. The DAQmx read has a -1 connected for samples to read. So if no samples are in the PC buffer, the read returns.... tada... an empty array.
The logic could take even less than 1ms, so statistically spoken, you should retrieve arrays of size of 4x50 (jittering a lot because the producer is running different times for the algorithm and windows interactions). The large amount we are seeing in your screenshot is created due to highlight mode!
So it could happen, that the DAQmx read fetches an empty array. I have to confess that this is really odd in highlight mode. But if you just entered highlight during execution, this is possible!
hope this helps,
Norbert