Hi Sajan - thanks for reaching out with your question!
You can create a formula tag in Tag Builder to construct a binary variable. The formula will look something like this:
if(pump_state = “ ON”, 1, 0)
The “pump_state” variable will be mapped to your pump ON/OFF tag. You can save this tag, and it should now mirror the original tag but with 1s and 0s.
Now, to calculate how long the pump has been operating for, we can use either the statistics table OR the tag aggregation in Tag Builder.
- Statistics table: click on the statistics table button above the focus chart of the left side. This will display the key statistical parameters for the focus chart duration. The parameter that will interest you is the integral parameter, which calculates the area under the curve. For your binary tag, the integral will represent the operating time. As an example, if you would like to calculate the pump operating time over the last 24 hours, please first change your focus chart duration to 24 hours. The stats table will update according to the focus chart period/duration.
- Tag aggregation: In Tag Builder, you can build an aggregation tag. Once again, you will want to use the Integral operator on the binary tag. The limitation here for the aggregation tag is a max aggregation time period of 24 hrs.
I hope this helps - please let me know if you have any follow-up questions or if the above solutions do not quite solve your use case. Glad to hop on a call to work things out :)
Kevin