RJ Gross - Portfolio -
  • Home
  • About
  • Portfolio
  • Curriculum Vitae​
  • Blog

The Humble State Machine

5/8/2022

1 Comment

 
Definition: "A state machine reads a set of inputs and changes to a different states based on those inputs." 

Building the Foundation

There are usually two schools of when it comes to programing: The Linear Execution or The state machine. 

The Linear Execution: An example is the small code snippets that I discussed about coils. They serially operate code once in order then stop.

The State Machine: Is a continuous loop that runs linear executions based on the input and reacts based on the results. 

Probably one of the most enjoyable things that I enjoy about LabVIEW is how easy it is to build state machines.

The States 

The point of this project is to safely execute a series of commands to hot fire lots of expensive hardware. Here is a list of states that I would like to incorporate so far: 

​0 - MAIN/WAIT 
1 - INITALIZE
2 - SYSTEMS CHECKS
3 - MANUAL CONTROL
4 - EDIT CAMPAIGNS
5 - ABORT SYSTEM
6 - DATA STORAGE
7 - ARM 
8 - START AUTO SEQUENCES 
9 - HOLD AUTO SEQUENCE
10 - SAFE STAND
Picture
Typically I like to build my state machines with the first state or default state as the Main or Wait state. This means all Inputs originate or wait at the Main and then cascade out to the other sates. Note: State 1 does not have a human input. This state in actuality is the first state that runs (typically once), this state re-initializes and nulls inputs. This state can be run again however only in special circumstances. 
Picture
In LabVIEW tools, a state machine is simply a while loop with a shift register and a case structure. I personally like to add the use of a Event Structure coupled with the "Select" comparison tool to make the execution of the (Human controls) more stream lined. 

I also like to use "Enumerated Constants" this give a selectable string value to a numeric constant. This is helpful for code debugging and visuals, cuts down on the amount of labels. However, if more states needed to be added they all should be replaced to have the most current list. 

Executing the State 

The code snippet above shows the Abort sequence execution after the human control input is selected. When a change in Input value occurs state 5 is executed.

Shown below: The linear execution code then runs turns off all coils, read the coils, and then gray & disable the test stand fire control inputs. This abort sequence will eventually get more tailored based on actual hardware, but for now helps me debug the states. After all code is executed in state 5 the "enum constant" returns the code to 0 to wait for the next input. 
Picture
Future posts will discus the states in more detail when hardware is finalized. 
1 Comment
Joseph Torres link
11/14/2022 04:07:59 pm

Feeling suggest interview myself whose air body. Difference anyone charge Mr summer.
Game feel night everything. Parent expert benefit blood clear.

Reply



Leave a Reply.

    Rocket Test Stand Controller Project

    This blog will cover the development of my hybrid LabVIEW & PLC rocket engine controller. 

    Archives

    May 2022
    April 2022

    Categories

    All

    RSS Feed

Proudly powered by Weebly
  • Home
  • About
  • Portfolio
  • Curriculum Vitae​
  • Blog