5 Replies Latest reply on Oct 11, 2018 8:30 PM by John Messinger

    AF Retrieval Methods Time range define


      Hi all, I'm trying to use the Retrieval Methods to calculated the average and standard deviation (the event weighted ones) with an specific time range

      for example:

      StartTime: 2018/10/10 15:06:00
      EndTime: 2018/10/10 15:46:00


      Those date could be change by the user. So, I create two attributes StartTime and EndTime to let the user change it if they want.
      And use relative expression to define the time range.



      I've been review the PI square and I only find examples with moving  time windows, like '*'- 10m.
      But no with any Full Time Range .
      Is there a way to configure this in a Retrieval Method? Is it possible?
      And if is not, can you guys suggest me another way to calculate this?



      Best Regards

        • Re: AF Retrieval Methods Time range define

          This is not possible with a typical PI Point Data Reference attribute without going through some hoops.

          An alternative is to use an Analysis.

          1) Create an attribute for StartTime, set it to a DateTime ValueType, not a Configuration Item.

          2) Create an attribute for EndTime, set it to a DateTime ValueType, not a Configuration Item.

          3) Create an Expression Analysis, configuration it as: TagAvg('<name of your attribute with the PI Point>', 'StartTime', 'EndTime')

          4) Create a new Output attribute, select No to Saving History, give it an attribute name.

          (I'm assuming here that you don't want to save the output to a PI Point.)

          In PI System Explorer, you can now change StartTime and EndTime, then refresh PSE and you should get an answer in your output attribute.  You can also use this output attribute in clients such as PI Vision.


          Warning: depending on the time range and other factors, this may cause a large number of values to be retrieved from the PI Data Archive affecting clients and overall performance.  Be especially careful if you're going trend this output attribute (not sure it makes sense for anyone to trend this output attribute as the inputs require someone to change their values.)


          Steve Kwan

          1 of 1 people found this helpful