Provide a proper State Machine template with LabVIEW
We've turned on a search before post feature in the LabVIEW Idea Exchange. This new feature will help cut down on the number of duplicate ideas in this space!
The NI Idea Exchange is a product feedback forum where NI R&D and users work together to submit ideas, collaborate on their development, and vote for the ones they like best. View all of the NI Idea Exchanges to post an idea or add your opinion on an existing one today!
Based on discussion at the CLA Summit with Dave Snyder and others: The 'Standard State Machine' available through the 'New...' dialog is not a state machine at all. It needs to be called something else. Other implementations commonly referred to as 'state machine' are in fact not; As has been pointed out by Elijah Kerry: "State Machine is a misappropriated name for a Queued Message Handler."
I think this is worse than misappropriated; it's actually quite misleading. The main problem is that Commands (or Messages) and States are two different things and shouldn't be used interchangeably.
I propose LabVIEW ship with something similar to what I attached. Although it's lacking many of the features that a full-blown state machine ought to have, it does capture the basic premise: "A state describes a behavioral node of the system in which it is waiting for a trigger to execute a transition." [http://en.wikipedia.org/wiki/Finite-state_machine]
Those of you with knowledge on this subject, please comment here with suggestions for this code that might bridge the gap in making this a useful template for people who understand state machine design but also still keep it as a good starting point and learning tool for beginners.
The attached code is multiple files, since I used type defs for States and Commands. Replacing these with string constants would quickly turn the template into a single VI.