I´m struggling with my Error Handling in my Producer/Consumer Pattern. I made a small example which reproduces the Problem.
My Consumer gets the next case from my QueueManager.vi which is in the corresponding Loop. This Manager just Looks for Errors and if there is an error it will initialize the "error Handling and Loggin to File" procedure and if not it will send the next case to the Queue. To Close my Programm i will use the Method using notifiers and waiting for the lower Loops to Close before i Close Main Loop and then the Event Loop(initiated with an userevent). This works perfekt as Long as no error occurs. When an Error occurs my Queues repeat the case they got initialized with all the time and i can´t Close the Programm normally anymore. I tried a lot but i can´t find the Problem in my code.
When i observe it seems to work normal but the Queue makes a Problem somewhere. Hope someone can explain my this Problem.
To use my example simple start ErrorRepli.lvproj and open ProducerConsumerEvents 3. Than just click on Exit all Queues with error =False and Probe the StateArray in the Block Diagramm. Everything will work normal. Than turn error on and do the same. It will just repeat adding "IDLE" to the Queue but this case will never be added programmaticly to this Queue. So i´m wondering why this happens when an error occurs.
found a mistake which maybe confusing and removed it.
Ok this should be easier to understand now. when u use error = True u can only stop the Programm when you press stop and then you will see in the Arrays what i explained above.
Ok this is now doing what i want, but i don´t really understand the difference between sending a MSG to the Queue in the Error Cluster compared to out sending it out of the Error Cluster. It seems that the enqueue msg node will stop the SerialQueueManager.Vi when an error comes in. This is my first attempt doing error logging in my program and it confuses me a bit where i can pass Errors and where i can´t do that. I´m happy for better Solutions if u have one. I want to gather all Errors from all Queues in the main Queue and write them to the log file after the error happened and then clear it or stop the program depending on the error.
Your code is quite messy...
here is another example of what can guide you to where you need.
There is some dependency that might missing in the example I sent you.
What version of Labview are you using?
thank you for the answer to my post. I´m using 2015 right now but wanna switch to 2018 as soon i can manage it. I like the way you handle the user Events. Can u be more precise what u mean with messy? It is not very well written cause i made a quick example which showed my Problem. I´m rewriting a Project which has been growing for 3 years now and i constantly learned new stuff during this time and changed stuff. So some Parts of my Programm are less some more messy ;-) I´m in the procedure of making everything not messy :-) so i´m glad about any criticism :-)
Well Spaghetti code is never a good thing. I'm glad that you are trying to make it better.
I suggest you to look on the standard way to do LabVIEW programming. If you ever be able to do the CLAD and CLA it will force you to do very good code....