Jump to content
News about the LabVIEW Wiki! Read more... ×
Wouter

Filter Error Codes (Error Package)

Recommended Posts

This OpenG Review is closed. See Summary Post here. Please start a new thread to discuss new changes to this VI.

VI Name:

Supress error

Total VIs:

2

Description:

This VI has a integer (array), error code, as input and when the error code matches the error code on the error wire it supresses the error.

Note:

-

Blockdiagram:

Scalar:

gallery_17774_56_10750.png

Array:

gallery_17774_56_8070.png

Code:

Supress Error.zip

What are you thoughts on this VI?

  • Would you like to see such a function in OpenG?
  • Can you optimize the code?
  • In which package should it be included?
  • Should it be rejected?

Edited by jgcode

Share this post


Link to post
Share on other sites

FWIW, I have a similar reuse VI in my library (I think it was originally based on one from an NI course)

Anyway, I would recommended clearing the error as opposed to using the constant (just in case there is anything NI handles under the hood in the future etc...)

I never created an array version (as never have the need) - not saying one wouldn't be useful.

post-10325-0-29058800-1317898584_thumb.p

post-10325-0-73831400-1317898823.png

Clear Specific Error.vi

Code is in LabVIEW 2009.

Share this post


Link to post
Share on other sites

There is nothing special about the clear error. It is just a control and indicator unwired.

These are my versions of the clear error and clear specific error (you can find them in many of my submissions to the CR) that uses far less realestate and can be placed between property nodes (and similar) without having to route wires around.

Edited by ShaunR

Share this post


Link to post
Share on other sites

I've had two versions of the array type.

My first attempt uses a for loop. It has the added benefit/feature of inputting an empty array will remove all errors.

post-11268-0-37374100-1317905001.png

My second attempt uses the Search 1D Array and check to see if the resulting index is greater than or equal to 0. This should be a little faster than comparing all of the array and OR the results.

post-11268-0-28778100-1317905009.png

Similar to Shaun, I made the icons small so I can fit them between property nodes.

post-11268-0-12962500-1317905389.png

Share this post


Link to post
Share on other sites
These are my versions of the clear error and clear specific error (you can find them in many of my submissions to the CR) that uses far less realestate and can be placed between property nodes (and similar) without having to route wires around.

Really? :P

I had a hunt as to aid the discussion. I could only find this in OPP from your LAVA CR files but I may have missed it?

post-10325-0-17682200-1317909760_thumb.p

Your snippet obviously is missing your reuse subVIs - do you mind posting?

Cheers

-JG

I also think the we should polymorphize the API here too for the Error Code input.'

Should we support an array of Errors In too?

This would mean a total of 4 VIs - most likely with the Error In array as a thin wrapper around the above mentioned VIs (no function changes).

I have made this into an OpenG Review.

Share this post


Link to post
Share on other sites

Really? :P

I had a hunt as to aid the discussion. I could only find this in OPP from your LAVA CR files but I may have missed it?

post-10325-0-17682200-1317909760_thumb.p

Your snippet obviously is missing your reuse subVIs - do you mind posting?

Cheers

-JG

I also think the we should polymorphize the API here too for the Error Code input.'

Should we support an array of Errors In too?

This would mean a total of 4 VIs - most likely with the Error In array as a thin wrapper around the above mentioned VIs (no function changes).

I have made this into an OpenG Review.

Ahh. I see what you mean (I thought it was at least in Dispatcher-have to check)

Here they are).

Edited by ShaunR

Share this post


Link to post
Share on other sites

Only thought is that it's suppress. ;)

Share this post


Link to post
Share on other sites

I just updated my second implementation from above to add a check for an empty array being passed in. So now all errors will be cleared if the array is empty (which is currently the default). Is this a desired feature to clear all errors?

Clear error.vi

Share this post


Link to post
Share on other sites

I also think the we should polymorphize the API here too for the Error Code input.'

Should we support an array of Errors In too?

This would mean a total of 4 VIs - most likely with the Error In array as a thin wrapper around the above mentioned VIs (no function changes).

I think we all agree on the functionality of the VIs which is good.

The only functionality I am unsure of is this:

I just updated my second implementation from above to add a check for an empty array being passed in. So now all errors will be cleared if the array is empty (which is currently the default). Is this a desired feature to clear all errors?

IMO: If you want to clear all errors then you should use the Clear Errors VI.

If an empty Error Code Array is passed in, then it contains no Error Codes and therefore no Errors should be cleared?

Ok, here is the API I am envisaging...

I have gone with the standard size/shape VI given that other Error VIs are of this size (Clear Errors, Merge Errors, Build Error Cluster etc...)

