02-25-2021 06:29 AM
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.
02-25-2021 07:50 AM
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.
02-25-2021 07:56 AM - edited 02-25-2021 07:58 AM
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"?
02-25-2021 09:47 AM
Yes, it sounds about right. Something like this:
02-25-2021 02:38 PM - edited 02-25-2021 02:44 PM
Well without all the sub-vi's I can't run it but at first glace I would say...
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:
Just do this:
The Error Cluster is "special" that way.
02-26-2021 09:07 AM - edited 02-26-2021 09:11 AM
@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.