10 Replies Latest reply on Aug 10, 2018 5:44 PM by kxb4

    can I retrieve an attribute category value within an analysis expression?

    kxb4

      In building some template event frame analyses, I have a large list of start trigger expressions. Users would like to use categories set on specific element attributes to exclude some trigger expressions from evaluating to true for the template level analysis. Any ideas? I tried using a collection filter within a start trigger but PSE 2016 R2 didn't like the syntax:

       

      i.e. Start Trigger Expression

       

      '.\Elements[.]|Attribute[@Category = MyInclude Category]' = "ALARM"

       

      where Attribute is an Attribute template from the current element template. And 'MyInclude Category' represents attributes with a category that I want to evaluate vs. if the category is not set for the attribute, I'm attempting to force the analysis to avoid triggering the event frame.

       

      Evaluation returns cannot resolve string in single quotes...

       

      Any ideas?

       

      thanks,

       

      Ken Barsky

      Bridge Energy Group

        • Re: can I retrieve an attribute category value within an analysis expression?
          Dan Fishman

          You are very close!  Note, attribute should be plural. 

          Try the below instead:

          '|Attributes[@Category = MyInclude Category]' = "ALARM"

           

           

          2 of 2 people found this helpful
            • Re: can I retrieve an attribute category value within an analysis expression?
              kxb4

              Ok - so I got the fixed syntax to evaluate properly - but then I notice that after I evaluate the expression the analysis expression is converted to the identified tag from the expression. This is fine at run-time but the attribute categories I am filtering will be different per element. Is there a way to save the @category filter in the analysis expression and it not resolve until runtime?

               

              Also - what I'm really after here is a way to build out a single large event frame generation analysis for a template where some elements will have the same attributes set with different categories. The requirement is to suppress evaluation of a trigger event to true for an attribute, if it's not assigned a specific category. Is that possible without creating child attributes that use a String Builder DR to basically replicate the state of their category in an attribute vs. just referencing the category directly in the expression?

                • Re: can I retrieve an attribute category value within an analysis expression?
                  Dan Fishman

                  I don't think you can save the category filter in the analysis expression.  You might need to have all of them in an if-else ladder. 

                   

                  Have you considered using template inheritance to do this?  Each derived template would have its own event frame generation template and you might not even need to use the @Category trick.

                   

                  Dan

                    • Re: can I retrieve an attribute category value within an analysis expression?
                      kxb4

                      Thanks for your thinking through this one Dan - really appreciate. I think the real answer to the original question is No. The point of being able to reference a category in an expression is to have it grab the category when the expression is executed on triggered event or periodic schedule. So this is a limitation of the platform - seems silly as they already have the syntax built-in to get the value. I think the only solution that would work for what we are doing is to create a formula reference child attribute that references the category - in the formula reference you can use the category and you can use badval() to identify when no data is found from the filter - which the analysis expression won't do.

                       

                      The template inheritance I don't think solves the issue we are after as we are allowing for users to exclude certain attributes from these analysis expressions for specific elements. So the template works for all attributes, and covers 80-90 % of the user requirement, but then for some exceptions, they need to exclude a few attributes from the calculation. We do other similar rollup analyses also based on this exception and for those the category logic is built into the platform. To do it foe event frame generation I would have to create a subattribute on hundreds of attributes across ~20 different device templates, just replicating in another form the value of the attribute category - disappointing...

                       

                      but thanks again...

                • Re: can I retrieve an attribute category value within an analysis expression?
                  vkaufmann

                  I think this use-case is interesting. I don't have much to say about the implementation but maybe we should consider creating an enhancement request as well as bring this to Stephen Kwan's attention.

                   

                  --Vince

                    • Re: can I retrieve an attribute category value within an analysis expression?
                      skwan

                      What/who sets the categories?  Is it manually done by a person?  Or is there a logic that sets the category?

                      --

                      Steve Kwan

                        • Re: can I retrieve an attribute category value within an analysis expression?
                          kxb4

                          Yeah the categories are set by default from the template originally, but then power users, using a custom web app, can set or unset the attribute level category value based on whether for that specific element, the attribute is really of interest. These elements represent SCADA devices which are not consistently configured or in some cases where they have been configured to collect data for different audiences, so some users would prefer to ignore or exclude some attributes from firing event frame analysis and corresponding notifications for certain elements. But we were trying to avoid having to build out special event frame analysis for each of these exceptions and instead wanted to use a template analysis with start trigger expressions to include or exclude these attributes to trigger an event based on whether the attribute value meets the condition (‘attribute’=”ALARM”) AND they are set to having the ‘include’ attribute category.

                           

                          Note that we use these same attribute category values effectively in rollup analyses at the template level to identify attributes with quality or limit condition issues to only report on the ‘include’ category attributes with issues.

                           

                          The web UI, is used for customized displays of the AF model, and helps non-PSE power users quickly remap attributes to their correct PI Point references and set the appropriate category value…

                           

                          Ken Barsky

                          Principal Consultant

                          BRIDGE Energy Group

                           

                          M: 415.686.1040

                          KBarsky@BridgeEnergyGroup.com

                          www.BridgeEnergyGroup.com

                            • Re: can I retrieve an attribute category value within an analysis expression?
                              skwan

                              Ken,

                              Is it still true that you don't want to use an attribute to hold this status but rather want to use an attribute category?

                              --

                              Steve Kwan

                                • Re: can I retrieve an attribute category value within an analysis expression?
                                  kxb4

                                  Well – we went with Category since that was built-in, and it worked for our first use case of creating an aggregate indicator of quality or limit conditions for an element across templates with large numbers of attributes filtering on the attribute category value in a rollup analysis. It also is being used to filter by default the list of attributes shown in our custom UI for an element. Some of these templates have 400+ attributes, so it’s useful for the users to be able to identify when there are some attributes that should explicitly be excluded for some elements. The SDK code for filtering the attributes by category was straightforward.

                                   

                                  Knowing what I know now, I probably would have created this indicator as a child attribute instead, but since we have a significant amount of code already established to use the category, we’d prefer not to spend the time restructuring the model to use the child attribute and then make those code changes. For now there’s a work-around for users to map the unwanted attributes to a placeholder tag, but then we lose the valid association of the device with one of it’s SCADA points, even if for the current major use cases, the attribute value is not needed.

                                  Ken Barsky

                                  Principal Consultant

                                  BRIDGE Energy Group

                                   

                                  M: 415.686.1040

                                  KBarsky@BridgeEnergyGroup.com

                                  www.BridgeEnergyGroup.com