5 Replies Latest reply on Oct 26, 2017 12:49 PM by Rick Davin

    May be very basic question : But what is the difference between PI-Sdk and PI-AF sdk?

    Ambujnema

      Hello team,

      Trying to find difference between Af-sdk and PI - sdk, the requirement which we are having to find the element and in turn attributes.

      We are already using AF-SDK version 2.7.5 and using AfDatabase.Elements[assetPath]; and then _afElement.Attributes[name];, is there any performance improvement if we use PI-Sdk below method

                public static AFKeyedResults<string, PIPoint> FindPIPointsByPath(IEnumerable<string> paths)

       

      What would be your suggestion to update af sdk to newer version or use above method, this is purely for performance improvement?

        • Re: May be very basic question : But what is the difference between PI-Sdk and PI-AF sdk?
          mfoerster

          Hello Ambuj,

           

          the AF SDK is our currently fastest way to access PI Data Archive and PI Asset Framework data. It is capable of making bulk calls. In contrast PI SDK cannot get attribute data from AF so this will be the K.O. criteria in your case.

           

          Please also check out this PI Square post:

          what is the difference between PI SDK, PI AF-SDK and PI OLEDB ?

           

          Answer to your question:

          No. PI SDK is deprecated and downgrading to PI SDK will not offer an improvement of performance.

           

          Kind regards,

           

          Moritz

          • Re: May be very basic question : But what is the difference between PI-Sdk and PI-AF sdk?
            mfoerster

            An addition: AF SDK offers bulk requests from version 2.6.x on.

            Here a KB article regarding the performance of AF SDK:

            https://techsupport.osisoft.com/Troubleshooting/KB/KB01216/

            KB01216

             

            Your version 2.7.5 of AF SDK is capable of making use of these methods.

            • Re: May be very basic question : But what is the difference between PI-Sdk and PI-AF sdk?
              Rick Davin

              Hello Ambuj,

               

              AF SDK is managed .NET code.  So much easier to work with over the older Component Object Model code.  Plus AF SDK has the newer features of event frames, notifications, etc.  The funny thing is the FindPIPointsByPath mehod you listed is not a PI SDK method.  It is an AF SDK as shown by the AFKeyedResults.

               

              Back when I was a customer, I converted some legacy PI SDK code to AF SDK, which presented itself an opportunity for timings.  My discovery then was AF SDK was faster to execute than PI SDK.  And it was faster to develop as well.  This should be a big plus for AF SDK even if there are plans on deprecating the PI SDK.

               

              You may have improvement in the code you posted, but only because you posted 2 very different things.  One is searching an AFDatabase for a particular element, and then fetching attributes from that element.  The other is requesting PIPoints from a PI Data Archive.  You really should ask what you desire you application to do: should it interrogate an asset hierarchy or should it query a data archive?  AF SDK can do both.  It can work with an AFDatabase or work with PIPoints.  You really need to decide how you want your users to interact with your application.

              1 of 1 people found this helpful
                • Re: May be very basic question : But what is the difference between PI-Sdk and PI-AF sdk?
                  Ambujnema

                  Thanks Rick and Moritz for the answer.

                  I understand about the improved made on AFSDK new version and currently we are using it, but seen performance problem when we have load tested for reading the element and in turn attributes

                   

                  Approach 1: Directly reading using PIPoint.FindPIPointsByPath(path), gives us better performance.

                  Approach 2: Using AFSDK’s method which I stated above gives us less performance.

                  This could be because 2nd approach searching an AFDatabase for a particular element and then fetching attributes from that element and other one reading from PI Data Archive.

                  Is anybody experience similar issue and then recommended way to solve it?

                    • Re: May be very basic question : But what is the difference between PI-Sdk and PI-AF sdk?
                      Rick Davin

                      Hello again Ambuj,

                       

                      Again, all the methods are AF SDK.  There is no PI SDK.  The real distinction you have is whether your app should be an Asset-based app (that works against assets in an AFDatabase) or a Tag-based app (that works against PIPoints on a PI Data Archive).

                       

                      A summary of the Asset-based calls used are:

                       

                      1. Get PISystems()
                      2. Get PISystem
                      3. Get AFDatabase
                      4. Get AFElement
                      5. Explicit or Implicit load of attributes

                       

                      A summary of the Tag-based calls:

                       

                      1. Get PIServers()
                      2. Get PIServer
                      3. bulk Find tags by path

                       

                      There are fewer calls with the Tag-based app, but still the app you create should first-and-foremost be dictated by how you want users to interact with it.  Let that be the deciding factor.  If you choose to go with an Asset-based app, then by all means ask future questions on how to get the best out of that.

                       

                      I personally would not choose to make a Tag-based app merely because the Assets searching was slower.  Whether I would make an Asset app versus a Tag app depends purely on 1 thing: how to I expect users to interact with this app.  Whether this app is a WinForm or a console app that expects either command line arguments or reads inputs from an XML, users will have to input information into the app - some how, some way - that gives the app its runtime purpose.  If I expect the user to enter a PI Data Archive name and some tag names or a tag pattern, then naturally I would make Tag-based app.  But if I expect the user to enter an AFDatabase and an element, then certainly that should be a Asset-based app.  That should be what drives your decision.  How do you expect your users to interact with your app?

                       

                      Once you firmly pick whether you will write an Asset-based app or a Tag-based app, your energies should then be on using the best techniques available for that specific app.

                       

                      Another thing to think about is bulk calls versus one-at-a-time.  Calling things one-at-a-time is very slow.  I bring this up because in your original post you have these snippets:

                       

                      AfDatabase.Elements[assetPath];

                      and then _afElement.Attributes[name];

                       

                      Without seeing any more of your code, are you only interested in the one element of interest?  Or are you processing thousands of elements?  How many elements are there in your database?  For the attributes on an element, do the attributes resolve to PIPoints on that element, or do that element's attributes refer to attributes on other elements?  Formulas or PIPoints that use relative references to attributes on other elements are not very performant. 

                       

                      Looks like you are calling up 1 attribute.  I can't tell if you are working with many more than that.  Do you do an explicit AFElement.LoadElements(new[] { _afElement }) ?  How many attributes are you interested in versus how many are on the element?  If you are working with templates, you can do a partial load of the attributes on it.  See the LoadAttributes method and this link on Bulk Load Examples.

                      2 of 2 people found this helpful