4 Replies Latest reply on Nov 15, 2017 1:44 PM by Rick Davin

    What are the best practices for Limits Notification?


      Hi There,


      I have an AFAttribute with Min & Max limits, I also created an event frame based analysis to check whether values our within accepted limits, both checks for min and max are handled in one analysis, then I thought that I need to include a text in the notification that alerts the user that it's either a min violation or a max violation, so I thought of an EF attribute that is based on a formula to just echo the appropriate message that returns a syntax error - attached - and I'm wondering what is the best practice here specially it's a very frequent scenario. One idea is to separate each limit on it's own analysis / EF / Notification set, but that would result in a huge number of them also if HiHi / LoLo stuff are also added. What do you think?

        • Re: What are the best practices for Limits Notification?
          Rick Davin

          Hi Emad,


          In the future, could you attach pictures directly inline with your post instead of as a file attachment?  That little change can make it easier on others that are reading your posts without having them open up additional files.  See here:

          2017-11-14 06_07_57-What are the best practices for Limits Notifica... _ PI Square.png





          Next, the Formula DR does not allow text or string (other than with DigState), so you probably want an Analysis.


          You may get by 1 event frame template.  If you want more customized fields on Lo versus Hi, then you would need a Lo template and a Hi template.  In that case, I would recommend 3: a base template that defines the fields for a general limit violation, and then a Lo and Hi template with fields specific to each.  Again, all that depends upon the level of customization you desire.


          Are you using Limit Traits?

          1 of 1 people found this helpful
          • Re: What are the best practices for Limits Notification?
            Dan Fishman

            In addition to what Rick Davin is suggesting, a common workaround to formulas not working with strings is to use enumeration sets. This was pretty much standard before analysis.  The formula would produce a 0 or 1 and those would correspond to your enumerations.  There are many ways to do what you need!

              • Re: What are the best practices for Limits Notification?
                Rick Davin

                Beyond the topic of how many event frame templates you would want, and back to using Analytics or Formulas with enumeration sets, there is also the possibility of a custom data reference.  For the online course Developing Application using AF SDK, there is Exercise 4 to create a CDR to perform a limit violation check.  The CDR ConfigString only contains the path of the measurement attribute, as the applicable limit traits are automatically detected.  The CDR output will return:


                -2LoLo violated
                -1Lo violated but not LoLo
                0No limits violated, i.e. Normal
                1Hi violated but not HiHi
                2HiHi violated


                The cool thing is you may then map those integer values into an enumeration set, which unlike PI StateSets can accept negative values.


                Link to Solution to Exercise 4 Limit Check Data Reference.  Simple yet functional CDR. Includes C# and VB.NET versions.


                I also have a more advanced C# version (see link here) that extends the above to implement a data pipe, override GetValues and RecordedValues in order to apply customized compression to only output when the limit check has a new value.