LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Feedback on State-Machine-Design

Hello Community,

 

after I finally understood "event-drive state-machine" I set up a small program based on that design (OPC Server, which creates folders/item and keeps running until stopped).

 

I would like to ask for feedback on how to improve my design (or point out mistakes and such).

 

Thank you for your advice.

0 Kudos
Message 1 of 6
(1,442 Views)

When you press the Stop button i suppose you want to go to the Stop Server-state. 🙂

Also, since you always go to error you can make a sub-vi that checks that instead of all the Select nodes.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 6
(1,410 Views)

Your assumption is correct 😁 I accidentally set it to "exit" instead of "serverStop" (inside the event structure)

 

Would you please elaborate on how exactly that error-handling-subvi is working? I don't think that I understand what you mean... Is it something like "IF an error occurs, pass it to SubVi and determine, in which case the error occured"?

0 Kudos
Message 3 of 6
(1,407 Views)

Yes, it sounds about right. Something like this:

Error check subvi.png

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 6
(1,382 Views)

Well without all the sub-vi's I can't run it but at first glace I would say...

  1. Add Folder 1 and add Folder Status look similar enough they could might be able to be worked into the same State
  2. As for your error Handling 
    1. Use the Error Cluster "Status" to put the error message in instead of carrying it around with another shift register (Also look into custom error codes)
    2. I like to do this so every state does not need redundant code

err.PNG

Now an error in any state will override the next state and go to the error state

 

Also you don't need to unbundle the Status Boolean from the Error Cluster

 

Instead of this:

1Capture.PNG

Just do this:

2Capture.PNG

The Error Cluster is "special" that way.

 

========================
=== Engineer Ambiguously ===
========================
Message 5 of 6
(1,353 Views)

@RTSLVU wrote:

Use the Error Cluster "Status" to put the error message in instead of carrying it around with another shift register (Also look into custom error codes


Oops I meant use the "source" part of the Error Cluster to put your error messages in.

 

With custom error codes you don't even need to do that in every state of your state machine. You can put the custom error messages in the "General Error Handler".vi., which by the way you should be using in your Error state to display your error message.

 

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 6
(1,325 Views)