LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State Machine Template: Give Feedback

JKI State Machine is super nice, working for a lot of different applications, but I'm sure I'm not the only one who at some point envisioned a Producer/Consumer version of it. For me, that point came when coding a testing routine and working in an Abort button. I wanted a confirmation dialog to come up asking if they really wanted to abort, but that dialog became a holding function and basically paused the test and messed everything up no matter if the user cancelled the abort or not.

 

So I made FaKI State Machine (Fake JKI State Machine), and it is what I use on many projects today. Let me know what you like, what you dislike, and what could be improved! And feel free to add it to your own library.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

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

Shameless bump... But I'll also say a few things about the template:

 

1. Producer loop has an error handler that sends errors down to the consumer loop to be handled.

2. When an error happens anywhere and the error is displayed on screen, the state where the error happened is appended to the end of the message (makes debugging way easier).

3. Just like JKI, you can add multiple states to the front or back of the queue with single strings and newlines between each state.

4. There is the "Category: State >> Arg" structure, but the queue data type consists of both a string and a variant in case you want to pass anything crazy along.

5. There is an event registration in case you need to close the program from inside the consumer loop due to error or something.

 

Come on folks, let me know what you think!

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

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