Jump to content

State Machine Basics


Navarre

Recommended Posts

Hi,

I have done a fair amount of LabView development but have rarely used (or run into) the state machine construct. From what little I have read it seems that almost anything can be modeled as a state machine. Are there situations where a state machine wouldn't be effective? Are there real-world examples of things that are not state machines?

Thanks,

Nina

Link to comment

Are there real-world examples of things that are not state machines?

Yes. For instance, a transformational system (a data processing algorithm not requiring user interaction) is not a reactive system (that responds to events). State machines are appropriate for designing reactive systems.

Here is a link I have found helpful when contemplating the essence of state machines: http://xlinux.nist.gov/dads/HTML/statemachine.html.

Link to comment

Even if some code doesn't actually respond to user interface it could still be useful to model it using a state machine pattern. Useful in a sense that it could actually improve both code readability and performance.

For example: imagine a VI with a "latch when released" switch and a boolean indicator. For every push in the switch you toggle an automatic blinking pattern to the output. I have implemented this solution both with and without state machines. Take a look below. Which one do you prefer?

20st9x5.png

241kqp1.png

nfo6ee.png

without.vi

withSM.vi

Edited by Oakromulo
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.