From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Community Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

New UI Producer Loop with State Machine Consumer Loop

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

  1. Run VI
  2. Press various Process buttons to see the Queue build
  3. See the Process and Stage in the Cluster of Boolean indicators
  4. Press Stop during Process to see Stop functionality
  5. Run VI again after program has stoppped.
  6. Repeat step 2
  7. Press Emergency Stop button to see Emergency Stop functionality.

Requirements

Software

LabVIEW 8.6 and later

Hardware

None

Additional Images or Video

UI Producer Consumer Front Panel.JPG

UI Producer Consumer 2012.png


Contributors