9 Replies Latest reply on Apr 22, 2017 1:51 AM by PabloSatler

    Iterative methods on the PI

    PabloSatler

      Hello,

       

      I'd like to know what are the typical analyzes of the PI System and PI ProcessBook and how I can perform iterative procedures/methods on them.

      For example, using a previously calculated value from a routine to perform another calculation on the same routine or even using the returned value on a different routine. I want something like what happens in a filter algorithm (an example). Does PI System Explorer or ProcessBook have some kind of limitations for doing that?

      Is there any built-in functions for doing iterative calculations? Do I need to use tags/attributes for storing the intermediate values? Can I generate parameters for using on another routines? Would a custom data reference be a solution?

      One of my goals is being able to use such routines to display trends on ProcessBook.

       

      Any ideas or tips on doing iterative procedures on the PI System would be great.

       

       

      Version Information:

      PI System Explorer 2016 SP2 32-bit edition

      PI AF Server 2.8.0.7444

      AF SDK 2.8.2.7626 .NET:v4.0.30319

      PI ProcessBook 2015 R2 3.6.0.82

        • Re: Iterative methods on the PI
          tswift

          It's hard to give specific recommendations without more information about what you're trying to do. Depending on the complexity of your calculation, you may be better off writing your own custom data reference or AFSDK application. Neither PI AF nor PI ProcessBook natively support iterative methods/FOR loops. You can work around this with an AF analysis that contains multiple expressions, where each expression is a single iteration. This would only work if you use the same number of iterations each time and the number of iterations is reasonably small. Does that help?

          • Re: Iterative methods on the PI
            JakeO'Grady

            I'm really keen to know the answer to this too.

             

            I've got a mass balance of a tank where the inflow is measured, but the outflow is dependant on the concentration in the tank which is itself dependant on the outflow. Hence iterative. It typically takes about 8-10 iterations to stabilise but that does change and multiple expressions within an analysis gets very difficult to use and maintain. Having the calculation being able to reference a previous value of itself would be much better.

             

            Is there a way to do this?

            • Re: Iterative methods on the PI
              Jarita Sirois

              From Rick Davin:

               

              Starting with one of your last statements: One of my goals is being able to use such routines to display trends on ProcessBook.  If you save your calculated values back to a PI point, then displaying it in ProcessBook is trivial.  And ProcessBook does not need to be aware of how the calculation is performed; all it does is grab values for a requested PI point.

              Since you sound to be just starting out, you could examine using Asset Analytics, but chances are the iterative nature of your processing may be more complex that what is currently offered in Asset Analytics.  This means you may need to write your own calc routine.

              Since this is a brand-new project for you, I strongly recommend for you to use .NET and AF SDK and not the much older PI SDK, which is transitioning to be deprecated.  Though ProcessBook doesn't support .NET, remember my earlier statement that if you save the values back to a PI point that ProcessBook doesn't need to worry about where the values came from.

              A custom data reference may or may not fit the bill.  From what you've said about the iterative nature of your needs, I'd think a CDR is not the best choice since it would dynamically calculate on demand, which could be a performance grind with its iterative looping.  Instead of a CDR, if your routine churns through its calculations and saves them back to PI points, trending those saved values would be extremely fast.

              Many of your questions are peppered with "Can I use", "Do I need", etc.  All that you ask is possible, so "Can I use" is answered as Yes - but until I know more about your specific code I can't answer whether or not you SHOULD use it.  Questions of "Do I need" are best answered as a maybe.  There are so many variables to consider about your processing needs and environment.

              Side note: you are on AF SDK 2.8.2.  You really should upgrade to AF SDK 2.8.6 immediately due to a known DST bug.  As of this writing, AF SDK 2.8.6 is the current production version and the first 2.8.x version that fixed the DST bug.  However, we are just a few weeks away from releasing AF SDK 2.9.

              Cheers,
              Rick

                • Re: Iterative methods on the PI
                  PabloSatler

                  Hi,

                   

                  currently I'm using a CDR which is triggered periodically via Analyses, and the result is then mapped to a PI Point. I want to create, though, another routine (probably using a CDR too) which will have a training set and a test set. My algorithm is for fault detection and oscillation detection.  I'm using Matlab to create such algorithm. I still have some doubts about how to store my training set on PI. Can I do it in a matrix form? If yes, how would I do it?