2 Replies Latest reply on Jan 30, 2012 6:41 PM by fbatista

    Error handling in PI ACE

    fbatista

      Hello everyone,

       

      I am writing a PI ACE calculation to take the information from a single tag to send to several other tags. It is a sort of "demultiplexer" basically. I am using a PI ACE funtion "FindEQ", that may fail when it does not find a given value in my search window (as expected). So to deal with this fact I had to use the Try...Catch commands.

       

      When I started my PI ACE calc, I noticed that the "Try ... Catch" statements were ignored by PI ACE executable. In other words, I get a calc failed even if the error falls inside a Try... Catch. I found somewhere in the PI ACE training documentation a recommendation to use the "On Error .. Go To" command, but there was no mention to the "Try.. Catch" command. But aren't they equivalent commands?

       

      Another question is regarding the error monitoring. I tried to log Exception Error messages into the PI ACE log, but I any of my custom messages appeared in the local PI SDK log file. Here is the command I used:

       

      OSIsoft.PI.ACE.

       

      PIACEBIFunctions.LogPIACEMessage(OSIsoft.PI.ACE.MessageLevel.mlUserMessage, ex.Message, Context)

       

      What am I missing here?

       

      Any help will be appreciated. Thanks a lot!

        • Re: Error handling in PI ACE
          hanyong

          Hi Fabiano,

           

          Yes, you should be able to use the "Try ... Catch" block to capture any exceptions during the execution of the ACE calculation. You can refer to one of the previous post here about this. Notice that even when we capture the exception, you should be using

          OutputTag.SendDataToPI = FALSE

          statement to tell PI ACE not to write "Calc Failed" event to the output tag at the end of execution.