03-01-2022 11:40 AM
I will save it for LV2020
I also notice I messed up anyway and that example was wrong.
It should look more like this:
The previous example would be if you wanted a state that allows you to select different test sequences
03-01-2022 12:35 PM
if the states are predefined order, wouldn't something like this be easier?
03-01-2022 12:41 PM - edited 03-01-2022 12:48 PM
Sure but what if you waned to select between several test sequences?
It's too easy to get hyper focused in simple solutions when making theoretical programs like this. But take a step back and think about how you would scale that to a larger more complex application.
How about if you need to change the sequence based on a test result somewhere in the middle of the sequence? With a modification of the two examples I posted that would be simple to do as you can always load a new state into the front of the Queue or empty the Queue and load a new sequence.
03-01-2022 12:49 PM
Don't get me wrong.... If you need to branch to different states, then yes, my simple solution would not work. OTOH, sometimes KISS is all you need. (Maybe I need to re-read the original requirements closer)
03-01-2022 12:53 PM - edited 03-01-2022 12:55 PM
@Frozen wrote:
Don't get me wrong.... If you need to branch to different states, then yes, my simple solution would not work. OTOH, sometimes KISS is all you need. (Maybe I need to re-read the original requirements closer)
True, and for quick one off tests I often use very simplistic approaches like nested For-Loops. But too many times that has come back to bite me in the you know what when down the road things have to be added. So I have begun to always think about scalability.
We don't know the full requirements for this, the OP was asking how to repeat states in a simple State Machine architecture.
03-01-2022 03:58 PM
@RTSLVU wrote:
But too many times that has come back to bite me ...
Yes, I am sure we have all been there. 😀
03-01-2022 05:43 PM
If every other cycle is "Main Group", starting with "Main Group" then here is an option. The exiting state for Group 1 is Group 2, for Group 2 it's Group 3, etc. Just add another case and with the exiting state as the next and "Main Group" will automatically be inserted in between.
03-04-2022 09:33 AM
Check out the State Diagram Toolkit. I find it better suited fro beginners that the JKI one. One big advantage is that you use an actual diagram to organize states and transitions. It updates names and conditions automatically. All you do is wire a True variable to trigger the transition.
https://forums.ni.com/t5/Reference-Design-Content/LabVIEW-State-Diagram-Toolkit/ta-p/3606081
03-07-2022 09:15 PM
Thanks Frozen!!!! Your answer is the best. This is what I'm talking about. But the question I would like to ask is how do you keep the cycle going continuously using this method.