2 Replies Latest reply on Jan 16, 2012 2:08 PM by mhamel

    Performance of EventPipes with PISDK over high latency links

    GBADI0

      Hi, 

       

      I am building a processbook that will display events based on an event pipe in a list box using PB 3.2.3.0 with PI SDK 1.3.6.363

       

      I have some code which looks like this which will build the eventpipes.

       

       

       

       

       
      Private Sub ConstructEventPipes()
          
          On Error GoTo errHandle
          
          Dim objAlarm As PISDK.pipoint
          Dim i As Integer
          
          Set EventPipes = New Collection
          Set objEvents = New Collection
          
          For i = 1 To AlarmList.Count
              Log "Getting Event Pipe " & i & " of " & AlarmList.Count, "alarms.ConstructEventPipes"
              EventPipes.Add AlarmList.Item(i).Data.EventPipe
              
              VBA.DoEvents
          Next
          
      errHandle:
          If Not err.Number = 0 Then Log err.source & ": " & err.Description, "alarms.ConstructEventPipes"
          On Error GoTo 0
      
      End Sub
      

       This works well over a local connection to the PI Server. With higher latency links the code gets exponentially slower through the for next loop.

       

      Any suggestions on a better way to do this, or improvements to the existing code?

       

      Thanks

       

       

        • Re: Performance of EventPipes with PISDK over high latency links
          GBADI0

          Hi,

           

           

           

          Realised my error here :-)

           

          Best use one event pipe with a collection of points to monitor, something like this

           

           

           

           

           
          Private Sub ConstructEventPipe()
             
              On Error GoTo errHandle
                 
              Set objEvents = New Collection
              Set objEventPipe = objAlarmList.Data.EventPipe
              
          errHandle:
              If Not err.Number = 0 Then Log err.source & ": " & err.Description, "alarms.ConstructEventPipe"
              On Error GoTo 0
          
          End Sub
          

           

           

          Much quicker now.

           

           

            • Re: Performance of EventPipes with PISDK over high latency links
              mhamel

              Hi Alexander,

               

              I don’t see in your code a place where you invoke the Take or TakeAll methods to free up the queue of events. It seems that you add a reference to the entire EventPipe object every loop and that object contains more and more items. This would certainly go in line with the behaviour you observe that is exponentially growing.

               

              Events accumulated in the EventPipe queue are represented by PIEventObject object in the PI SDK. You can extract them by invoking Take or TakeAll methods of the EventPipe member such as:

               

              EventPipes.Add AlarmList.item(i).Data.EventPipe.Take

               

               

               

              Tell me if that fixed your problem.