Components

cancel
Showing results for 
Search instead for 
Did you mean: 

Structured Error Handler Library

Thanks for the response! I was actually trying to detect a range of negative error codes and wasn't quite sure how to enter the range properly with "-" being both for the negative sign on the error code and the indicator that a range is being entered.  Your comment about whitespace was all I needed to solve the problem. 

 

You're right about a range of negative error codes looking a little funny (i.e. -1073807253--1073807252).  Maybe if it were possible to use "to" as the indicator that a range is being entered instead of "-" it wouln't be quite as confusing.

 

Thanks again for you help!

 

Brian

0 Kudos
Message 41 of 117
(11,761 Views)

Yeah, in hind-sight, I'd actually like to change it to "..." to match certain other terminologies in LabVIEW, but doing so would break backwards compatibility, so I'll save it until I need to break backwards compatibility for something else (like adding an additional action on error).

0 Kudos
Message 42 of 117
(11,756 Views)

Ryank,

 

I've been working on creating an error handling strategy for my cRIO application, based on the SEH library.

 

I'm wondering if there is a way to have the standard SEH palette (non-RT SEH) show up when i'm developing VIs on the cRIO? I would like to keep the error source string intact (my loop rates are slow enough that string manipulation jitter will not have an adverse effect. It is more usful to have the error source string)

 

-JimM

--------------------------------------------------------------------------------------------------

--CLD--
LV 6.1 to 2015 SP1
0 Kudos
Message 43 of 117
(11,681 Views)

Hi Jim,

 

Editing the RT specific palette is a bit tricky.  I can think of two ways you could do it.  First, you could use VI Package manager to just create a new package out of it, VIPM allows you to specify what you want on the palette for each target, and it's how I create the different palettes.  Second, you could just use the palette editor in LabVIEW to add a duplicate palette of the Windows VIs, it won't let you edit the RT palette, but you could create a duplicate palette that will show up in both locations.

 

I would be remiss if I didn't mention that determinism isn't the only reason I try to minimize dynamic string maniplulation on RT.  String manipulation is going to allocate memory, which over time has the possibility of fragmenting the memory in your controller, and reducing performance or eventually causing a memory allocation error.  By itself, the error handling code isn't likely to do that very quickly, but when combined with other things which may be dynamically allocating memory it can worsen the problem.  I prefer to use the error categorization to identify the location of my errors on RT rather than including the source string, but as long as you're comfortable with the tradeoffs (i.e. as long as you include memory monitoring code in your application and have stress tested it for longer runs) then there is certainly no reason you can't use the more full-featured Windows version.

 

Regards,

Ryan King

Systems Engineer

National Instruments

0 Kudos
Message 44 of 117
(11,671 Views)

Ryank,


Thanks for the reply.

 

To your 1st point, would I just create the VIPM file from the /user.lib/_SEH folder where the VIs are already installed?

 

As to error categorization, could you give some example catagories you use? I'm assuming that to add a catagory to the Central Handler, you just add a 4 letter string to the case structure after the "U32 to String" function?

 

 

--------------------------------------------------------------------------------------------------

--CLD--
LV 6.1 to 2015 SP1
0 Kudos
Message 45 of 117
(11,665 Views)

Hi Jim,

 

I find that it actually works better if I copy it out of user.lib first.  If you're curious, here is my build process (I develop in user.lib, and trunk is just some other folder):

1. Back up trunk and user.lib

2. Copy user.lib to SEH in trunk, make sure not to delete or overwrite the .vipb file or Errors directory

3. Delete _SEH from user.lib

4. Mass compile SEH in trunk

5. Open .vipb file

6. Update fix number

7. Build

 

As far as categorization goes, you are correct, you can just enter any 4-letter string into the case structure of the central error handler.  I commonly use categorizations which give me information about both the type of the error and the location.  For example COMM lets me know that the error occurred in my network communication, and also gives me a good idea of what I might need to do with it (log it and reset the communication for example).  An alternate approach might be to use two of the characters to represent the location and the other two to represent the categorization, so for example HWCR might represent a critical error from a hardware loop, and CMWR might represent a warning from a comm loop.

0 Kudos
Message 46 of 117
(11,660 Views)

Thanks.

 

I think I will try the 4-letter ID tags first to avoid string manipulation over the long-term

--------------------------------------------------------------------------------------------------

--CLD--
LV 6.1 to 2015 SP1
0 Kudos
Message 47 of 117
(11,648 Views)

RyanK,

 

This concerns the SEH actions (Display, Log, Safe State, etc...). On a PC, the "Display" action might do something like pop-up a dialog window for the user to read a message.

 

On a RT system, what logic do you recommend implementing here to "Display" a message to user. Assume the RT system is attached to an HMI.

--------------------------------------------------------------------------------------------------

--CLD--
LV 6.1 to 2015 SP1
0 Kudos
Message 48 of 117
(11,620 Views)

Hi Jim,

 

The display state on an RT system is reserved for sending a message to your user interface.  There are a couple of ways to do this.  If it's not essential that you report every error message, a UDP transmission mechanism such as syslog is a great way to fire one off, and a UDP transmission is fast enough that it's probably safe to use from directly inside the central erorr handler.  Here's an example using syslog:

undefined

If you need to ensure message delivery, or if you need a response from the user, then you will need to create a messaging system using Network Streams (recommended) or STM (not recommended unless your HMI is something other than LV for Win).  In that case, you'll probably need a loop dedicated to the communicaiton, and the display action should send a message to that loop.

 

Regards,

Ryan King

Systems Engineer

National Instruments

0 Kudos
Message 49 of 117
(11,615 Views)

Ryan,

 

Thanks for the quick response. I've been working on implementing a messaging system, so I think I will pursue that route.

--------------------------------------------------------------------------------------------------

--CLD--
LV 6.1 to 2015 SP1
0 Kudos
Message 50 of 117
(11,613 Views)