8 Replies Latest reply on Dec 22, 2016 6:02 AM by Amit Tiwari

    PI Analysis calculation load reduction approaches

    Amit Tiwari

      Hi All,


      I wish to have discussion calculation load reduction methods and stabilizing PI Analysis Service and avoiding calculation error and duplicate events generation. Could you all please share your opinions, experiences and solutions here.

        • Re: PI Analysis calculation load reduction approaches

          Hi Amit,


          To have the best performance you should:


          -Have the Analysis Service installed on a dedicated node with multiple cores (it's a multi threaded application)

          -Run the latest version of the Analysis Service, AF Client

          -Run if possible the latest version of the AF Server

          -Use attributes with PI Point or Analysis data reference as output points.

          -Table lookup attributes can be used as input points, but table lookup attributes were not design for high load performance so be mindful of this.

          -Have the Analysis Service dependent on the PI Buffer Subsystem.


          You should never have duplicate data with the Analysis Service. Is this something you have experienced?


          For calculation errors this is very per case basis. What kind of calculations will you be implementing?

          1 of 1 people found this helpful
          • Re: PI Analysis calculation load reduction approaches

            Hi Amit,


            All of Sebastien's comments are great.  I'd like to add the following:

            1. Use intelligent scheduling that only evaluates as often as you need it.  For example, if your input data only updates once a day, don't schedule the analysis periodically once a minute.  It would be better to schedule it once a day, or have it event-triggered.  Conversely, if your data updates every second, but you only need a result once an hour, use a periodic schedule of once an hour rather than event-triggered.
            2. Use variables to reduce calls to the PI Data Archive.  If you have an expensive summary call (i.e. TagAvg('sinusoid', '*-1mo', '*') ), save this result to a variable and use that variable in the analysis for subsequent expressions.  This way you can ask the PI Data Archive once for the result and yet still use the result in additional expressions.
            3. Disable analyses that are in error because they're not ready to be used yet.  Often some analyses aren't ready for production because their input tags aren't created; these analyses shouldn't be enabled because the analysis service will try to restart these automatically and yet they will error.
            1 of 1 people found this helpful
            • Re: PI Analysis calculation load reduction approaches
              Rhys Kirk

              In addition to the above points...


              Don't put 'every' calculations in AF Analyses.

              Calculate as close to the source/edge as possible.

              Have owners for calculations to avoid dead wood.

              Have proper environments (test, staging, production) to avoid those pesky users putting poor analyses straight into production.

              Pester OSIsoft for a horizontally elastic analysis service.

              1 of 1 people found this helpful
              • Re: PI Analysis calculation load reduction approaches
                Amit Tiwari

                Hi Everyone,

                Thanks for the information shared.


                Sebastien Raposo

                Yes, I am experiencing the issue of Event Frames getting either duplicated or two or more same event frame cases are open at the same time (same logic is having two or more event frames getting opened, may or may not having same start time). We are using the latest version of PI Analysis Service in a dedicated server machine.


                Rhys Kirk,

                Could you please elaborate "Have owners for calculations to avoid dead wood". Do you mean to say every intermediate variable must be stored somewhere. Also please elaborate "Calculate as close to the source/edge as possible". Does it means the location of the AF and Analysis Servers and if so, how it is related to PI Server location.

                • Re: PI Analysis calculation load reduction approaches
                  Amit Tiwari

                  Hi All,


                  Thanks for the input.

                  Could you please optimization on below Analysis Calculations failing sometimes as 'Calc. Failed' and mostly when some network issue/slowness or restart.

                  1.For PGC AF Analysis Calculation:


                  I.Before 8AM:


                       Where IGP is another analysis having equation as:

                       If not BadVal('\QAZC\PP\RJCP|IGP') then '\QAZC\PP\RJCP|IGP' else NoOutput()

                       Related Tag IGP is writing into using a Rollup Analysis: IGP.QC

                       Now here, IGP is Sum of Several Analysis having its entities are Analysis (IGPV), having equation as

                       IGPV = if (ActiveMeter) = 1 then if not BadVal(MeterA) then MeterA else NoOutput() else if (ActiveMeter)=2 then if not BadVal(MeterB) then      MeterB else NoOutput() else NoOutput()


                  II.At 8AM:



                        Its Related tag is: RBY_Area_Gas_Production_Current.QC with Point Source ‘T’.

                       CGP is a Rollup Analysis with Root Level Summation and that too from Different AF Database (Summation is Periodic with 1 minute).


                  III.After 8AM:

                       (32-(Float('*'-'t')/3600))* TagAvg('IGP','*','*-30m')/24



                       If tagval('IGP')=0 AND '\QAZC\PP\RJCP|MR'=0  then 0 else if  BadVal('CGP') or BadVal('IGP' ) or EventCount('IGP','*-60m','*')<48 THEN      NoOutput() ELSE (If '*' < 't+8h' then (Before8AM + 'CGP') else if ('*'='t+8h') then At8AM else (After8AM + 'CGP'))


                       Related Attribute: MR, it is having PI Reference as Formula and that Formula is using two other Attributes, and both are further an Attribute with      PI Data Reference as Formula.



                       If PG="Calc Failed" then NoOutput() else PG


                       Where, PG itself is a Variable.

                       PAU is finally written as Analysis Output in attribute as PGP.


                  2.Today's Production:

                       if Not TagBad('IP') then if hour('*')=8 and minute('*')=0 then tagtot('IP', 'y+8h', '*-1s') else if hour('*')>=8 then TagTot('IP', 't+8h', '*') else      TagTot('IP', 'y+8h', '*') else 'IP'


                       Where IP is an attribute of a PE Tag (Summation of two tags, let’s say (TagA + TagB)). And Tag A is updating twice a minute and Tag B is also      updating, either once or twice a minute.

                  • Re: PI Analysis calculation load reduction approaches
                    Amit Tiwari

                    Hi All,

                    Could you please give another level of thought on this.