LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

yes no state machine

I am trying to figure out the best way to build a troubleshooting table into my program.  I thought a state machine myabe the best way to do that.  I am not familiar with using state machines and have looked at a few examples but can't quite figure out how to do what I want.  I basically want to put di this happen yes or no then go to another step that ask if this happened yes or no.  That type of setup but for some reason I keep getting lost.  I was using boolean switches for yes and no.  If anyone could help me out it would be greatly appreciated.  I am using labview 7
 
Thanks
Dave
 
0 Kudos
Message 1 of 5
(3,151 Views)

Hi Dave

I'm not sure about what you want to do. But I try do explain you the state-machine a little-bit.

As you might have seen in the examples, a state-machine consists of three components which are while-loop, case-structure and a let's call it state-control. The while-loop ensures, that the state-machine is executed and the new state is passed to the case-structure. So to control the case-structure, you need to insert a shift-register. The type of state-control is free - you can use numbers, strings or other suitable types. I usually use enums, which are created as strict type def. custom controls, so I can insert states at the end of it. All usages of the control are updated automatically and I can use "speaking" state name.
So to start with the state-machine, place a while-loop on the diagramm and place a case-structure inside this loop. Add a shift-register to the loop. Create at least to states in the case-structure (init and exit) and wire the value for the init-case to the shift-register (so if you start the state-machine, it first executes the init-case). From the exit-case, wire a boolean constant to the while-loops condition-terminal, so that the loop stops executing after the exit-case.

So if you tried to make a state-machine using a boolean, you might have missed something. Just have a look at the examples again.

Hope this helps.

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 5
(3,131 Views)
Many troubleshooting guides are laid out in the form of a flow chart, which should map directly to a series of If-Then functions. Has your table been drawn in flow chart format? Multiple possibilities for a test result may be best handled using Case structures with the result coded into a single testable variable. (E. g., Fly (1x) or Crash (0x), Burn (x1) or No Burn (x0) would have the possibilities of Fly, Fly and Burn, Crash without burning, or Crash and Burn, which would be coded 10, 11, 00, and 01 respectively.)

Don't worry too much about getting a state machine. By the time you have finished translating your flow chart into a program, complete with test selections based on previous data collection and test runs, repairs and adjustments, you will have a state machine by definition (i. e., the state depends on previous conditions, possibly with more than one troubleshooting path to that state, depending on the system under test).

"When you are up to your armpits in alligators, it is difficult to remember that your original intention was to drain the swamp." Smiley Surprised Shoot one alligator at a time, but make sure you are wading in the direction of the pumping station. Smiley Wink

Paul Bade
0 Kudos
Message 3 of 5
(3,128 Views)

Hi Dave,

Like Becktho said, I am not sure if I follow you.

It sounds like you are trying to get the condition of some logic signal at one time and then need to know that result latter. If that is the case the following images of how I have have handled this in the past may help.

In my case I had to auto-scale an instrument and while adjusting the range and drive, I needed to track if any of the settings changed in order to re-check the others. This is illustrated in the state diagram below.

After some start-up I clear a set of "tweak flags" that track if any changes were made. See code below.
 
 
If something was changed, I set the appropriate tweak flag
 
 
and then latter check if any flags are set
 
 
and then direct flow accordingly.
 
I hope this helps,
 
Ben

Message Edited by Ben on 10-17-2005 01:29 AM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 5
(3,123 Views)

Hi Paul,

 

Thanks for your suggestions, but I am not sure I follow what you mean by putting itinto a sequence.  You have to bear with me I don't have a lot of Labview experience.  Here is a copy of the flow chart that I am going by.

 

Thanks

Dave

0 Kudos
Message 5 of 5
(3,094 Views)