7 Replies Latest reply on Mar 29, 2018 1:55 PM by igreguri

    Current pump working time


      How to find current pump working time in seconds (from start to now)?

      I try sometning like this, but I think problem is in PrevEvent...

      IF (('Status' = "ON") AND (PrevVal('Status','*') = "OFF")) THEN Int(TimeEq('Status',PrevEvent('Status','*')="OFF",'*',"ON"))  ELSE 0


      Where I'm wrong?

        • Re: Current pump working time

          Is the a PI PE or AF Analysis?


          Is this triggered on event change or on a scheduled frequency?

          If event change then I sometimes have to subtract a second from the time to get before the current time...

          If scheduled then one second may not be enough?

          • Re: Current pump working time

            Hi Igor,


            If you are trying to determine the amount of time the Pump has been ON, I think the following would work:


            If ('Status'="On") Then Int('*'-PrevEvent('Status','*')) Else 0


            Analysis is set to periodic and I'm assuming there are no repeating same values in the Data Archive and the STEP attribute is set to ON.


            This would return the difference in time between NOW and the time that the pump received the ON value. Please note that the analysis has to be periodic. If it was Event Triggered, then PrevEvent would return the timestamp of the previous event.


            I don't understand why we would need to find the timestamp of when the Pump was OFF. Between an OFF and ON value the pump is OFF so we don't need that time difference. Apologies if I'm misunderstanding.

            Thanks, Seb

            1 of 1 people found this helpful