Showing results for 
Search instead for 
Did you mean: 

Subvi as Consumer

Hey guys,


could someone upload an example where you have a Producer/consumer in the main-vi which calls another sub-vi which is a consumer.


I'd like to know how the architecture looks like and also how you use a Queue betweent two distinct VIs.



0 Kudos
Message 1 of 16

Personally, I feel that Producer/Consumer belong on the same block diagram since they are accomplishing a single task.


But if you are actually referring to a Queued Message Handler, which is sort of a mix between a State Machine and a Consumer, then that belongs in its own VI.  These are sometimes also referred to as Actors.  What I like to do with my QMHs is to have a library containing the QMH, an Action Engine for the queue that is private to the library, and public VIs that are used for the messages that can be sent to the QMH.  This helps ensure the messages are properly formatted and simple for developers/users of the library to use.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 16

With a queue it's not going to work. You basically want two consumer's, both consuming the same queue. Basically a Producer\Consumer\Consumer (or two separate P\C's)...


For a traditional Producer\Consumer, it's very easy to put the consumer in a sub VI. Simply select the bottom part, and use Create SubVI...


The queue is not fitted for two consumers. A user event is. The producer can send the events and as many consumers as you want can consume them.

0 Kudos
Message 3 of 16

my answer might not help you now but you can read about Actor framework in LabVIEW that will definitely make easy architecture for your future projects.

Actor Framework

0 Kudos
Message 4 of 16

@amitwadje wrote:

..Actor framework in LabVIEW that will definitely make easy architecture for your future projects.

If you'd ask me, AF will make every project architecture much more difficult. Not the place for a flame war though... Just know that some people love AF, some don't. Doesn't seem to be much in between: you love it or you hate it. That's OK, both can co-exist.

0 Kudos
Message 5 of 16

I attached a little Project, for better visualization. What I'd like to do is to load the graph to the subpanel, in the main vi`s front panel determine Amplitude and Phase of the sinusoid and then pass These values via a queue to the subvi. How can I make this work?

Download All
0 Kudos
Message 6 of 16

@volfi wrote:

I attached a little Project,

No, you didn't.

0 Kudos
Message 7 of 16



I'd like to hand front panel controls to a sub-vi (in a subpanel) via a queue. I tried to do as in the attached project. How can I make it work? There is no error, the graph does not update even if I put constant values into the Queue.



Download All
0 Kudos
Message 8 of 16

Your attachment is missing.

0 Kudos
Message 9 of 16

sorry, now.

0 Kudos
Message 10 of 16