03-18-2013 11:44 AM
HI NI Folks,
Does queue concept in Event structure works ??????
If yes, any ideas where I am doing the mistake.Please refer to the below post.
Regards
Neo.
PS: I have already posted this question in Vision discussion board. But I didnt get much response, not even views. So, I am posting it here
03-18-2013 12:06 PM
Don't use the "queue status" function. Just use the Dequeue Element. If you want something to happen when you don't have any data, set a timeout and use the "Timeout?" output to control your case structure.
03-18-2013 07:13 PM - edited 03-18-2013 07:28 PM
Hello Crossrulz,
1)I just want to Implement Image saving code in Consumer loop. Now tell me what parameter should I queue in Producer loop and deque in Consumer loop for effective data saving from camera. I just Implemented as in my attachment because I found a working example in NI website. I just mixed the both.
2) I want consumer loop to save data when there is an element in queue (Whatever the element queued). It should be ideal when there is no element in Queue
3) Is there any function in Labview like 'Timeout?'
3)Even with queue status function the example in the below link is working fine. But why my VI exactly with same design is not Executing the consumer loop ? Did I miss something ?
http://zone.ni.com/devzone/cda/epd/p/id/5859
Regards
Neo.
03-19-2013 02:23 AM
A queue executes when there's an item queued. If there's a timeout wired to the Dequeue it'll stop waiting after X ms and set the timeout output. It's common to have some default action done in a timeout case and the real actions performed in the dequeued state.
What to queue? The same data you define when you create the queue. 😛 If you create a queue with Integer input you can only queue integers and when dequeuing you'll get integers, but you can also create it with type defs, arrays, variants ...
Why your producer/consumer isn't working? Open the producer/consumer template and play around until you understand it, are you enqueueing/dequeueing correctly?
/Y
03-19-2013 08:03 AM
As I said, don't use the Queue Status. Use the Dequeue Element. When data is sent by the producer, the consumer will grab it and process it. If you setup the queue to send the image, then the consumer will read an image from the queue and process/save it. The Dequeue Element has a Timeout input. This sets a timeout so that if no data is recieved, you can still do something in that loop. If you just want it to be idle, don't use the timeout.
03-19-2013 10:45 AM
Hello Yamaeda,
Thank you for your reply. I followed the suggestions here... finally my VI is working fine.
Regrding my question 'what to queue', my question is In Image preocessing (in general) if we want to process some image data in consumer loop, we can queue either bufffer number or Image itself or may be any other parameters (I dont know, I am not expert). For effective working of P/C loop with Images, which is the best parameter to queue in ????
Regards
Neo.
03-19-2013 10:58 AM
Hello Crossrulz,
With ur advice , by using dequeue function and its timeout terminal, My VI is working like miracle. Problem solved.
So I decide to paly lil bit with that queue status funtion. I used a time delay in no element case . Then consumer loop worked for few iterations, but still some elements in the queue were not processed by consumer loop..
My question is Whats happening to those missing elements ??? Since queue size is infinite there is no chance of overwriting. Even at the end of all iterations , I used queue status function to check whether there are some elements still remaing in the queue, but it returned zero elements. Where are those missing elements ????
Regards
Neo.
03-19-2013 11:07 AM
Post your code. It is impossible to identify the issue without seeing your code.
03-19-2013 12:03 PM
Hi,
Mark is right. Please post your code to clarify what has to be changed.
Best regards
Suse
03-20-2013 10:45 AM
Hello Mark ,
This is how I modified the code, queing numbers in P/C loop.
Regards
Vaidhin.