AnsweredAssumed Answered

AF SDK, InterpolatedValues, Small values set and timeout/error catching.

Question asked by Darren.Herman on Aug 23, 2016
Latest reply on Aug 24, 2016 by Eugene Lee

Hello PI Squared community.  I was working with the AFSDK and the interpolatedvalues function & 99% of the PI tags and historical data pull worked correctly.  I came across a PI tag that only has about 8 values in it from 1/1/2015 to 1/1/2016 (a years worth of values, all 8 of them).  When my code started to run, I got RPC errors, timeout errors and the PIARCHSS.exe just chews up PI server CPU time.  At times I had to kill the PIARCHSS.exe and restart it.  The following is the code I run, I would perform a data from that looks like the following:

Start 1/1/2015, End 1/1/2016, Time Interval 15m.

 

Again let me restate the problem: when the myPiPoint.InterpolatedValues runs against my PI tag that only has 8 values in it, my code has RPC errors and the PI server has problems - so how would you trap for these errors that are occurring or is there a better way to check that a PI tag has good values to be interpolated by AF.

 

Here is the code I am using:

    Function GetPiTagHistory(startdate As String, enddate As String, pitag As String, afsp As AFTimeSpan) As List(Of String)
        Dim _vals As New List(Of String)
        Try
            myPIServer.Connect()
            RaiseEvent MessageEvent(Me, New DataAccessLayer.Message() With {.MessageText = "Processing PI Tag: " & pitag})
            Dim myPiPoint As PIPoint = PIPoint.FindPIPoint(myPIServer, pitag)
            Dim ssInterpolated As AFValues = myPiPoint.InterpolatedValues(New AFTimeRange(startdate, enddate), afsp, "", False)
            If ssInterpolated.Count = 0 Then
                Throw New System.Exception("Sequence Contains no elements")
            End If
            piHistDict.Add(pitag, ssInterpolated)
        Catch ex As Exception
            RaiseEvent MessageEvent(Me, New DataAccessLayer.Message() With {.MessageText = ex.Message, .ErrorOccured = True})
            Return Nothing
        End Try
        Return _vals
    End Function

 

PI Values for my bad PI tag:

Outcomes