AnsweredAssumed Answered

[PI-AFSDK] The minimum value returned by the AFData.FilteredSummaries is incorrect

Question asked by Nicolas.Isambourg on Oct 29, 2018
Latest reply on Nov 6, 2018 by rdavin

Dear OSISoft Community,

 

I need to get the minimum value of the line speed when the line speed is greater than 60m/min.

I used the AFData.FilteredSummaries method.

The method returns the value 50.75 m/min.  I don't understand why.


Here is the source code:

 

var result = attr.Data.FilteredSummaries(new OSIsoft.AF.Time.AFTimeRange(new OSIsoft.AF.Time.AFTime(new DateTime(2018, 10, 29, 10, 0, 0)), new OSIsoft.AF.Time.AFTime(new DateTime(2018, 10, 29, 15, 0, 0))),
                new OSIsoft.AF.Time.AFTimeSpan(1),
                $@"'.' > 60",
                OSIsoft.AF.Data.AFSummaryTypes.Minimum,
                OSIsoft.AF.Data.AFCalculationBasis.TimeWeighted, OSIsoft.AF.Data.AFSampleType.Interval, new OSIsoft.AF.Time.AFTimeSpan(new TimeSpan(0, 0, 0, 1, 0)), OSIsoft.AF.Data.AFTimestampCalculation.Auto);

 

 

Then I developed a method that returns the minimum value from the AFData.InterpolatedValues method

 

 var resultsInterpolatedValues = attr.Data.InterpolatedValues(new OSIsoft.AF.Time.AFTimeRange(new OSIsoft.AF.Time.AFTime(new DateTime(2018, 10, 29, 10, 0, 0)), new OSIsoft.AF.Time.AFTime(new DateTime(2018, 10, 29, 15, 0, 0))),
                new OSIsoft.AF.Time.AFTimeSpan(new TimeSpan(0, 0, 0, 1)),
                attr.DefaultUOM,
                @"'.' > 60",
                false
               );

            var min = resultsInterpolatedValues.FirstOrDefault();
            foreach (var r in resultsInterpolatedValues)
            {
                if (r.ValueAsDouble() < min.ValueAsDouble())
                    min = r;
            }
            Console.WriteLine("{0}-{1}", min.Timestamp, min.Value);

 

This time, the minimum value is correct.

 

Why does the AFData.FilteredSummaries method return a value less than 60 m/min ?

Do I pass wrong arguments to the method ?

 

Thanks,
Best regards,

Nicolas

Outcomes