does anyone know what it is used for? probably not.
does anyone know what it does? of course. It samples the value of 16-bit signed integer N12:14 once an hour (or some other period) over up to 20 hours (periods). Perhaps those values are used for a trend, or for recent history, or for an average.
TL;DR
The typical operation (Rungs 0002-0005) is that once every [N26:22] seconds (repeating timer on Rung 0002),
It loads (Rung 0004) the value of N12:14 onto the top of a FIFO array, which can hold up to 20 elements
If that FIFO has already had 20 elements loaded onto it, then it unloads (Rung 0003) the value at the bottom (N26:1) into N26:21. I suspect N26:21 has no significance, but the FFU command needs a destination.
It calculates (Rung 0005) the amount of time, in seconds, represented by the number of sampled elements in the FIFO, assuming all samples were acquired using the same sampling period in N26:22/T4:5.PRE, and puts the result in N26:23. With the value of N6:22 shown (3600) and the number of elements in the FIFO (R6:1.POS = 20), this calculation would yield 72000s, which causes a minor fault by overflowing the capacity of 16-bit signed integer N26:23, so the maximum possible value of 32767 is placed in N26:23 instead, and the Overflow Trap bit (S:5/0) is reset to a value of 0 so the minor fault (overflow) does not get promoted to a major fault at the end of the scan cycle, which would cause the PLC program to halt. Note that the 32767 result implies that the Math Overflow Selection status bit S:2/14 is 0 (cf. here).
The atypical operation, Rung 0001, occurs when N26:22, the sampling period changes. In that case
the timer has the new period stored in its preset,
the timer is effectively reset,
a value of 0 is loaded onto the FIFO array,
and a value is removed if the FIFO is already full.
We have not addressed when this subroutine executes: