LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel errors in SubVI

Solved!
Go to solution

I'm trying to impliment proper error handling for a datalogging program.  I have a subvi that reads from several bound variables, each of which has its own error in and error out.  Is it okay to wire them in parallel as I have shown in the attached picture or do I need to put them all in series?  I thought it looked a lot cleaner to have all the tags stacked nice and neat, but I'm more interested in learning the correct way.

 

Thanks in advance.

0 Kudos
Message 1 of 7
(2,785 Views)

You have to be careful when you have multiple error sources.  There is nothing "Wrong" with what you've shown HOWEVER, only the first error will make it to your simple error handler.  In your png you aren't doing anything like warning the user here but you are returning the error back to the caller.  Did you hide the most important error?

 

Now lets look at that string constant.  go back and read the help on that simple error handler....

 

Now that you read that help it doesn't make a lot of sense does it?

 

Spoiler
If no error set source to string, else pass error unchanged

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 7
(2,766 Views)

That will work.  The difference between the way you are wiring it and putting them in series is if you wire them in series the variables will be read in that order whereas in parallel you don't know what order they will be read.  The error reporting will work either way and one is not "better" than the other.  It will all depend on your needs.

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 3 of 7
(2,763 Views)
Solution
Accepted by topic author Jeff@VMI

Shared variables all communicate through the same process, so accessing multiple variables in parallel can cause performance problems due to scheduling conflicts.  It is better to serialize the shared variable calls to better optimize performance.  See the Use Shared Variabes Effectively help topic for more details.

 

In general, it isn't helpful to parallelize small snippets of code like you are doing, unless there is a specific need for concurrent execution.

Message 4 of 7
(2,757 Views)

Instead, make an array of errors (you can use "build array" in place of the "merge errors") and then you can report each and every error you encountered.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 7
(2,744 Views)

That link is very helpful, thank you.

0 Kudos
Message 6 of 7
(2,732 Views)

You're right, I missinterpreted the tooltip.  Thank's for pointing that out.

0 Kudos
Message 7 of 7
(2,731 Views)