5 Replies Latest reply on Jul 26, 2017 12:32 AM by GreenTech

    Start a timer for a tag when it is below a certain value

    Mitch87

      Hi guys,

       

       

      I have the below code to generate an alert when a PI tag value dips below a certain value, it works the way it is but I want to add a timer into the code, so I want the alert to generate if the tag has been below X value for Y time. Can anyone help me out? :-)

       

      Public Sub EffluentAlert()
      If EffluentFlow < 500 Then
              If EffluentAlarm Then
              answer = MsgBox("Effluent Has Been Off > 12 Hours, Notify XXXX, VVVV and YYYY!", 16, "Attention")
              EffluentAlarm = False
              End If
      Else
          If Not EffluentAlarm Then
              If EffluentFlow > 75 Then
                  EffluentAlarm = True
              End If
        
          End If
      End If
      End Sub