5 Replies Latest reply on Nov 14, 2018 11:39 AM by Navaneethakrishnan

    PI AF calcs don't match PI datalink values

    caffreys_col

      I've created some PI AF analysis and attributes to work out various performance percentages. For instance we look at the time per shift a parameter is within spec while the plant is online. I've created this filter expression as an attribute, and then use this within an analysis to return the timeeq to that attribute being true, and store this in a PI tag. However when I back check the results using Datalink I get different numbers. I've done a manual check (looking at a PI trend) and the manual check confirms what the Datalink result is giving me.

       

      The calculation period is over 7 days, and I'm thinking that as I have only just created the attribute then the analysis can only look back as far as its creation date, but that doesn't seem to be the case when I put in some test tags. When I can create breakdowns of the calcs and I don't get results that I expect for 7days of data. I have a feeling its the way AF is handling the value types in the formula. The digital is down as "double" for the value type so when I create the attribute formula maybe AF doesn't handle things correctly. Here's what I've got;

      PI tag 1 = power - value type double

      PI tag2 = shift name - value type string

      PI tag 3 = drive status (digital on/off) - value type is double

      I convert PI tag 2 (shift name) to a number (Int16) as the formula can't handle a string input (or at least doesn't seem to) using a table and its stored as an Int16 value type.

      I then assign them variable names A, B , C, (power, shift number, and drive status respectively)

      the formula is...

      if A >= 90 and B == 1 and C == 1 then 1 else 0. (If all the conditions are true then return 1, else 0)

      This is then used by the analysis using timeeq('attribute filter', '*-7d','*',1) and is written to a PI tag to record the data. I've omitted the dividing function which gives the percentage value as I don't seem to even be able to get the first equation to give me the correct values.

       

      I've tried parenthesis around the individual checks, and I've tried changing the value types. Am I missing something really stupid or does AF struggle with converting between digital on/off states to integers, or am I mixing value types that aren't compatible.

       

      All help greatly appreciated!!

       

      Col

        • Re: PI AF calcs don't match PI datalink values
          Navaneethakrishnan

          Hi Col,

           

          As of my understanding you have three tags namely power (A as double), shift number (B as digital), drive status (C as double) in PI. And you have created attribute for each PI tags in the element.

           

          If the tags in the PI Server are updating fine, there is no conversion in PI AF attribute is required. It becomes complex if we are doing more process on the data type conversion.

           

          Kindly, check the below ones if it fixes your requirement,

           

          I am assuming Attribute1 as power, Attribute2 as shift number, Attribute3 as drive status and the attributes types are double, digital, double respectively

           

          Expression 1: If 'Attribute1' >= 90.0 and 'Attribute2' == DigState("Shift1", 'Attribute2') and 'Attribute3' == 1.0 then 1 else 0

          -> Save this expression 1 output with a PI tag (as integer). I am assuming the attribute name for the expression 1 output is OutputAttribute.

           

          Expression 2: TimeEq('OutputAttribute', '*-7d','*',1)

           

          Hope this helps.

           

          Regards,

          Nav.