2 Replies Latest reply on Feb 24, 2015 6:57 PM by bshang

    How to retrieve PIDataPipe events especially for AFDataPipeAction.Refresh?


      Hi all,


      Via the PIDataPipe functionality I want to receive changes using the AFDataPipeEvent class. At the moment I correctly retrieve changes for AFDataPipeAction.Update, AFDataPipeAction.Add and AFDataPipeAction.Delete. However, for AFDataPipeAction.Refresh I don't receive events.


      Could anyone explain if AFDataPipeAction.Refresh is supported within OSIsoft.AFSDK.dll (version If so, how can I simulate retrieving AFDataPipeAction.Refresh results?





        • Re: How to retrieve PIDataPipe events especially for AFDataPipeAction.Refresh?

          Hi Maarten,


          How are you getting the events from PIDataPipe? Are you using the PIDataPipe.GetUpdateEvents method?
          AFDataPipeAction.Refresh is supported in AF SDK 2.6 (note that the PIDataPipe class, AFDataPipeAction, etc. is only the .NET 4.5 version, not the .NET 3.5 version). From what I've seen so far, AFDataPipeAction.Refresh works as fail-safe in case the PI events that come in do not fall into any of the other categories (update, add, delete insert). Perhaps try some out-or-order events? I will do some testing and research as well.



          Currently, none of the DataPipe source we provide (including the PIDataPipe) generates a AFDataPipeAction.Refresh event. The intention of the Refresh Event is designed for Calculation Type DataPipe to report out of sequence events, such that it will handle it instead of doing recalculations using its cached input data. However, we have not implemented such event generation yet in the code. The enumeration is just reserved for now.

          • Re: How to retrieve PIDataPipe events especially for AFDataPipeAction.Refresh?

            Hi Maarten,


            It is the observable (data pipe) that creates the AFDataPipeEvent and sets its Action property (AFDataPipeAction enumeration). Note the property is marked with "internal set". The PIDataPipe may not actually create an event that sets its Action to AFDataPipeAction.Refresh.


            The AF SDK guide mentions the following regarding Refresh.


            The event invalidates all events previously received that follow this event.


            Therefore, one use case for Refresh option is a calculation-type data pipe. It can use a time series cache populated by the data pipe to produce output values from input streams for real-time calculations. If an out-of-order event comes in, then the existing previously received events in the pipe may be invalid and the cache should be cleaned and reinitialized. This can be signaled to the cache manager if the OOO event is marked with Refresh. However, as Daphne mentioned, this option is just a reserved setting for now.


            To simulate retrieving Refresh results, then we need to create our own data pipe or find an existing publicly exposed data pipe that constructs Refresh events.