6 Replies Latest reply on Mar 28, 2018 10:32 AM by John Messinger

    There's something in PI SDK equivalent to PI-Datalink's PIAdvCalcDat(param1;param2;param3;param4;"average (event-weighted)";"event-weighted";param7;param8;param9;param10) function?

    jfigueras

      Hi,

       

      I've tried with different methods, but any returns same value as PI-Datalink's:

       

            Sub Main()
               Dim piserver As String = "my-server"
               Dim pdata As PISDK.PIData
               Dim ipdata2 As PISDK.IPIData2
               Dim nvalues As PISDKCommon.NamedValues
      
               Dim ptimeFrom As New PITimeServer.PITimeFormat()
               ptimeFrom.FormatString = "dd/MM/yyyy hh:mm:ss"
               ptimeFrom.InputString = "25/04/2017 23:00:00"
      
               Dim ptimeTo As New PITimeServer.PITimeFormat()
               ptimeTo.FormatString = "dd/MM/yyyy hh:mm:ss"
               ptimeTo.InputString = "26/04/2017 23:00:00"
      
               Dim ipisdk As New PISDK.PISDK
               ipisdk.Servers(piserver).Open("")
      
               Dim lista As PISDK.PointList
               lista = ipisdk.Servers(piserver).GetPoints("tag='my-tag'")
      
               Dim i As Integer
               Dim w As PISDK.PIValue
               Dim x As PISDK.PIValues
               Dim y As Double
               For i = 1 To lista.Count
                   pdata = lista(i).Data
                   ipdata2 = pdata ' get pointer to IPIData2 Interface
      
                   w = ipdata2.Summary(ptimeFrom, ptimeTo, PISDK.ArchiveSummaryTypeConstants.astMean, PISDK.CalculationBasisConstants.cbEventWeighted)
                   y = w.Value
      
                   w = ipdata2.Summary(ptimeFrom, ptimeTo, PISDK.ArchiveSummaryTypeConstants.astMean, PISDK.CalculationBasisConstants.cbEventWeightedExcludeEarliestEvent)
                   y = w.Value
      
                   w = ipdata2.Summary(ptimeFrom, ptimeTo, PISDK.ArchiveSummaryTypeConstants.astMean, PISDK.CalculationBasisConstants.cbEventWeightedExcludeMostRecentEvent)
                   y = w.Value
      
                   w = ipdata2.Summary(ptimeFrom, ptimeTo, PISDK.ArchiveSummaryTypeConstants.astAverage, PISDK.CalculationBasisConstants.cbEventWeighted)
                   y = w.Value
      
                   w = ipdata2.Summary(ptimeFrom, ptimeTo, PISDK.ArchiveSummaryTypeConstants.astAverage, PISDK.CalculationBasisConstants.cbEventWeightedExcludeEarliestEvent)
                   y = w.Value
      
                   w = ipdata2.Summary(ptimeFrom, ptimeTo, PISDK.ArchiveSummaryTypeConstants.astAverage, PISDK.CalculationBasisConstants.cbEventWeightedExcludeMostRecentEvent)
                   y = w.Value
      
                   nvalues = ipdata2.Summaries2(ptimeFrom, ptimeTo, "1h", PISDK.ArchiveSummariesTypeConstants.asAverage, PISDK.CalculationBasisConstants.cbEventWeighted)
                   x = nvalues("Average").Value
                   y = x(1).Value
      
                   nvalues = ipdata2.Summaries2(ptimeFrom, ptimeTo, "1h", PISDK.ArchiveSummariesTypeConstants.asAverage, PISDK.CalculationBasisConstants.cbEventWeightedExcludeEarliestEvent)
                   x = nvalues(1).Value
                   y = x(1).Value
      
                   nvalues = ipdata2.Summaries2(ptimeFrom, ptimeTo, "1h", PISDK.ArchiveSummariesTypeConstants.asAverage, PISDK.CalculationBasisConstants.cbEventWeightedExcludeMostRecentEvent)
                   x = nvalues(1).Value
                   y = x(1).Value
      
                   nvalues = ipdata2.Summaries2(ptimeFrom, ptimeTo, "1h", PISDK.ArchiveSummariesTypeConstants.asAverage, PISDK.CalculationBasisConstants.cbEventWeightedIncludeBothEnds)
                   x = nvalues(1).Value
                   y = x(1).Value
               Next
      
               ipisdk.Servers(piserver).Close()
           End Sub
      

       

      There're some PI SDK method equivalent to PI-Datalink's PIAdvCalcDat(param1;param2;param3;param4;"average (event-weighted)";"event-weighted";param7;param8;param9;param10) function?

       

      Regards,

      Jose Figueras