05-08-2013 10:23 AM
I’m studying for the CLD using this document as a base:
Certified LabVIEW Developer (CLD) Certification and Exam Overview
One of the requirements in that document has me stumped:
6. Select a producer/consumer (events) design pattern to respond to user interface events in the producer loop and defer the processing of the event to one or more consumer loops
I start with LabVIEW's producer/consumer (events) template and give it two consumer loops. However, each event only gets to one of the two loops, not both, as you can see in my attached example VI 1_producer_2_consumers.vi.
I would try LabVIEW notifiers, but I read that a notifer is not guaranteed to reach the consumer loops because they are not queued. I would try user-defined user events which might work, but they are not part of the CLD.
What’s the way to complete requirement 6 above?
Solved! Go to Solution.
05-08-2013 10:40 AM
I honestly don't know why that requirement is there for the CLD. The idea of having multiple consumers is that each consumer has its own task to perform. Once consumer could be writing to a database while another consumer is updating the GUI. Remember that a queue is a FIFO. Once a data point is dequeued, it is no longer in the queue. This is why we like to say that a queue is for Many to One communication. In short, each consumer should have its own queue.
05-08-2013 11:02 AM - edited 05-08-2013 11:05 AM
@bmihura wrote:
However, each event only gets to one of the two loops, not both, as you can see in my attached example VI 1_producer_2_consumers.vi.
you must have a 'queue' for each consumer and you were not properly stopping the loops with user interface (using error handling inefficiently, you will get dinged for it on the CLD)...
05-08-2013 11:16 AM
apok,
Good points, and your approach works fine. The error "handling" in my VI was directly from LabVIEW's File >> New... templates; they sacrificed efficiency for simplicity.
Having two queues in your VI makes the diagram cluttered; but that may be the best way to do it. I was looking for some sort of queuing option on the LabVIEW notifier or the like; I didn't find it.
05-08-2013 11:23 AM
@bmihura wrote:
apok,
Good points, and your approach works fine. The error "handling" in my VI was directly from LabVIEW's File >> New... templates; they sacrificed efficiency for simplicity.
Having two queues in your VI makes the diagram cluttered; but that may be the best way to do it. I was looking for some sort of queuing option on the LabVIEW notifier or the like; I didn't find it.
If you're worried about multiple queues looking untidy, you can always bundle them and unbundle the appropriate queue at the aprropriate place...
05-08-2013 11:29 AM - edited 05-08-2013 11:33 AM
a really cool tool for a CLD'r to have under their belt is "the labview style book" by blume
05-08-2013 10:25 PM
05-08-2013 10:44 PM