AnsweredAssumed Answered

IGetPoints2 with IronPython

Question asked by CedricLeroy on Aug 24, 2015
Latest reply on Aug 25, 2015 by CedricLeroy

Hello,

 

We are trying to Snapshot a lot of data from our PI servers using Python (IronPython)

 

It works nicely, but it is too slow. To improve the speed we would need to use GetPoints2 (I believe)

 

Here below is the code we use:

 

import clr


clr.AddReference("OSISoft.PISDK")
clr.AddReference("OSISoft.PISDKCommon")


import PISDK
import PISDKCommon
import datetime


class PerformanceTests:
    def __init__(self):
        sdk = PISDK.PISDKClass()
        self.srv = sdk.Servers["PISPEB02"]
        self.srv.Open()
        print 'Server Up'


        tag = 'MyTag'


        t1 = datetime.datetime.now()
        point = self.srv.PIPoints[tag]
        t2 = datetime.datetime.now()
        value = point.Data.Snapshot
        t3 = datetime.datetime.now()


        print t2 - t1
        print t3 - t2


        print 'Snapshot completed'


        filter = "pointsource = 'MyTag.*'"


        self.srv = PISDK.IGetPoints2


        #namedAttributes = PISDKCommon.NamedValues()


        points = self.srv.GetPoints2(filter, namedAttributes, PISDK.GetPointsRetrievalTypes.useGetPoints, None)




myPerformanceTests = PerformanceTests()
raw_input()
































 

 

The namedAttributes here is causing me troubles, and I am not sure if the None at the end will be interpreted as a Null.

 

Thanks

 

Cedric

Outcomes