that example in the AF SDK guide is a bit confusing in that the PIPointList object is already assumed to have been instantiated (as pointList).
I think what you need is a reference to a PIPointList object so it can be reused.
You can do instead
PIPointList myPointList = new PIPointList(points);
Let us know if this is what you were after or something else.
I had a suspicion I had the semantics wrong. Have a great day!
Hi again Barry:
I hate to pile on here but I'm trying to find an elegant way using the AF SDK to have the user subdivide the result into a defined interval. For example if the interpolatedValues call results with 7,000 timestamps, I want to have them be able to enter a value in which to divide the result by (10 for example) then give an average for each of those intervals. So if I were to export to an excel sheet the number of rows would be 700.
I have been looking into the
This method evaluates the specified expression over the passed time range. The passed time range is first divided into a number of summary intervals. The method then computes the specified summaries over each interval.
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 22.214.171.12498
public static IDictionary<AFSummaryTypes, AFValues> CalculateSummaries(
I have a PiPointList that I'm dealing with so I'm not sure how to use the AFCalculation class.
I have been trying to use the PiPointList.Summaries as well but it seems as if I would have to write code to divide the interval then repeatedly call into the piserver to get the result.
Yeah, there doesn't appear to be a server-side way to perform a Summaries call using interpolated values as input. PIPointList.Summaries() can subdivide the intervals (each interval has range of AFTimeSpan), but the inputs to each average will be taken from the archived (non-interpolated) values.
An alternative is to first call PIPointList.InterpolatedValues to get the IEnumerable<AFValues>. Then, for each AFValues, call the AFValues.Summaries() method, which will perform the averaging on the client-side. The drawback is the extra processing the client must perform and the fact that all the interpolated values are first returned over the wire to the client, when it really only needs the summary averages.
The drawback with AFCalculation is the lack of bulk call support. If you have many tags in the PIPointList, then AFCalculation looping through the tags may be slow.
Is there a requirement to use interpolated values as inputs into the averaged intervals? PIPointList.Summaries() seems most efficient, but I'm wondering if the inputs to the calculations can just be the archived events. Otherwise, it may be possible to use AFValues.Summaries() to subdivide and perform the averaging.