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: 

Help with State Machine

Solved!
Go to solution

Hello gents, here i attach my first attempts with a state machine program, the steps i want to do are the following:

-read data

-see datas in the graph

-bonus state: if data are not correct click led button in the tab control and then click button to go back to state of see datas in graph, otherwise just click button to go to final state (fine)

- end (fine)

 

Here is my VI i can't quite figure what's the problem, can you help me?

Download All
0 Kudos
Message 1 of 5
(2,107 Views)

Ugh.  "Data" is the plural of "datum".  No such thing as "Datas"  (outside of STNG, I suppose).  Sorry, you're the one millionth customer to make that mistake, so you get the grumpy reward.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 5
(2,079 Views)

Hey, thanks very helpful... it was just a typing error because you can see I wrote it right the first time.

I studied latin so i know that.

Anyway you didn't answer to my question.

 

Quo usque tandem abutere, billko, patientia nostra?

0 Kudos
Message 3 of 5
(2,006 Views)
Solution
Accepted by topic author BonifacioLupo

There is at least a missing subvi in your code, I replaced it with a constant faking some data.

I never used the function Wait for front panel activity, but it does not seem to wait anything, as you would also see running the program with Highlight Execution on. Thus, the program runs through the various states and quickly reaches "Fine". Which is not fine, actually.

To solve this, you may stick to "Bonus wait" until either "Fine" or "Order data" become true, however you need to take care of some details, for example you should initialize all your controls (add an "Init" state to do so), put Wait nodes to prevent running too quick, reset booleans when needed and so on. Also try to keep the BD more ordered, it will help you to think better.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 4 of 5
(1,987 Views)

Yes thanks for the help, apparently the wait for front panel activity function doesn't seem to wait, i solved the issue putting in the inner case structure "0,Default" the state case Bonus Wait, so after a couple quick iterations the function Wait for front panel activity seems actually to wait. 

But i think I'll have to chance approach to the problem in a different way because it won't be very handy in the future if i keep going with this approach to change/choose between states.

0 Kudos
Message 5 of 5
(1,977 Views)