The LabVIEW State Diagram Toolkit assists in large scale application development by providing a framework in which you can build state machines in LabVIEW. Using the state diagram editor, you can create a state diagram that reflects a complex decision-making algorithm, while LabVIEW simultaneously generates the block diagram code necessary to implement the state machine.
In addition to visualizing the flow of a complex decision-making algorithm, the state diagram is a functional form of application planning. To create an effective state diagram, you must know the various states of the application and how the states relate to one another. By visualizing the various execution states of an application, you improve the overall design of the application. The State Diagram Editor provides a user interface that you can use to design state diagrams.
What is a State Machine?
"A state machine is a programming architecture that can be used to implement any algorithm that can be explicitly described by a state diagram or flowchart. It introduces a way to create a program such that it responds to user events (such as key strokes and mouse events) or in-state calculation (such as comparing system variables). This architecture provides a distinct advantage over using a sequential architecture that uses data dependency to force execution in exactly the same way every time. Almost all programs that have more than a rudimentary user interface employ the state machine architecture—they wait for an event (user interaction or calculation result), and then take appropriate actions based on this input." - Using a State Machine (Event Driven) Architecture
State machines are frequently used in the design and architecture of individual LabVIEW VIs and enable the orderly transition between different execution states in a VI. The purpose of the LabVIEW State Diagram Toolkit is to easily manage and modify the underlying state diagram and to have nay changes in the state diagram automatically reflect in the implementation of the state machine in your VI.
Using the LabVIEW State Diagram Toolkit
Installing the toolkit adds a new palette item (Addons >> State Diagram Editor) in your LabVIEW function palette.
To create a state machine VI using the state diagram editor, start on a blank VI diagram, select the State Diagram from the function palette, and place it on the diagram in the same way you place a new loop or structure. The VI will create a new state machine on the diagram and open the corresponding state diagram editor.
You can now define your state diagram in the editor by adding and removing states and defining transitions between states. Right-click on the state diagram to create new states and transitions. You can move transition end point between states, and change the names of states and transitions. As you make changes on your state diagram they will be immediately reflected in the corresponding state machine VI.
You can close the state diagram editor and the state diagram will be stored and saved with the VI. To reopen the editor, right-click on the While Loop frame in your state machine VI and select Edit State Diagram.
In your state machine VI, you need to define when individual transitions become active which is done by terminating the inner While loop from the appropriate inner Case structure. Additional logic can be placed in each state and transition.
The State Diagram Editor includes two examples, which are located in the labview\examples\statediagram folder.
The manual is available in the labview\manuals directory and attached below.
The LabVIEW State Diagram Toolkit can be installed from VI Package Manager.
Questions about the LabVIEW State Diagram Toolkit should be posted in the general LabVIEW support forum.
Feedback and suggestions for the toolkit can be posted in the comments below.