AF SDK has this feature only if you are targeting at least .NET 4. In this case, the method AFCalculation.CalculateSummaries under the OSIsoft.AF.Data namespace is able to perform some calculations as shown in the example below:
string expr = @"'SERV-DC1|Memory_Available MBytes'+'SERV-PI2012|Memory_Available MBytes'"; var summaries = OSIsoft.AF.Data.AFCalculation.CalculateSummaries(Computers, expr, new AFTimeRange("*-3h", "*"), AFTimeSpan.Parse("3h"), AFSummaryTypes.Maximum, AFCalculationBasis.TimeWeighted, AFSampleType.ExpressionRecordedValues, AFTimeSpan.Parse("3h"), AFTimestampCalculation.MostRecentTime);
Nevertheless, could you to please describe what are you actually trying to do with more details? Where is your data stored? Is it stored on a PI Server or different databases through AF Table Lookup Data Reference? We might be able to find a different solution for your problem.
Basically I want to retrieve the data as it has been setup in the Pi ProcessBook configuration I described. For example, I will retrieve the value of the calculation as a time series, 7 day window...
Ok - so if the calculation capability is not available in the AF SDK (targeting .NET 3.5), what are the alternative approaches?
1. PI AF SDK - (.NET 4.0 version)
2. PI SDK (a version that targets .NET 3.5) ?
3. Define that calculation as an Attribute within PI AF - then I can simply retrieve the value of the attribute (without needing to do the calculation in code level/API?)
Yes, you are right. You can use PI SDK if you are working only with PI tags in application whose target framework is .NET Framework 3.5. And of course, you can develop similar functions in your custom application to achieve similar results.
Let me know if you still have any question,