05-05-2009 02:33 PM
05-05-2009 03:25 PM
The first thing I noticed was that it does not look like you are releasing your queue when you are done with it.
You have error clusters strung through but no error handling that I can see. A good practice is to use shift registers on your error clusters and place your dequeue in a case with the error cluster wired in it. That way if an error occurs, you can run an error case to handle it instead of dequeuing that loop.
You have a lot of enqueuing and not a lot of dequeues. It looks like you are running your stated with the preview queue and then dequeuing inside the subvi to get the item out of the queue... I would suggest running the tates from a dequeue and anything that needs top be scanned constantly, do that in an idle case. this is done by setting a timeout on your queue and if it times out, send an "idle" to the selector on the case
It also looks like you are enqueing a lot at the oppisite end. This may be necessary for you your doing, but that can result in your queue building up (i.e. adding more to the queue than you are reading off, espically since you are running your cases from the preview)
I can look at it in more depth later but those are the items that pop out at me.
You may also want to change your top loop to use an event structure and move all those sub vis that look like they are monitoring or scanning into an idle case as I described earlier.
Try doing a search for "queued state machine" and you will probably find quite a bit of nice advice/archatechure/templates/etc for what you are trying to do. Specifically it look like you are trying to use it as a producer consumer dual loop structure.....
Hope this helps a little
Cheers
Greg05-05-2009 04:29 PM
If not using events as suggested on the upper post, at least use a wait on that polling loop (upper loop). Does not look too bad, that code. Implement what you learn and keep on comin'. I hesitate to fight minor miscoding until next revision.
Felix
05-05-2009 06:03 PM
F. Schubert wrote:If not using events as suggested on the upper post, at least use a wait on that polling loop (upper loop). Does not look too bad, that code. Implement what you learn and keep on comin'. I hesitate to fight minor miscoding until next revision.
Felix
Unfortunately there probably wont be a revision by me. This is for my job while at college but Im graduating next weekend and going off to the "real world" where I'll also be using labview. I will direct the person taking over for me to this thread though if they need any advice.I just wanted an overview that I can take with me cuz im sure this wont be the last time i see this architecture :). Thanks again, these forums are helpful as always!