LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Queue function seems to overwrite values

Solved!
Go to solution

Hi,

I am working with an PCIe-1473 Framegrabber to get images from my Basler camera build up by 8192 pixel.
When reading them from the FPGA I am using a Host DMA. After reading in one while loop I am putting my vectors of pixels into a queue and I am using a second while loop to process the data. I am setting my queue size to 10000 elements. After a while it seems that the processing is not working properly any more and I get a repeated image as shown in the included images. Has someone ever had such a problem and if so an idea how to solve this problem?
Thank you very much in advance.

Kind regards
Antonia

Download All
0 Kudos
Message 1 of 16
(4,944 Views)

There could be many issues. From the picture I cannot tell if you are releasing your queue before you start dequeueing from it. Is there a size limit on your queue? Please attach your VI (LV 2012 or earlier) and we can take a closer look.

0 Kudos
Message 2 of 16
(4,894 Views)

What do B-Scan values say? Are they different from what you are getting through queue? Are they correct?

Is array size correct?

Can you check queue size? Are you reading not fast enough? Why keep 10000 frames?

I would not send full image (array) through queue, but use B-scan array in Data value reference and send recent row index through queue.

 

0 Kudos
Message 3 of 16
(4,873 Views)

Unless you have very specific reasons why you are using timeouts and queue sizes in your queue, it's best to let it do its thing automagically.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 16
(4,870 Views)

Hi,

Thanks for all the fast replays.
Please find attached a more cleaned up version of my VI.
I tried to delete all the queue sizes and time outs and after a while I am getting the message: "Not enough memory to complete this operation".
A B-scan is a matrix (image) which is build up by a variable size of my A-scans (vectors) which I am reading from my line scan camera. One A-scan is a vector with 8192x1 entries and one B-scan is for example 8192x500 pixels in size.
I checked the queue size and the queue size is not changing and seems it is always full. So I think I am getting data to fast and not not processing them fast enough and that is why my data are not correctly queued. I was thinking about building somehow a circular buffer but I am not sure how to do that?
Thank you very much again.
Kind regards,
Antonia

0 Kudos
Message 5 of 16
(4,835 Views)

There are two queues in your VI. Which, besides, has a way too big front panel and block diagram (each).

 

However, you do waste memory with your implementation. One queue is limited to a specific number of elements (UI, 100 being default), the other queue is not limited. From your description, already the first consumer (reading the limited queue) executes slower that your reading from the FPGA device. So you have to optimize the consumer for improved execution speed. I cannot see the subVI code (as you only attached the top level VI) but i can see that you create quite some copies of data.

This consumer feeds the unlimited queue. This second queue however is read only if three boolean criteria do have a specific configuration. That means that if you do not meet that criteria, your second queue will ALWAYS result in out-of-memory issues.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 16
(4,819 Views)

Hi,

 

Thanks, I tried to set every queue to the same maximal queue size and I also tried to process and view less data but still I get after some time this dublicated images. I also attached the essential Sub Vis, but I think there is not so much happening. For my last queue I also have a default case, that I always at least match one criteria.

Do you think I can improve my processing to the speed of the loop where I am getting my data or is there any other soultion to this problem?

Thanks again for your help.

Best regards,
Antonia

Download All
0 Kudos
Message 7 of 16
(4,809 Views)

Hi all,

I also tried to integrate a flush the queue function, where I can manually flush the queue after a while.
If I do that it runs again fine until it overwrites the values again after a while.
Any ideas how to correct for this behaviour in a more stable way?

Best regards,
Antonia

0 Kudos
Message 8 of 16
(4,794 Views)

Your problem isn't that values are 'overwritten', but that data is dropped. If the enqueue function times out, the data is not enqueued at all but it is discarded. Instead of seeing every value at the reader, you only see the data which actually was enqueued. The missing data was discarded due to enqueue timeout.

 

In order to read all data, you have to make the reader as fast or better faster than the writer.

I haven't looked into the subVIs, so i give you basic hints:

- Try to reduce typecasts as much as possible. Each typecast can induce a copy of the data which slows things down (and needs more memory)

- Implement "inplace algorithms". Use functions which use the same data on the input as the output.

 

There are a lot of tutorials, examples and white papers available discussing performance optimization. You can also attend the NI LV Performance Guide class.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 9 of 16
(4,787 Views)

Hi,

I wanted to check when my enqueue is timing out. That is why I put indicators to all my enqueue blocks,  but they never turn true. Is there any other possibility to check if the enqueue is timeing out?

I will try to improve my reader thank you for that hint.

Best regards
Antonia

0 Kudos
Message 10 of 16
(4,746 Views)