LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Queue cannot receive data

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.

 

 

 

 

Download All
0 Kudos
Message 1 of 10
(3,830 Views)

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

Message Edited by MikeS81 on 01-14-2009 09:36 AM
Message 2 of 10
(3,823 Views)

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:

  • when there is data available, it will process the data (at maximum speed)
  • when there is no data available, it will wait until data is available (the loop will not continue to iterate and thus will not take any CPU power)


I hope this answers your question.

 

Best regards,

 

Peter S.

Message Edited by Peter S on 01-14-2009 10:12 AM
Message 3 of 10
(3,812 Views)

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.

0 Kudos
Message 4 of 10
(3,807 Views)

Hi Peter S,

 

So you mean that if there is no data, it will auto keep with there by the queue, right?

0 Kudos
Message 5 of 10
(3,804 Views)

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

Message 6 of 10
(3,801 Views)

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

Message 7 of 10
(3,787 Views)

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

Message 8 of 10
(3,772 Views)

Hi Peter,

 

How does the timeout in the de queue element been used. Thanks.

0 Kudos
Message 9 of 10
(3,753 Views)

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 

 

 

 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 10 of 10
(3,737 Views)