LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

producer consumer queued state machine with subVI

Hello all,

 

I have a rather standard producer consumer queued state machine. Many of the states are for serial communication with an air flow controller and a series of solenoids. I have a subVI which I am having some trouble with. The subVI opens its own front panel, sends commands to the queue in the main program to adjust the air flow (which can take 10-20 seconds), then after it is prepared, there is a for loop to alternate turning a solenoid on (which is a command to the queue), wait, turn solenoid off (a command to the queue), wait, repeat. The front panel of the subVI displays a few LEDs indicating which iteration of the for loop is occurring. When this is run, the prepare air flow and solenoid switching commands are sent to the queue and executed, but the for loop continues before the first command to the queue (adjust air flow) is even finished. So the visual display and the machinery are out of sync.

 

This result all makes sense.

So I am wondering what is a correct way to do this?

 

What comes to my mind is:

1) put all this functionality in the main program and allocate part of the front panel to this protocol. This is not desirable.

2) use notifiers so that once the air flow is all prepared, the main program tells the subVI "OK" you can continue to switch the solenoids, and update the LED display. 

 

Or is there some other solution?

 

Thank you for any feedback,

Jason.

 

0 Kudos
Message 1 of 2
(2,600 Views)

Because vis that display it's front panel contain event structures in most cases, I use user events to report the status to them. See my community nugget.

 

Felix 

0 Kudos
Message 2 of 2
(2,590 Views)