3 Replies Latest reply on Mar 29, 2018 8:35 AM by jyi

    PI PE calculation


      I have a requirement to analyze a tag functionality.

      Consider a tag "DG001.CV" reads value between 0-10000.

      The condition here is,
      If tag value

                          0 to 2500 then RED

                          2500 to 7000 then AMBER

                          >7000 then GREEN

      with this condition i have to plot a graph which gives me,
      What is the percentage occurrence of Green, Amber and Red for that tag in a day.

        • Re: PI PE calculation

          Hi Sudhakar,


          There can be multiple way of doing this. However I would like to introduce the following function.


          PI PE offers Findxx functions (FindLE, FindLT, FindGE, Find GT...) to calculate time that the tag is in certain range for any given period of time.


          For example, if you do the following:

          FindLE('DG001.CV', 't', 'y', 2500)


          then you would get time in seconds that 'DG001.CV' was less than or equal to ('DG001.CV'<= 2500) if you divide this number by a second in a day (86400), then you would get a percentage.

          FindLE('DG001.CV', 't', 'y', 2500) / 86400


          If your tag value outputs a string already RED, AMBER or GREEN, then you can use

          FindEq('DG001.CV', 't', 'y', "RED") / 86400


          Hope this helps,


          1 of 1 people found this helpful
            • Re: PI PE calculation

              Hi Jin,
              Thanks for your reply.


              This function below gives me "Timestamp value"

              FindLE('DG001.CV', 't', 'y', 2500)


              When i divide it by 86400, i get a error with bad argument type. ( see attachment)


              I need percentage occurrence of values which falls in the below conditions,

                                  0 to 2500 then RED

                                  2500 to 7000 then AMBER

                                  >7000 then GREEN



              Regards, Sudhakar