PI SDK Calls: Is there a more efficient way?

Discussion created by bacherc on Jun 4, 2012
Latest reply on Jun 8, 2012 by hamort

We are using AF to search elements so that we can get PI Tag and PI Server information for three tags. We then use this PI Tag and Server information to look up data for PI tags.


We need the data in two different ways:


1)      Interpolated


2)      Hourly Sums


This data needs to be retrieved for one day, with 24 values being returned – one for each hour in the day -- for the three PI tags. We are using the PISDK to do this as it was not apparent that AF had anything appropriate to use in order to retrieve data in this way and PISDK allows for just one call to retrieve 24 interpolated values one hour apart. Below is the PISDK code being used to retrieve the data for one PI tag (where Interval is “1h”; StartTime like 5/1/2012 01:00; EndTime like 5/2/2012 0:00).


            Dim MyPoints As PISDK.PIPoints = PIServer.PIPoints


            Return CType(MyPoints(PiTag).Data, PISDK.IPIData2).InterpolatedValues2(StartTime, EndTime, Interval)




To get the summed data, three calls (again, one for each PI tag) are made as well to retrieve 24 values (where Interval is “1h”; StartTime like 5/1/2012 00:00; EndTime like 5/2/2012 0:00).




            Dim MyPoints As PISDK.PIPoints = PIServer.PIPoints


            Return DirectCast(DirectCast(MyPoints(PiTag).Data, PISDK.IPIData2).Summaries2(StartTime, EndTime, Interval, _


                    PISDK.ArchiveSummariesTypeConstants.asTotal, PISDK.CalculationBasisConstants.cbTimeWeightedContinuous)(1).Value, PISDK.PIValues)




Interpolated and Hourly Sums are going to be retrieved many times (we need to do the above routine about 250,000 times a day, so 250,000 x 3 PI Tags, you can imagine that's a lot of calls), as much data needs to be retrieved. As such, efficiency is very important when retrieving this data.


Is there a more efficient way to go about doing this via use of OLEDB, ODBC, AF, or even another implementation using the PISDK?


Thanks in advance!