8 Replies Latest reply on Jun 21, 2017 4:55 AM by skwan

    Is it possible for users to write their own analytics functions

    Ian.Gore

      It was possible to extend the functionality of earlier versions of PI-AF by writing your own Data Reference functions.

       

      Will something similar be available for Analytics?  Can we extend the available functions with user written ones?

        • Re: Is it possible for users to write their own analytics functions
          skwan

          Ian:

          That is in our plan, but has not been implemented.  May I ask what you're trying to do?

           

          --

          Steve Kwan

          AF Product Manager

            • Re: Is it possible for users to write their own analytics functions
              mnbellinger

              Hi Stephen,

              Your post says there is a plan for user-defined functions to be added.  Since this post is 2 years ago, I'm wondering if it is now available.  I couldn't find any reference to how to add a UDF in the manual of AF Client for 2015 or 2016 versions.  I didn't check 2017 yet.

               

              Mary Bellinger

              Analyst

              Sinclair Oil

                • Re: Is it possible for users to write their own analytics functions
                  gregor

                  Hello Mary,

                   

                  User defined functions in Asset Analytics is not yet supported. I had a chat with Stephen Kwan who kindly agreed to provide a high-level overview soon about what's planned in that regards. Please stay tuned.

                    • Re: Is it possible for users to write their own analytics functions
                      skwan

                      Hi Mary,

                      Sorry for the late reply.  We are in the research phase on how to provide analytics extensibility.  We hope to have something in place by 2018.  Our goal is to first allow connectivity with 3rd party calculation engines.  We have many customers that have a repository of code written in 3rd party calculation engines such as MatLab that we want to take advantage of.  In addition, we want to segregate the execution of any non-OSI calculations (code) from affecting PI Analysis Service - i.e. we want to avoid having PI Analysis Service executing any non-OSI produced functions/code.  This way we avoid any poor interaction between non-OSI code with PI Analysis Service.

                      In building in extensibility, we are going to build it in a generic fashion so that the development community can "hookup" to AF/Analytics.  Currently, our thought is that AF would do the data gathering including caching and providing updates via the datapipe and PI Analysis Service would provide the scheduling.  The 3rd party external calculation engine would provide the metadata needed to describe the inputs and outputs for any specific calculations.  AF would use this metadata to gather the necessary inputs and send the data to an external calculation engine in an async fashion based on user defined schedules.  Once the calculations are done, the results would be sent back to AF in a reverse direction and we would write the results to PI points.

                      This is what we're thinking at a high level, but to answer your question, this is not available yet.  If you have any questions, feel free to contact me.

                      --

                      Steve Kwan

                • Re: Is it possible for users to write their own analytics functions
                  Ian.Gore

                  Hi Steve,

                   

                  Initially I would be looking to provide richer utility type functions that shortcut some calculations.   An example would be more Time functions (eg Timespan(attribute x, string part) that would solve my problem in this discussion

                   

                  https://pisquare.osisoft.com/message/42404#42404

                   

                  or make this (which was issued as part of an example well downtime application - and coincidentally answers part of my question) a lot simpler.

                   

                  Analyses.PNG

                   

                  Future ideas would be to write application specific calculations perhaps related to equipment or well surveillance.

                   

                  Regards,

                  Ian

                    • Re: Is it possible for users to write their own analytics functions
                      skwan

                      Ian:

                      The next release has 4 new functions, one of which should solve your timespan issue.  This new function is "SecSinceChange".  The function name is self-explanatory.  We're getting ready to release a beta so keep your eyes open .

                      I'm not sure I fully understand what you're trying to do in this example, can you explain?

                       

                      --

                      Steve Kwan

                      AF Product Manager

                        • Re: Is it possible for users to write their own analytics functions
                          Ian.Gore

                          Hi Steve,

                           

                          My issue about calculating timespan in seconds has been resolved in How can I use Analyses to find the difference between two timestamps in seconds

                           

                          I'm not sure which example you mean but in my case I have displays where the data comes from many sources (live, manual, etc).  Just by looking at it the user doesn't know if the manual entries are up to date so I wanted to put an indicator on the display to show that the manual values are older than a certain time.  The time difference calculation allows me to set a flag in AF which I can use to drive a multistate, I can also roll them up to show a "stale count" on the display as well.

                           

                          The image example is part of the well downtime demo released by OSISoft recently for review.


                          Regards,

                          Ian.

                           

                            • Re: Is it possible for users to write their own analytics functions
                              skwan

                              Hi Ian:

                              Thanks for the explanation.  I thought the well downtime was your application.  Clearly I was confused

                              I'm glad to hear your problem for timespan has been resolved.

                              As I mentioned earlier, I have an open mind and am always interested in knowing specific problems that our customers need to solve.  In some cases, it may make sense for us to add a new feature if we can help solve a problem that is applicable to a wide customer base.

                               

                              --

                              Steve Kwan

                              AF Product Manager