From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State Machine with array

Hi all,

 

i created a sample state machine using jki tool.

 

here i am controlling flow of state machine using Array index.

 

.........

 

I feel that following method is higher benifit for me i simply arrange my state machine using array. and i can control my statme machine by increament or defemanet array index.

 

and i creaed this method to ease of error handling . by changing the index vlaue . in array .

 

...

ALL I NEEED TO KNOW  IS WHETHER THIS METHOD IS CORRECT OR ELSE GIVE METHOD ??!!!

 

hjl.PNG

0 Kudos
Message 1 of 3
(3,331 Views)

@SaranVenkateshS wrote:

[...] ALL I NEEED TO KNOW  IS WHETHER THIS METHOD IS CORRECT OR ELSE GIVE METHOD ??!!!


This method is not a correct use of the JKI State Machine; either use macros or String constants in the individual states.  Your solution is unmaintainable if you want to insert elements into your array, and unreadable if you don't put related states together other in it.

 

You don't need to work so hard if all you want to do is execute a series of states:

simple.jpg

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 2 of 3
(3,314 Views)

Jim is right, the JKI tool is nice but it doesn't look like you are taking any advantage of it here. You can create an enum instead of a string array with an index, and this will allow you to have numbered states and a description of the state. You can type def your enum so that if you update it in one location, it will update all locations.

 

The JKI tool is nice if you want to run a couple of different orders of states, you can launch a macro (along with many other cool features). There may be some test where you need to run state 1,2,3,4,5; but another test might require state 1,2,4; which is very easily done with the JKI state machine.

0 Kudos
Message 3 of 3
(3,265 Views)