3 Replies Latest reply on Dec 11, 2009 12:06 PM by dhustone

    PE tags having negative value

    formerpigeek

      i have a simple PE tag, which is just the hourly average of a tag.

       

      I am using the following equation: TAGAVG('Testtag','*','*-1h')

       

      The tag 'Testtag' is getting neagtive values and hence, the PE tags also has neagtive values.

       

      How can i filter out the neagtive values and use only the positive values of tag 'Testtag'.

       

      Thanks in advance,

       

      Amit

        • Re: PE tags having negative value
          dhustone

          Hi Amit,

           

          Try:

           

          IF TAGAVG('Testtag','*','*-1h') => 0 THEN TAGAVG('Testtag','*','*-1h') ELSE nooutput()

           

          Best regards,

           

          Glyn.

            • Re: PE tags having negative value
              formerpigeek

              Thanks Glyn.

               

              But what if i want to write the prvious value of the calculalation tag (Testtag.CALC)?

               

              What you have suggested would not write any value to the calculation tag (Testag.CALC).

               

              Could you also help on this?

               

              Thanks in advance.

               

              Amit

                • Re: PE tags having negative value
                  dhustone

                  The PE will write the value of the source tag (TESTTAG) only if the test criteria is met i.e. the value being anything over 0.

                   

                  If the value is below then nothing is written.

                   

                  I'm unsure why you would want to write the previous value of the calculated tag again in the event of the value being below 0, as this value is already in PI. Writing it again would be a waste of archive space?

                   

                  If this is the required behaviour, replace "nooutput()" with "PrevVal('testtag', '*')"

                   

                  I also got the operators the wrong way round in my first post. I put "=>" instead of ">=".

                   

                   

                   

                  Hope this helps,

                   

                  Glyn.