9 Replies Latest reply on Jan 23, 2018 4:15 PM by MPeralta

    Is there a reason why my PI AF calculation has a delay ?




      First time posting. I attempted to search this, but I'm unsure exactly how to search for this problem. I'm trying to determine what making product a plant is making based on the vacuum setpoints, and verifying that it's making quality material based on a product stream flow meter, and a a tank level. For some reason when I test it out there is a delay when the PI Tag is showing that we are making product, and I have a feeling it has something to do with the analysis having to read levels that occurred 3.5 hours ago..



      Product Tankage.PNG

      Product Status.PNG

      PI Process Book.PNG




      If you have any ideas to help out I would highly appreciate it.

      Thanks, Mario

        • Re: Is there a reason why my PI AF calculation has a delay ?
          Sam Pride

          Hi Mario,


          My first comment is that the analysis is going to use the trigger time of the analysis, unless you specify otherwise. Outside of modifying the output timestamp, the most likely reason for the "delay" in your analyses will be within your calculations.


          Nevertheless, I have noticed an error in your calculation which could be the root cause for your delay. Your PreviousRate calculation will always be 0 as you have:


          TagVal('Level', '*-3h') - TagVal('Level', '*-3h')

          which should be

          TagVal('Level', '*-3h') - TagVal('Level', '*-3.5h')


          This effect of this is that the value for "tankage" will always be false when the current rate is less than -1000. In this case, the PreviousRate (which is 0) is used for the LoadingCheck value which in turn is less than the threshold. This will have a flow-on effect in your other analysis.


          If this doesn't help, it might be handy to do a bit of "shotgun debugging" and map the individual calculations out to PI Tags (via attributes) or continue to use the "Preview" functionality.


          If you're still stuck let me know and I (or someone else who beats me to it!) can help step through the analyses in more detail

          2 of 2 people found this helpful
          • Re: Is there a reason why my PI AF calculation has a delay ?

            We had a similar issue last year.

            Below is the link for the best practice for PI Analysis service.


              • Re: Is there a reason why my PI AF calculation has a delay ?

                Can I ask how you resolved it? The  only issue I can see that differs is not having an output history for the tags.  Is there an explanation of scenarios when it's not needed?

                  • Re: Is there a reason why my PI AF calculation has a delay ?

                    Hi Mario,


                    We did a lot of optimizations actually and we considered a lot of factors but looking at your calculations and syntax, you can try mapping the Tag value for the last 30 h and Tag Average into an attribute then map that attribute on your calculations.


                    For example:

                    instead of TagVal('Level','*') - TagVal('Level','*-30h')


                    create an attribute For example Level for last 30 hours and use the pi point data reference.


                    So in your calculation it might look like

                    Level - Level30h something like this.


                    The same with getting the average for a tag. The reason is because using TagAvg in the analysis requests data from the Data Archive every time the analysis is triggered which might cause lagging.


                    Another thing to look at is to look at the Analysis Service statistics.



                    Look for the value for Current Lag if this is going up then check the analysis log to know what is causing the lag.




                    2 of 2 people found this helpful