AnsweredAssumed Answered

Average value for each hour of a day

Question asked by KalkiCommTech on Jul 14, 2020
Latest reply on Jul 15, 2020 by sraposo

Need an example to get average for a day for a set of points for an interval of every hour. I tried summaries but I am not able to figure out to get values and timestamp from the result. Please clear this for me, here is the code i am using,

 

foreach(string pnt in LBPipointList.SelectedItems)
{
PIServer srv = new PIServers().DefaultPIServer;
PIPoint pt = PIPoint.FindPIPoint(srv, pnt);
AFTime eTime = AFTime.NowInWholeSeconds;
AFTime sTime = eTime.LocalTime.AddMinutes(-1440);
AFTimeRange tr = new AFTimeRange(sTime, eTime);
AFTimeSpan ts = new OSIsoft.AF.Time.AFTimeSpan(1);


IDictionary<AFSummaryTypes, AFValues> sumS = pt.Summaries(tr, ts, OSIsoft.AF.Data.AFSummaryTypes.Average, OSIsoft.AF.Data.AFCalculationBasis.TimeWeighted, AFTimestampCalculation.EarliestTime);

}

 

How do I get the 24 averaged values for the selected point from sumS?

Outcomes