LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

error handling structure design question

I've got a style/structure design question that i'm assuming a more experienced LabVIEW developer might be able to answer for me.  I have posted about this application before but not on this specific issue.  Currently I am running 2 parrallel while loops.  The first is an even structure which is able to take in input from the user.  The second is a state machine.  They communicate with each other through a queue and each time the queue element includes the state of the test it is running, the next state of the machine, and the user settings. 

 

I assume this is a common way to structure larger more complicated programs but i was wondering what the best way is to handle errors?

currently I have a state in the state machine for error handling which displays the general error message dialog and clears the error and sends the state machine back to idle and waits for user input.  If anyone has any suggestions on how to improve this kind of design i would definitely be open to hearing them.

 

I have also thought of a couple solutions myself but didnt know which would end up more robust.

1.  I could add an error cluster inside of the queue element cluster and then have a third while loop for processing errors but i'm not sure if i want to do that as I'm not sure how I would be deciding who would queue and dequeue what elements in the queue and i think it might get really complicated really fast and right now i am really trying to program for simplicity.

 

2.  I dont want to go too in depth in this but i was thinking that when an error occurred i could save the state somehow and correct the error somewhere (but where??) and then retry the state.  I know someone has had to have come up with the latest robust/maintainable way to do this.

 

any help is appreciated.

 

Brent

0 Kudos
Message 1 of 3
(2,565 Views)

Brent,

 

It depends on what kind of application you have and what kinds of errors can occur.  Are the errors something which the program can handle without user intervention or do they require user input?  Can undesired or unsafe things happen due to an error or while an error is being handled?

 

Generally for errors which can be handled by the software, an error handling state in the state machine is good.  If the user must handle the errors, put the system into a safe state and wait for the user input.

 

If you go for a third loop, which is probably unnecessarily complex, use multiple queues.  Queues are best if read at only one location.

 

ynn 

0 Kudos
Message 2 of 3
(2,563 Views)
thanks for those guidelines on some basic error handling.  I suppose i just need to evaluate the what i have going on and the decision making process should be easy 🙂
0 Kudos
Message 3 of 3
(2,539 Views)