LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Producer/consumer inside producer/consumer

Hello all,  I am using a producer/consumer event structure within a producer/consumer....not sure if this is the best approach.  The main vi is setup to perform several different tests based on the user input.  It does an initialize, setup, and read a pressure controller.  The main vi continues to read the pressure controller until the user presses a button to perform a particular test. When the test is complete, it goes back to the main vi and monitors the pressure controller.  The user can perform another test or stop the program operation.  My question is......In the individual tests I use an enqueue element which sends it back to the monitor pressure controller in the main vi.  Is this the best approach?  THANKS in advance!

 

Alma

0 Kudos
Message 1 of 7
(2,777 Views)

I'm guessing no, but can you post your code?

0 Kudos
Message 2 of 7
(2,751 Views)

hope this helps main vi, below subvi

 

main.pngsub_test.png

0 Kudos
Message 3 of 7
(2,743 Views)

You can actually attache the .vi file to the forum posts.  That is typically much more helpfull for a large area of code than a picture.  This way I (and any of the other advice givers) can poke around it to see exactly what you are doing.

0 Kudos
Message 4 of 7
(2,716 Views)

I was hoping the pictures would be enough info.  Let me explain further..... The top pic is the main vi.  The sub vi in the consumer loop of the main vi is pictured below.  As you can see they are both Producer/Consumer design and in the sub vi (bottom right of pic) is where i send the enqueue element "monitor" back to the main vi to monitor the pressure controller in between tests.  Hopefully this breif explaination will help. 🙂  I will try to post the vi tomorrow...not at work today.  THANKS for the help!

0 Kudos
Message 5 of 7
(2,696 Views)

So the subVI is a popup window?  And nobody will be able to manipulate the main VI while the popup is there?  If so, I don't see much wrong with this.  But if you need to change things in the main VI while this subVI is running, it won't really work well since your main's consumer loop will not be iterating until the subVI is complete.


GCentral
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 6 of 7
(2,694 Views)

Yes, the subvi is a popup window and the main vi cannot be manipulated while the popup is there.  Thanks for the advise.  I just wanted to make sure that I wasn't getting out of hand with the use of producer/consumer design.  I feel like I am still learning when it comes to producer/consumer design but I love it the code is much cleaner.  Thanks, again!  Any other input would be appreciated.

0 Kudos
Message 7 of 7
(2,685 Views)