It seems to me even an inline VI size/shape would still get in the way of the outputs of the Property Nodes anyway?

E.g.

post-15232-0-78848100-1317901821.png

The core VIs:

post-10325-0-77867800-1317992315_thumb.p

post-10325-0-56791300-1317992506_thumb.p

The thin wrappers for Error Array support:

post-10325-0-20873200-1317992311.png

post-10325-0-62450600-1317992317.png

The Polymorphic API:

post-10325-0-67010900-1317992321.png

Documentation:

post-10325-0-22741000-1317992320.png

Here are some examples of inputs/outputs of the API:

post-10325-0-77079600-1317992324_thumb.p

Here are the results:

post-10325-0-50927300-1317992327_thumb.p

Clear Specific Error.zip

Code is in LabVIEW 2009

  • Like 1

Share this post


Link to post
Share on other sites

Looks good JG. I think we have left one discussion... what kind of icon should the VI have? One that is fits between property nodes or the one we have now?

And I would change the label of "Error Code Matches" to "Error supressed?", I find the first terminology pretty vague namely.

Edited by Wouter

Share this post


Link to post
Share on other sites

Looks good JG. I think we have left one discussion... what kind of icon should the VI have? One that is fits between property nodes or the one we have now?

I'm for the smaller icon personally.

And I would change the label of "Error Code Matches" to "Error supressed?", I find the first terminology pretty vague namely.

Since this VI is called "Clear Specific Error.vi", it should really be "Error Cleared?".

For the error array VIs, would it make more sense for this indicator to be an array so the user can figure out which error was cleared?

Share this post


Link to post
Share on other sites

I'm for the smaller icon personally.

Since this VI is called "Clear Specific Error.vi", it should really be "Error Cleared?".

For the error array VIs, would it make more sense for this indicator to be an array so the user can figure out which error was cleared?

I'm onboard with everything here. Especially since NI's verbiage uses cleared, that's what users starting with OpenG might look for.

Share this post


Link to post
Share on other sites

Since this VI is called "Clear Specific Error.vi", it should really be "Error Cleared?".

I agree - I will change Error Code Matches to Error Cleared?.

For the error array VIs, would it make more sense for this indicator to be an array so the user can figure out which error was cleared?

The depends - what are your use cases? Are you going need that information to go back through the array and index out that cleared error or make a decision based on that error etc...? Or do you care that an Error was cleared in the Error Array you passed in? That information is there - you could wrap the Core VI in your own For Loop if needed, it guess its a question of what is the main use case.

We made a similar design decision for e.g. Compare Two Paths when polymorphizing the API:

post-10325-0-75180400-1318029582_thumb.p

I'm for the smaller icon personally.

I am still not convinced about this given:

  • We currently have two inputs and two outputs, and 4x2x2x4 allows for future expand-ability (not a requirement but a nice to have as we have other methods for dealing with this).
  • Other Error VIs are of this size (Clear Errors, Merge Errors, Build Error Cluster etc...)
  • An inline VI size/shape would still get in the way of the outputs of the Property Nodes anyway (from the above images posted)?
  • New users would be familiar with the iconography in the palette as it is similar to Clear Errors etc...

If anyone can provide a list of pros/cons for the smaller icon, please do.

Share this post


Link to post
Share on other sites

Hi All,

This is a great discussion!

In an effort to support this, JKI has decided to donate (to the community via BSD license) a couple relevant VIs into the mix, in the hope that they might contribute some design inspiration to this discussion:

JKI - Clear All Errors and Filter Error Codes.zip

The first VI is called Filter Error Codes and filters either a scalar or array of integer error codes. It also returns the information about the error that was filtered, which is useful for handling that error.

post-17-0-83497500-1318030375.png

This is what the array implementation looks like:

post-17-0-64955300-1318031236_thumb.png

And, here's what the scalar implementation looks like -- you can see it just calls the array implementation.

post-17-0-62224500-1318031304_thumb.png

The second VI is called Clear All Errors, which is just like NI's Clear Errors, but a lot more compact, which is nice :)

post-17-0-92960900-1318029916.png

Cheers!

  • Like 2

Share this post


Link to post
Share on other sites
In an effort to support this, JKI has decided to donate (to the community via BSD license) a couple relevant VIs into the mix, in the hope that they might contribute some design inspiration to this discussion:

Awesome - thanks!

Quick design question - why pass out and maintain a new data-type (which is a subset of Error cluster) when an Error cluster could just be passed out?

post-17-0-64955300-1318031236_thumb.png

Cheers!

-JG

  • Like 1

Share this post


Link to post
Share on other sites

Quick design question - why pass out and maintain a new data-type (which is a subset of Error cluster) when an Error cluster could just be passed out?

