6 Replies Latest reply on Jun 1, 2016 5:34 AM by skwan

    Event Frame Calculations

    obermec

      Hi,

      I wonder if there is a way to accomplish the following tasks using EF attribute templates:

      • access the timestamp of a calculated maximum value (PI Point Data Reference, maximum), maybe assign it to an EF attribute
      • use the timestamp of a calculated value (max) to find the value for another EF attribute (PI Point Data Reference)

       

      I found a similar question in PI Square from 2013 mentioning custom AF data references - but no real solution.

      After 3 years gone - is there a generic solution for this now?

       

      Thanks,
      Christian

        • Re: Event Frame Calculations
          John Messinger

          You can access summary values of PI Point Data Reference attributes on a referenced Element fairly easily, and assign this to an EF attribute. If you haven't already seen it, download a copy of the Guide to Substitution Syntax in AF-EF Data References - v2, located in this thread. Page 28 onwards should cover the syntax you need for this.

          Regarding the second point, I'm not actually sure about this. I've not tried to do this (so I will have to muck about with this to see what's possible), but hopefully someone else in the community knows an answer to this part of your question.

           

          John

            • Re: Event Frame Calculations
              obermec

              Thank you very much for pointing me at this guide. It's very useful.

               

              However, I can't find a syntax that returns the timestamp of summary value, e.g. the maximum (this probably makes sense for max and min calculations only).

              In my case I also need to know the timestamp at which the maximum value was found within the EF.

               

              Thanks,

              Christian

                • Re: Event Frame Calculations
                  John Messinger

                  Hi Christian,

                  Unfortunately, I don't believe it's possible to return a value timestamp from the PI Point data reference to be the value for an attribute, and Event Frames don't have support for Analyses (where you could use the Timestamp function against your maximum value). At a guess, I suspect that a custom data reference for this may still be the only likely option.

                  • Re: Event Frame Calculations
                    bbregenzer

                    Hi, Christian.

                    A very interesting question.  I can't say that I have an answer for you but at least I can provide a lead and we can see where it takes us.

                    I was playing around with a PI Point Max summary in an EF and noticed that the time of the maximum is actually returned as part of the EF:

                    This tells me that the time stamp you are after is stored as part of the EF, but the issue is how to access it.  So far, I haven't found any magical substitution parameter that allows me to capture the time stamp as a value in another attribute.  Also, this seems to only be visible in PSE.  We can only return the EF attribute values in DataLink.

                    I did find a few workarounds for reporting in DataLink:

                    One option is to return the Event Path column in the event frame search.  We can then concatenate this with the EF attribute name to get the full path to the attribute.  Finally, this attribute path can be used with the DataLink Current Value function to return the value and time stamp:

                    The yellow section is the  result from my EF search.  The blue piece concatenates the Event Path with a pipe ("|") and the name of the attribute from the column header.  The green section uses the Current Value fuction to look up the value and time stamp of the attribute specified in the blue cell.  Note here that I've stacked these colored sections so the screen shot is easier to read, but you could just create these as extra columns in the same row for the sake of reporting.

                    Another workaround ,which I admit isn't the prettiest, is to return the Reference Element Path, EF Start Time, and EF End Time when we pull EFs into Excel with DataLink and use this information with DataLink's Calculated Data function to return the timestamp of the Max value:

                    Maybe some the more programmatically inclined folks on here can tell us if the time stamp for the max that we see in PSE is accessible through the AF SDK so that a custom solution might be possible.

                    Also, if you can detail your use case a bit more, I'm sure Stephen Kwan (Stephen Kwan) would like to hear more about it.

                    Please let us know what you think.

                    1 of 1 people found this helpful
                      • Re: Event Frame Calculations
                        John Messinger

                        The time stamp that you see here is simply the Timestamp property of the AFValue object being displayed for this Attribute. This is accessible easily enough in code, as this is all PSE is doing, as is DataLink. The key here is how to access the timestamp as the value of another Attribute, as I believe the original post requested. As previously mentioned, the PI Point data reference only exposes the Value property of the returned AFValue object, so you can't directly access the timestamp using this data reference. A custom data reference could be written that reads the Timestamp property and returns it as the Value of another attribute. Based on what I've seen, I don't see any other way of doing this in an Event Frame.

                         

                        In a standard Element, you could use an Expression Analysis with the Timestamp function to return the required timestamp, but you can't create an Analysis directly on an Event Frame, and using this method on the referenced Element won't give you access to the EF timerange context used for calculating this maximum value in the first place.

                         

                        It would be nice if OSI could expose Analysis functionality on Event Frames, as this could allow for various types of analysis that might use the EF time range, or start and end times as inputs. Beyond that, at this stage I don't have any other identified use case for this functionality, but I suspect others in the community might.

                        1 of 1 people found this helpful
                          • Re: Event Frame Calculations
                            skwan

                            Great discussion.  Unfortunately I don't have an answer for you with our currently shipping product.  However I can tell you that the feedback I have gotten recently from customers, especially during the last user's conference, is that we need to provide more ways to access and to apply calculations to event frame attributes.  This is currently fairly high priority so hopefully we will have something for you in the 2017 release.  Thanks very much for the feedback.

                            --

                            Steve Kwan

                            1 of 1 people found this helpful