4 Replies Latest reply on Apr 3, 2018 10:12 PM by natdavidson

    AF Attribute value changing & interactions with AFSDK

    natdavidson

      I have some static AF attributes:

      I have some code to get to the attributes:

       

      The child attributes, as shown, are tied to some analysis that change their values, depending on some other checks. What i'm having trouble with is when i run this code the first time, all the child attributes' values report correctly to when i do GetValue() for the list of attributes, BUT, when i change another attribute (not shown, but it's a manual input), the child attributes value gets changed, as designed in the analytic, and in PSE the value is changed, but in my code (that is still running in the loop) doesn't see the update for the static attributes. It does see the value change for the attributes that are tied to a pi point, but not to the others. I called support and we verified that a potential fix would be to make all the child attributes pi point references, but i was hoping to get an explanation on why this behaves this way, it seems like AFSDK should be getting the value changes the same way that PSE is showing them, but that doesn't seem to be the behavior that i'm seeing. Anyone have an explanation, or maybe a possible fix, other than making them all pi points?

        • Re: AF Attribute value changing & interactions with AFSDK
          vkaufmann

          Hi Nate,

           

          I believe you will have to call Refresh on the database to pick up the change of the manually input value if you are writing to a static attribute. In general, this is not a great idea if you plan on frequently changing the manual input as a database Refresh can be considered expensive. In that case, you should use a PI Point-centric approach. I believe PSE is calling this Refresh method when updating the value in the client.

           

          --Vince

            • Re: AF Attribute value changing & interactions with AFSDK
              natdavidson

              So when i'm looking at PSE, to see the changes to the static child attributes from my screen shot, i have to hit the refresh button, which is essentially the same thing that you are saying i would need to do? Does AFSDK keep the attribute in memory so when i use GetValue(), it doesn't actually go and get the value of that attribute when it gets called?

                • Re: AF Attribute value changing & interactions with AFSDK
                  vkaufmann

                  For things like static attributes, that is the behavior. Thinking about this, generically speaking a static attribute should have a static value, so you don't want to have to make server round-trips every time you want to read that value, so it gets kept around until you refresh the objects of the database with any changes. If you expect this value to change frequently, then a static attribute is probably not what you want to use.

                   

                  You may ask yourself why you might also see a similar behavior with PI Points in PSE. PSE does not sign up for updates for data when viewing tags from PSE so when you hit Refresh in PSE it does the data call again. It also goes out to SQL to see if anything was updated there as well. Calling GetValue on a static attribute does not require a round trip to SQL to get the value. In summary, requests for PI Point DR data always requires a round trip to a server while a request for values to a static attribute may not.

                   

                  --Vince

                  1 of 1 people found this helpful