3 Replies Latest reply on Jun 29, 2018 2:25 PM by Rick Davin

    AF: Valid Digital states for outputs written back to PI

    Charles_Cawood

      Hi,

       

      I am currently running an analysis where I do an average of a tag

      MyAvg:    TagAvg('MyPVTag','*-15m','*',98)

      I then do a calculation:

      MyCalc:   if badval(MyAvg) then digstate("Calc Failed") else 100*(MyAvg)

      This result is written back to a PI tag.

      Will the system allow me to use a digital state other than one define in the SYSTEM state set? (i presume not as info from the documentatio states: digstate() Returns a system digital state value.)

       

      Would like to make a separate set with some specific digital states to provide a more descriptive reason why the calc did not provide a valid output.

       

      thnx

      William

        • Re: AF: Valid Digital states for outputs written back to PI
          Lal_Babu_Shaik

          Hi William

           

          DigState function can be configured with two parameters. with single parameter e.g. DigState("Error") will take system digital state by default and anyother value other than system digital state will give "Calc Failed". You can also configure two parameters e.g. DigState("Above Process Value",'PI Point reference to a digital Tag') . In this case you may have to configure Digital PI Point with custom digital set.

          • Re: AF: Valid Digital states for outputs written back to PI
            Dan Fishman

            You can only write the system digital states to your tag.  In your case, you will need a second tag to track it and this second tag can be a digital tag using what Lal Babu Shaik suggested.  Additionally, if you are using AF Enumeration sets, you can write an integer out or the value of the AF enumeration. 

              • Re: AF: Valid Digital states for outputs written back to PI
                Rick Davin

                To clarify what others have said ... you have a numeric tag.  The only type of digital state that can write back to a numeric tag is the SYSTEM stateset, and that's for bad values.  A good value would be the calculation (also numeric).  Bottom line: number means good, bad means SYSTEM state.  There is a notable edge case: if you tried to write a floating point NaN back to a PIPoint, the update will write SYSTEM state 317 Invalid_Float instead.

                 

                If you had a digital tag, you can write good values to it based on its stateset, but if you were to write a bad value, you are once again limited to the SYSTEM states.