AnsweredAssumed Answered

Can we get initial and final value from PIPoint.Summary method ?

Question asked by Chirag89 on Sep 12, 2017
Latest reply on Sep 16, 2017 by Chirag89

Hi,

 

I am new to this thing, i want to get all the points and for each point i want to get values like initial, final, max, min,avg. I have access to min, max and avg values using summary method. Can i also get the initial and final value for specific time frame ?

 

Here is my sample code :

 

                    List<PIPoint> pp = PIPoint.FindPIPoints(server, "abcd.*", null).ToList<PIPoint>();
                    foreach (PIPoint pivalue in pp)
                    {
                        AFTimeRange at = new AFTimeRange("23-Jun-2017 1:25:00 AM", "23-Jun-2017 2:25:00 AM");

                        var summarizedvals = pivalue.Summary(at,AFSummaryTypes.Maximum | AFSummaryTypes.Minimum | AFSummaryTypes.Average, AFCalculationBasis.TimeWeighted,
                            AFTimestampCalculation.EarliestTime | AFTimestampCalculation.MostRecentTime);
                              Console.WriteLine("Average Value: " + summarizedvals[AFSummaryTypes.Average].Value);
                            Console.WriteLine("Max Value: " + summarizedvals[AFSummaryTypes.Maximum].Value);
                            Console.WriteLine("Min Value: " + summarizedvals[AFSummaryTypes.Minimum].Value);

                         // Can we get the first and final value using summary method ?
                         // Currently i am using plotValues method to fetch the value for a time frame, but i want to optimize it because data is too much.

                    }

 

Thanks.

Outcomes