4 Replies Latest reply on Jun 28, 2018 3:28 PM by Torsten.Lutter

    different behavior in exception reporting of PI API and PI SDK


      We have tested the behavior of the PI SDK exeption reportin (PIPoint.Data.EventPipe) and find out the followin difference to the PI API exception reporting::

      It looks like the Exeption reportin via PI SDK works in a 5 seond cycle. It means the PI SDK cahe exeptions 5 seonds before the SDK inform the appliation by "OnNewValueEventHandler".  To call TakeAll() at event pipe every seond do not get more data.

      comparin to the API: The exeptions are reported immediately (some hundred milliseonds)

      Is this behavior of the PI SDK fix or somewhere confiurable?

      Is the exception reporting at  AF SDK faster?


      best regards    


        • Re: different behavior in exception reporting of PI API and PI SDK



          The AF SDK or the PI SDK do not perform any type of exception testing as done in the PI API. You can see this remark in the AF SDK documentation:


          It sounds like you might be using data pipes in the PI SDK. Could you share some cocde snippet from your application to understand better what you are trying to accomplish?

          3 of 3 people found this helpful
            • Re: different behavior in exception reporting of PI API and PI SDK

              Hi Vincent,


              many thanks for replay.


              Here are the code snippet. It receives snapshot values from a tag. A other application write every second a new value to the tag. The OnNewValue() is triggered every 5 seconds and containig 5 values. With button2 it is possible to trigger a receive manually. But it is always empty. 

              Comparint to my PI API c++ application using pisn_evmestablish() and call pisn_evmexceptionsx(): Here the application get every second a new value.


              The question now is this behavior normal for PI SDK applications? Is the PI AF SDK behavior like PI API ore like PI SDK


              I know, there is no missing data, but the PI Server inform the applicaton up to 5 second slower about new snapshot values!



              using System;

              using System.Collections.Generic;

              using System.ComponentModel;

              using System.Data;

              using System.Drawing;

              using System.Linq;

              using System.Text;

              using System.Threading.Tasks;

              using System.Windows.Forms;

              using PISDK;

              using PISDKDlg;

              using System.Diagnostics;


              namespace PISDK_Tester


                  public partial class Form1 : Form


                      public Form1()






                      private static EventPipe piEventPipe;





                      private void button1_Click(object sender, EventArgs e)






                          PISDK.PISDK piSDK;

                          Server piServer;

                          PIPoint piPoint;



                          piSDK = new PISDK.PISDK();

                          piServer = piSDK.Servers["piserver-2015A"];





                          piEventPipe = ((PIPoint)piServer.PIPoints["Sim5_Win10"]).Data.EventPipe;



                          ((_DEventPipeEvents_Event)piEventPipe).OnNewValue += new _DEventPipeEvents_OnNewValueEventHandler(PI_Monitor_OnNewValue);




                      private void PI_Monitor_OnNewValue()


                          if (piEventPipe.Count > 0)


                              Array events = piEventPipe.TakeAll();



                              PointValue pointValue = null;

                              foreach (PIEventObject evt in events)


                                  pointValue = evt.EventData;

                                  string a = string.Format("{0:00,000} <{1}>: {2}.\n", numericUpDown1.Value, UnixTimeStampToDateTime(pointValue.PIValue.TimeStamp.UTCSeconds).ToLongTimeString(), pointValue.PIValue.Value);














                      private void button2_Click(object sender, EventArgs e)






                      public static DateTime UnixTimeStampToDateTime(double unixTimeStamp)


                          // Unix timestamp is seconds past epoch

                          System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);

                          dtDateTime = dtDateTime.AddSeconds(unixTimeStamp).ToLocalTime();

                          return dtDateTime;




            • Re: different behavior in exception reporting of PI API and PI SDK

              Hi Torsten,


              I believe this question has the same background as your other question: You like to migrate a custom interface from PI API to AF SDK. Please believe me that you don't like to consider PI SDK for the job. As mentioned by Thyag PI SDK is announced for deprecation and if you've experienced how easy it is to build against AF SDK, coding against PI SDK feels pretty painful.


              With regards to your question about update sign-ups, please refer to this other question which has a lot of good answers.


              For a custom interface, you are likely interested in PI Point configuration changes rather than in snapshot or archive updates. Is it? Please refer to PIServer.FindChangedPIPoints Method and note that there is C# and VB.Net sample code available.


              Please let us know if you have additional questions.

              1 of 1 people found this helpful