3 Replies Latest reply on Sep 7, 2016 2:01 PM by Roger Palmen

    RecordedValues with AFBoundaryType.Insite returning events outside of AFTimeRange

    Roger Palmen

      Hi all,

       

      Using AFSDK recordedvalues call, and AFBoundaryType Inside to get 1-hour blocks of values. To avoid duplicates at the boundary of 1 hour i set the endtime one tick (=1ms before the end of the hour. So e.g. ST of 08:00:00.000 and ET of 08:59:59.999. Yet the call still returns a value at 09:00:00.000. Anybody can explain this behaviour?

       

      Doing exactly the same in e.g. PI SMT the value at 09:00:00.000 is not returned. All on latest PI stack, latest AFSDK.

        • Re: RecordedValues with AFBoundaryType.Insite returning events outside of AFTimeRange
          pmartin

          Hi Roger,

           

          I'm having trouble replicating your issue.  Using this code:

           PIPoint cdt = PIPoint.FindPIPoint(pi,"cdt158");
          
            AFTime start = new AFTime(DateTime.Today);
            AFTime end = new AFTime(DateTime.Today.AddHours(1).AddMilliseconds(-1));
          
            AFTimeRange time = new AFTimeRange(start,end);
            AFValues vals = cdt.RecordedValues(time, OSIsoft.AF.Data.AFBoundaryType.Inside, null, false);
          
            foreach(AFValue val in vals) {
            Console.WriteLine("{0}: {1}",val.Timestamp, val.Value);
            }
          

           

          I get this result (SMT t->t+1h on left, code result on right):

           

          Are you doing something different?

          1 of 1 people found this helpful