LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hey guys! How do I keep the flow going using this state machine method? Can someone please help?

Solved!
Go to solution

I want the flow to keep going continuously unless I abort/stop the run. 

When I run the code, I get this flow: 

Main Group -> Group 1 -> Main Group -> Group 2 -> Main Group -> Group 3 (My code stops here), but I want this to repeat the cycle back from Main Group -> Group 1 -> Main Group,..., without having to make the array of enum bigger than it is. I would like to keep the same method if that's possible. I have attached my block diagram.

Cycle.PNG

0 Kudos
Message 1 of 10
(1,275 Views)
Solution
Accepted by topic author GRCK5000

Try this:

 

altenbach_0-1647898511992.png

 

 

 


@GRCK5000 wrote:

 

Main Group -> Group 1 -> Main Group -> Group 2 -> Main Group -> Group 3 (My code stops here), 


No!! Your code never stops because you are autoindexing on a while loop! Once the array runs out of elements, it will repeat the default value forever, especially since you have no way to stop the loop (Aborting the VI is not quite the same ;))

0 Kudos
Message 2 of 10
(1,261 Views)

Hey Mr. Christian Altenbach, the LabView champ. I tried that it seems like it's not working. I am not able to move to Group 1. See attached file

0 Kudos
Message 3 of 10
(1,226 Views)
Solution
Accepted by topic author GRCK5000

Obviously, you need to connect the array index input to the R terminal output, not the IQ. Compare with my picture.

 

(You also need a wait inside the loop, else you would not even be able to follow it)

0 Kudos
Message 4 of 10
(1,220 Views)
Solution
Accepted by topic author GRCK5000

If you are going to do something weird like that, I think this would be simpler:

 

weirdLabVIEW.png

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 10
(1,209 Views)

WOWW Mr. Altenbach, you are awesome!!!! You get everything figured out. A challenge is not even challenge to you. What do you not know?

You are the undeniable labview champion.

0 Kudos
Message 6 of 10
(1,171 Views)

Thanks RTSLU!!!!  "something weird" 😆 . This code is definitely simple.

0 Kudos
Message 7 of 10
(1,155 Views)

@GRCK5000 wrote:

Thanks RTSLU!!!!  "something weird" 😆 . This code is definitely simple.


It works but think about how you would scale this into a larger more complex program... It wont be easy. 

 

You are basically making a Queued State Machine, a QSM is a tried and true architecture but this is not how it should be done. 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 8 of 10
(1,152 Views)

Yes, I was thinking about it. You're right, especially when conditions are involved in order to move to the next state.

0 Kudos
Message 9 of 10
(1,137 Views)

@RTSLVU wrote:

@GRCK5000 wrote:

Thanks RTSLU!!!!  "something weird" 😆 . This code is definitely simple.


It works but think about how you would scale this into a larger more complex program... It wont be easy. 

 

You are basically making a Queued State Machine, a QSM is a tried and true architecture but this is not how it should be done. 


You are right RTSLU.... And now I wish I would not have suggested it in the first place. 🤐

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 10 of 10
(1,108 Views)