Water metering historical data

I have a water meter pulsing to a plc input and incrementing a totalising counter at PLC level.
This value is cumulative and is being logged into ignition SQL database every 5 minutes.
I wish to generate a timescale graph to display the number of pulses every hour . This would show the difference or delta of the reading between each hour to determine the rate of change throughout the day.
Do I use variance aggregate mode? Will this calculate the difference between the data table samples

you can use a tag change script. each time the tag changes, write the difference to another tag and historize it.

1 Like

You would use your database’s lead() or ‘lag()` window aggregate function to pull adjacent rows’ values into a subtraction operation on the current row. Do that in a subquery where the outer query sums that difference and groups by hour.

1 Like