8 Replies Latest reply on May 1, 2017 9:17 PM by Roger Palmen

    PI AF Analysis Optimization




      Need to calculate percentage of uncertainty, given expression is as below.


      Uncertainty = 100*(# of times XXX.PV is bad, uncertain, limit)/43200

      # of times =SUM(IF(OR(IF(XXX.PV=BAD,1,0),IF(XXX.PV=Uncertain,1,0),IF(XXX.PV=limit,1,0)),1,0))


      I have achieved this in Analysis, but used intermediate tag to store count. This has to be implemented to lot of controls and there are many similar calculations which needs us to create intermediate tags.


      I would like to know is there any better way to write this expression to avoid intermediate tag.

        • Re: PI AF Analysis Optimization

          Hello Doddabasappa,


          Under the assumption that your Process Variable is numeric and bad values are identified by statuses from the System Digital State set, you could use PctGood.

            • Re: PI AF Analysis Optimization

              Thanks Gregor for response.


              I have one more expression and implemented as below.

              ILC = 100*(# of times o/p at limit)/43200

              # of times =SUM(IF(OR(IF(XXX.OP=100,1,0),IF(XXX.OP=0,1,0)),1,0))



              Can you please suggest me alternative method to avoid intermediate tag here?

                • Re: PI AF Analysis Optimization

                  Hello Doddabasappa,


                  This will be more challenging but let's not give up easily

                  What's the point type of 'Controller Output'?

                  What do other values than 100 or 0 indicate?

                  How does the raw data look like? Can you please capture a representative sample and paste it into your reply?


                  I may have additional questions for you based on your response. Please be prepared.

                    • Re: PI AF Analysis Optimization
                      Roger Palmen

                      Curious about your suggestions. I also do similar counts of events using an intermediate PI Point.


                      Of course the thing to remember here is that AF Analytics is not geared towards analytics over time, but mainly analytics on the streaming data. A lot of the limitations of AF Analytics show up if analysis over time need to be created: how often did something happen? Did something happen more than x times the last day? So i alwaus break up the analysis in one part that creates a timerange and one part that can get the answer with the limited functions we have to evaluate a PI Point over time.

                • Re: PI AF Analysis Optimization

                  Hi Gregor,


                  I think this would have become easy if there was an in-built function to count no.of events for specified range where value is 'x', like we have TimeEQ. Because I have few other expressions where need to check for no.of occurrence of specific events over period of time for digital tags as well.

                  1. Point Type is Float32

                  2. This expression is used to determine a downstream condition which is limiting the control block action; e.g. the output is at a maximum / minimum limit

                  3. Below are some sample events. Values may vary from tag to tag and range is 0-100 (span is 100).

                  67.988784/25/2017 4:33
                  68.033534/25/2017 4:33
                  68.493744/25/2017 4:33
                  68.606094/25/2017 4:33
                  68.284074/25/2017 4:33
                  68.413654/25/2017 4:33
                  68.379044/25/2017 4:33
                  68.862254/25/2017 4:33
                  68.623814/25/2017 4:33
                  68.640374/25/2017 4:33
                  68.643974/25/2017 4:33
                  68.705354/25/2017 4:33
                  68.689664/25/2017 4:33
                  68.543754/25/2017 4:33
                  68.645514/25/2017 4:33
                  68.53714/25/2017 4:33
                  68.763374/25/2017 4:33
                  68.423864/25/2017 4:33
                  68.411094/25/2017 4:33
                  68.363894/25/2017 4:33
                  68.524534/25/2017 4:33
                  68.255734/25/2017 4:33
                  68.033514/25/2017 4:33
                  68.154344/25/2017 4:33
                  68.100954/25/2017 4:33
                  68.397484/25/2017 4:33
                  68.202134/25/2017 4:33
                  67.97164/25/2017 4:33
                  68.175674/25/2017 4:33
                  68.735044/25/2017 4:33
                  68.524474/25/2017 4:33
                  67.940464/25/2017 4:33
                  68.209264/25/2017 4:33
                  68.286714/25/2017 4:33
                  68.411824/25/2017 4:33
                  68.206844/25/2017 4:33
                  68.040664/25/2017 4:33
                  68.111994/25/2017 4:33
                  68.273974/25/2017 4:33
                  68.370164/25/2017 4:33
                  68.290854/25/2017 4:33
                  68.114714/25/2017 4:33
                  68.308074/25/2017 4:33
                  67.887424/25/2017 4:33
                  68.216714/25/2017 4:33
                  68.64194/25/2017 4:33
                  68.397774/25/2017 4:33
                  68.187824/25/2017 4:33
                  68.348924/25/2017 4:33
                  68.297774/25/2017 4:33
                  68.633714/25/2017 4:33
                  68.31544/25/2017 4:33
                  68.411564/25/2017 4:34
                  68.977974/25/2017 4:34
                  68.447554/25/2017 4:34
                  68.478324/25/2017 4:34
                  68.557334/25/2017 4:34
                  68.556824/25/2017 4:34
                  68.659484/25/2017 4:34
                  68.659624/25/2017 4:34
                  68.982544/25/2017 4:34
                  68.35654/25/2017 4:34
                    • Re: PI AF Analysis Optimization

                      Couple of ways to do this.  You can configure a PI Point Data Reference with a summary of Count.  You would, however, need to configure the PI Point with a specified time range.  If you're using a client tool, you can pass in a time range.

                      If you want to use analytics, you can consider using the NumOfChanges function.

                      Hope these options can help you.


                      Steve Kwan

                      • Re: PI AF Analysis Optimization

                        Hello Doddabasappa,


                        Please accept my apologies for the late response.


                        As mentioned by Steve there are a couple of ways to do what you like to accomplish. Performance wise, the Approach to persist Interim results to a PI Point is likely the best.


                        You are using an Event Weighted approach to claculate your downstream condition and you mainly need a percentage where a certain condition is met (equal to 0 or equal to 100). Do you think calculating a Time Weighted percentage would be sufficient? In this case you would be able to use TimeEQ. Steve adding a CountEQ to the set of standard functions would be a nice addition


                        While investigating, I stumbled across KB01120 - Filtered calculations in Asset Analytics which helped me to find the following solution to get the count over a defined period when the High Limit (100) or the Low Limit (0) is met.


                        The first thing needed is a filter for when the Low Limit and when the High Limit is met. I created Attribute HL_LL_Filter and used the Formula Data Reference

                        So on each evaluation, HL_LL_Filter will report either 1 (condition met) or 0 (condition not met). Now the challenge was to count the 1's. EventCount is not an option because I would have again to filter for the 1's but cannot. But summing up all the values should work. Unfortunately TagTot is TimeWeighted . So how do we get an Event Weighted Total? I didn't find a corresponding function. Long story short, the trick is to multiply the Event Weighted Average (TagMean) with the EvenetCount.


                        Depending on how many events are recorded on the raw point (Controller Output) for the time period you specify, you may find this solution not performing well but at least it's an approach to not use a PI Point for the interim results. I would definitely prefer using a PI Point for the interim results, meaning that I would be in favor of your initial solution.

                        1 of 1 people found this helpful