2 Replies Latest reply on Nov 27, 2013 4:48 PM by lZheng

    PI ACE PIAcePoint.value




      I want to to some calculation on a hourly time period.


      delta_Level= level1(current_time) - level1(current_time-1h)
      flow_value.Avg(current_time-1h,current_time, 80)


      For reading the level I want to use PiAcePoint.Value(Time), but which value will this function provide?

      • interpolated value or
      • archive value next to the timestamp

      For the avg function I get different values in comparison to datalink (but very small).


      What is the best way (precise) to calculate?  Should I read the values with SDK functions ?


      Public Overrides Sub ACECalculations()






              Dim iMonth, iHour, iDay, iYear As Integer


              Dim Test As Double


              Dim Test2 As Object


              Dim test3 As Object


              Dim ST, ET As Date 'Starttime, Endtime




              iHour = Hour(DateTime.Now)


              iDay = Day(DateTime.Now)


              iMonth = Month(DateTime.Now)


              iYear = Year(DateTime.Now)




              ST = DateSerial(iYear, iMonth, iDay)


              ST = DateAdd(DateInterval.Hour, iHour - 1, ST)


              ET = DateAdd(DateInterval.Hour, 1, ST)




              Test = FC2538_PV.Avg(ST, ET, 80)


              Test2 = FC2538_PV.Value(ST)


              test3 = L1011_Schwimmdach_T101_Masse_U.Value(ST)


          End Sub









        • Re: PI ACE PIAcePoint.value
          Dan Fishman

          The value(object) method uses retrieval mode of rtAuto (basically interpolates).  You should be getting the same value as in Datalink using avg.   Also, you might want to use execution time instead of DateTime.Now.  The property ExeTime returns a double (UTC time) representing when ACE was scheduled to run instead of using when ACE actually entered this code.

            • Re: PI ACE PIAcePoint.value

              Maybe you already noticed but just want to make sure that you are comparing the correct functions in ACE and in Datablink. There are time-weighted and event-weighted average.


              Pipoint.avg(starttime, endtime, pctgood) is to calculated the time-weighted average, pipoint.Mean(starttime, endtime, pctgood) is to calculated event-weighted average.