Overview
A producer/consumer architecture with a UI producer loop and a state machine consumer loop. Allows the user to queue multiple state sequences.
Description
This VI illustrates an architecture that allows the user to queue multiple processes. Each process contains multiple state, or in this case stages.The queueing of events is handled by the producer UI loop while the consumer loop goes through each process' states. The processes can have functionality different from one another or can have the same functionality. This architecture allows for expansion on the number of processes as well as the number of states for each process by augmenting the states enum and inputting state functionality in the state case. I have changed the consumer loop to have a time of 500 ms in order to make it easier for the user to enqueue elements. The slowed down consumer loops allowed queue processes to build due to the slow progression of the queue. To hasten the program, the user can change the time constant.
This type of architecture can apply to an application containing multiple processes, who each have multiple states. This allows the user to easily queue up processes that will proceed in the order that the user selects. There is also two different stop functionalities in order to ensure that a current process is completed or that the current state is completed before stopping the program. This can easily be scaled by editing the type-def enum and adding states to the state machine.
Steps to Implement or Execute Code
- Run VI
- Press various Process buttons to see the Queue build
- See the Process and Stage in the Cluster of Boolean indicators
- Press Stop during Process to see Stop functionality
- Run VI again after program has stoppped.
- Repeat step 2
- Press Emergency Stop button to see Emergency Stop functionality.
Requirements
Software
LabVIEW 8.6 and later
Hardware
None
Additional Images or Video