LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can someone please please help me with state machine problem (transition problem)? I really need your help.

Solved!
Go to solution

I will save it for LV2020 

 

I also notice I messed up anyway and that example was wrong.

It should look more like this: 

QSM1Capture.PNG

The previous example would be if you wanted a state that allows you to select different test sequences

========================
=== Engineer Ambiguously ===
========================
Download All
0 Kudos
Message 11 of 19
(2,917 Views)
Solution
Accepted by GRCK5000

if the states are predefined order, wouldn't something like this be easier?

 

Frozen_0-1646159699487.png

 

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
Message 12 of 19
(2,911 Views)

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. 

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 13 of 19
(2,907 Views)

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)

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
0 Kudos
Message 14 of 19
(2,898 Views)

@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.  

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 15 of 19
(2,894 Views)

@RTSLVU wrote:

But too many times that has come back to bite me ...

 


Yes, I am sure we have all been there. 😀

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
0 Kudos
Message 16 of 19
(2,869 Views)

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.

 

StuartWilson_1-1646178036989.png

 

0 Kudos
Message 17 of 19
(2,840 Views)

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

-----------------------------------------------------------------

If you can not measure it, you can not improve it.
- Lord Kelvin
0 Kudos
Message 18 of 19
(2,811 Views)

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.

0 Kudos
Message 19 of 19
(2,791 Views)