LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State machine substate?

For a state machine, is there a way to make a state to become a sub-state of another state?  What I mean is that I want the substate to have an indentation to distinguish it from another state.  ?It is easier for viewing when you are looking at the cases in the case structure.

 

Yik

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

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 8
(3,858 Views)

You could give the substate a name that has a few spaces at the beginning of it.

Message 2 of 8
(3,854 Views)

Or.... you could nest a state machine in one state of your top level SM.  It would act hierarachal that way but require an additional case selector variable..... Hmmmm Not sure If I'd do it this way but it could be done.

 

 

Actually, Thinking it through I about to say that you may want to re-assess your archetecture.  When you start looking for ways to differentiate "States" by dependancies on other "States" it time to ask if your machine is cohesieve.


"Should be" isn't "Is" -Jay
Message 3 of 8
(3,843 Views)

Ravens Fan wrote:

a few spaces


you mean underscores, right?  😉

 

You could have a subVI that is/contains a State Machine.  Give it a suitable name and it can be called within one(or more) statesof the state machine in your main VI.  You can even pass arguments via the connector pane.  

 

There are many other approaches depending on what you are doing and how you want to architecture your code.  Things like re-entrant vi's, dynamic vi's (Daemon), ActionEngines (well.. if it contained a state machine 😉  I'd have to think about that last one). I recall doing an ActionEngine with a StateMachine.  It ran the state once per call..  The state came from the calling VI.

0 Kudos
Message 4 of 8
(3,841 Views)

I did mean spaces, but underscores are fine to.

 

 

Though my preference would be the state machine within a state machine.  The substate would also be passed by a shift register.  Or it could be one shift register that is a cluster of state and the substate.

 

 

Message Edited by Ravens Fan on 03-15-2010 02:03 PM
Message 5 of 8
(3,822 Views)

I'm confused if your design has the same state appearing more than once in the State Transition Diagram or if you are talking about a sub-routine which should translate to a sub-VI. I have seen queued state machines that use a state as if it was a sub-routine but I felt that was a good example of a sub-VI rather than a state. The ancillary issue that comes from the smae state being called by different states is how to re-direct program flow for each call.

 

Confussed,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 8
(3,814 Views)

Ben wrote:

I'm confused if your design has the same state appearing more than once in the State Transition Diagram or if you are talking about a sub-routine which should translate to a sub-VI.


I share your confusion.  Until we know what the intent of the code is and why nest a state machine, then it is up to many different interpretations.

0 Kudos
Message 7 of 8
(3,801 Views)
You could use the JKI State Machine.  My state machines look like this:

SM.jpg             CaseSelect.jpg

The CaseSelect JKI RCF Plugin makes working with this State Machine easier.
Message Edited by jcarmody on 03-15-2010 04:34 PM
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 8 of 8
(3,771 Views)