4 Replies Latest reply on Jan 27, 2012 7:38 PM by ryland

    PI Point Data Ref. for Rolling Avg. 1 day Ago?


      This is probably not a programming question, but more of an AF configuration question.


      I would like to create a data reference in which I return a smoothed (10 min Avg) of a pi point at one day (or more) in the past.  


      The goal being to compare yesterday's trend against today's in a processbook display.  I can do this with Datasets in Processbook, and I can do this with PE's in Calculated Tags, but it would save a lot of time if I could do this in a data reference in AF.


      Am I trying to do too much with the base AF functionality?



        • Re: PI Point Data Ref. for Rolling Avg. 1 day Ago?



          Here's one way of doing it using AF.


          1) Create an attribute with a PI Point DR of your variable of interest


          2) Create another attribute with a PI Point DR with the same variable, but configure it with a "Time Range" with a Relative Time of "*-10m" and a Time Range method of "Average".  This gives you a 10 minutes averages.


          3) In ProcessBook, create one trend with the time period that you want to compare (e.g. the last 8 hours) using the attribute from 1) above.  In addition, create another trend with the attribute you create from 2) above, but selecting the time range of interest.  Now you can compare the two.


          How this works is that the client (ProcessBook in this case) passes the time context of the trend to AF, AF then uses this time context to get the data from the PI server.  Thus when you create a trend with a time range of, say, yesterday using the 10m average attributes, AF brings back the proper data for you.  As time marches on, the trends will update automatically.


          I hope this is what you were looking for.



            • Re: PI Point Data Ref. for Rolling Avg. 1 day Ago?

              Thanks Steve.  That would definately get the data I was asking for, but I failed to mention that I was looking to get the previous day's value and the current value in the same trend.  Having the data overlayed makes visual comparisons a little easier.  


              I wasn't sure if it was possible to do both an avg.  and a time offset in a data reference.


              I think I'll probablly just use a calculated tag to do the smothing and the AF data reference to give me the offset.


              Thanks again for the Suggestion.


              Ryland Bingham

                • Re: PI Point Data Ref. for Rolling Avg. 1 day Ago?

                  it would be very cool to have   this feature in processbook without going through the burden to create an AF Structure.... mabye something for the other steve + laurie ;-)

                    • Re: PI Point Data Ref. for Rolling Avg. 1 day Ago?

                      Wolfgang- I was able to do this in processbook without using AF.  Create a Trend. Add your point.  Then add a PI Calculation to the trend with the PE in the form of:


                      TagAvg('YourPointHere', '*-24.25h', '*-24h')  


                      You will then have your point and a 15m time weighted avg of your point 24 hours ago, in the same trend.  My problem is that I Need the exact same Display for a dozen set of points, but don't want to create a dozen PDI's. The Calculated datasets in Processbook only seem to support PI Tags and not AF attributes.


                      I just ended up adding some Calculated PI points to do this work for me, in order to get everything to work with AF.