I think I have already provided that, but if you don't have AVE or MAVE:
Tags
REAL flow: continuously updated flow measurement
REAL peak: current cycle's peak flow.
REAL tot: running total
REAL arr[8]: 8 element array, arr[0] to arr[7]
BOOL pump_is_on: pump is running on this scan
BOOL pump_was_on: pump was running on previous scan
Code
XIC first_pass ### Initialization
CLR peak
CLR tot
FLL arr[0] 8 ### or ... 9; see below
OTU pump_was_on ### or OTL, so this instruction is probably superfluous
XIO pump_is_on XIC pump_was_on GRT peak 0 ### Falling edge of pump running if peak is positive
SUB tot arr[0] tot
ADD tot peak tot
COP arr[1] arr[0] 7 ### or ... 8; see below
MOV peak arr[7]
XIC pump_is_on ### Pump is running
XIO pump_was_on ### Rising edge of pump running
CLR peak
GRT flow peak MOV flow peak
OTE pump_was_on
If arr is REAL array with 9 elements, peak is arr[8], the Length of 8 in the FLL is replaced by 8, and the Length of 7 in the COP is replaced by 8, then the red instructions are not needed.
Caveats
The totalizer will represent fewer than eight peaks for the first 7 cycles, so the tot by 8 will be give a misleading value for the first hour.
With fractional REAL values, there will be some rounding error in the totalizer.