6 Replies Latest reply on Feb 21, 2018 2:07 PM by sraposo

    Counting number of running Wells

    eradwan

      Hello There,

       

      Another question on Excel's 'CountIf' alternative! I have a number of wells that are considered to be up and running if the 'Choke Position' tag is greater than 10% and I need to have a final figure of how many wells are up from a number of 15 wells. So based on similar questions on PI Square I created another tag for each well which is a formula that will return '1' if choke position > 10% else return 0. I also created a rollup analysis that sums the number of wells returning '1' which is what I need, and it works fine in PSE. On the other hand, I'm using PI Integrator for BA and while retrieving the hourly values of attribute 'number of running wells' for the past one month I only get the value of the current time although there are cases in the data that should evaluate to different result. What is missing here?

       

       

        • Re: Counting number of running Wells
          Steve Boyko

          Are the results of your rollup analysis being written to a PI tag, or just to an attribute? If they are just being written to an attribute, there is no history to be retrieved by your integrator.

          1 of 1 people found this helpful
          • Re: Counting number of running Wells
            John Messinger

            Your output attribute 'Number of Running Wells - DOL2' appears to be using the Analysis data reference to store the output of your rollup analysis. In order to maintain a history of the rollup results, your output attribute should be configured with a PI Point - the Analysis data reference won't store history for you.

            3 of 3 people found this helpful
            • Re: Counting number of running Wells
              sraposo

              Hi Emad,

               

              The only supported output of a Rollup is a PI Point. This is why the option "Save Output History" is grayed out in the UI:

               

               

              The analysis data reference does not support Rollup analyses for performance reasons.

               

              Outputting to static attributes (attributes with a data reference of <none>) is bad practice and may affect the AF Servers performance if the writes are frequent.

               

              In version 2017 we implemented some enhancements to better handled frequent changes to static attributes and the effects on performance should be less than in versions prior to 2017. However, the recommended practice is to either use a PI Point or analysis data reference (when possible) as the output of an analysis.

               

              Thanks,

              Seb

              3 of 3 people found this helpful
                • Re: Counting number of running Wells
                  eradwan

                  Thanks All for the explanation.

                   

                  On the other hand I thought that I might not need an analysis at all and came to my mind why not do the summation via a formula on the attribute level. It worked and I'm also able to get interpolated historical data in PI Integrator. Would you please shed some light why its possible in this case?

                   

                    • Re: Counting number of running Wells
                      Steve Boyko

                      Equations are evaluated when the data is requested, while analytics are run either event-based or on a schedule. What is happening here is that PI AF is fetching the data for all your wells over time and doing the summation when you request the data. It works but it is less efficient than having it done for you ahead of time by an analytic.

                      1 of 1 people found this helpful
                      • Re: Counting number of running Wells
                        sraposo

                        In addition to Steve's explanation, the value of a static attribute (attribute with a data reference of <none>) is stored in SQL without it's time stamp. There is no time context to a static attribute. The analysis data reference and formula are calculated on demand when an AF client request the data. If an input to an attribute with an analysis data reference or formula has a time context (for example a PI Point or a table lookup with table provided time context) then the attribute with an analysis data reference or formula will also have a time context. In your case, the input to your formulas are attributes with PI Point data reference and this is why you see historical data.

                         

                        Thanks,

                        Seb

                        3 of 3 people found this helpful