how to write an equation to create an alarm based on pump's motor current value and state of pump WITHOUT event frame

I would like a value to be either true or false depending on

 

1. if the pump is running

2. the average motor current is less than 5 for 5 minutes or more 

 

i have tried event frames and if statements, the closest I have got is this:

 

  • pump_avg_curr = a calculation that takes the average current between 3 PI tags for the pump
  • pump_state = a tag that lets us know if the pump is "RUNNING" or "STOPPED"
  • pump_alarm = if 'pump_state' = "RUNNING" and TagAvg('pump_avg_curr', *, *-5m) <= 5 then TRUE else FALSE

 

This works except once the pump starts running - it is using the values from before the pump started running (which is 0) in its calculation. So everytime a pump turns on, the alarm is on (reading TRUE)

 

any help would be appreciated. thanks

Parents Reply Children
No Data