Great question! We actually had a long debate about this at JKI, back when this function was designed.

If I recall correctly, here is the thinking behind it:

  • it avoids the possibility of accidentally confusing (miss-wiring) the filtered error details with error out
  • most of the time (e.g. the scalar error code to filter use case) you only care about the Boolean output error filtered? (e.g. wiring it up to a Case Structure's case selector or similar) so we decided to make that raw Boolean an output of the VI, rather than requiring the user to unbundle it from the filtered error details.
  • in the case where you want more information about the filtered error (like if you passed in an array of error codes to filter and need to know which one occurred), then you can unbundle the code or source string from the filtered error details cluster.
    • We didn't include the Boolean error filtered? in the filtered error details cluster since that would be redundant (the Boolean is already an output of the VI). And, if we did actually add the Boolean error filtered? to the filtered error details cluster, then it would look a lot like an error cluster and we would then probably want to name the Boolean status (since that's what it's called in a normal error cluster), which does not convey the intent nearly as well as calling it error filtered?.

And, after years of using this VI, I don't have any complaints about the design of the VI (and haven't heard any complains from others at JKI) :)

Share this post


Link to post
Share on other sites

What is exactly the functionality/use of the 'upstream error'?

It e.g. allows you to check for an error from a specific task, handle it (e.g. clear it) whilst persisting error information from previous code (upstream).

Normally I would merge this external to the VI, but I like the fact that the merge is included in the VI (one less thing to do).

  • Like 1

Share this post


Link to post
Share on other sites

It e.g. allows you to check for an error from a specific task, handle it (e.g. clear it) whilst persisting error information from previous code (upstream).

Normally I would merge this external to the VI, but I like the fact that the merge is included in the VI (one less thing to do).

That's right. It's a real space saver to not have to merge errors as a separate function call. And, this is a standard that I hope can be adopted, if others agree that it makes sense.

Note: I think we should add this "upstream error" to the "Clear All Errors" function, too.

  • Like 1

Share this post


Link to post
Share on other sites

That's right. It's a real space saver to not have to merge errors as a separate function call. And, this is a standard that I hope can be adopted, if others agree that it makes sense.

Note: I think we should add this "upstream error" to the "Clear All Errors" function, too.

Here is an example of Clear All Errors with the Upstream Error, pretty simple BD:

post-10325-0-20963900-1318138509.png

Can anyone help with the Connector Pane

3x1x1

Shows the Upstream coming in from the top in context help (although you can wire it from the bottom).

post-10325-0-16483600-1318139145.png

5x3x3x5

(Note: Upstream will actually be optional, I was just playing around with the CP).

post-10325-0-73270700-1318138503_thumb.p

What are peoples thoughts on the VIs that Jim has donated?

Personally aside from the Upstream Error feature, I like that the core VI is the Array and the Scalar is the wrapper so there is only really one lot of code to maintain.

Another question following on from my previous ones - there is enough CP outputs to output all three cluster elements separately (as opposed to the boolean and new cluster) - was there a specific reason not to do this?

Clear All Errors.vi

Code is in LabVIEW 2009

Share this post


Link to post
Share on other sites

Can anyone help with the Connector Pane (note: Upstream will actually be optional, I was just playing around with the CP).

post-10325-0-73270700-1318138503_thumb.p

Here's a conpane that gets one step (another pixel or two) closer.

post-17-0-78483800-1318139305.png

Clear All Errors.vi

One comment that I want to make, that's actually a case for note adding an Upstream Error, is that it's possible to easily misswire the Error in (error to be cleared) and the Upstream Error. And, if misswired, the result is exactly the opposite of what users would intend -- that would lead to quite an insidious bug. However, Error In (error to be cleared) should probably be made a Required Input, which would certainly help users identify if they accidentally misswired in a way that left Error In (error to be cleared) unwired.

Share this post


Link to post
Share on other sites

However, Error In (error to be cleared) should probably be made a Required Input, which would certainly help users identify if they accidentally misswired in a way that left Error In (error to be cleared) unwired.

Yer, that was my though too from the initial CP I posted:

post-10325-0-16483600-1318139145.png

Or we could leave it out (no Upstream Error as per the example you posted)?

Share this post


Link to post
Share on other sites

Yer, that was my though too from the initial CP I posted:

post-10325-0-16483600-1318139145.png

Or we could leave it out (no Upstream Error as per the example you posted)?

The pitty is that in almost every instance where I use Clear All Errors, I use Merge Errors to merge in upstream errors. So, I think it's a really useful design pattern. My vote would be to make the Error In a required input.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×

Important Information

By using this site, you agree to our Terms of Use.