I’ve needed a time-average function several times, so I figure other people have also. Here is a handy AOI which makes it easy to use in a ControlLogix ladder program. (AB has the Moving Average MAVE instruction in function block and structured text environments but not ladder) I use this instruction when I’m trying to control something from a signal that jumps around too much. The instruction takes samples from the input at the interval you set it to, and outputs the average of all the samples. I’ve included the import file and screenshots of the ladder code.
Here is a sample of how the TimeAve instruction is used. As shown it will give the average of 8 samples taken at 100ms intervals:
The standard deviation output is a good indicator how ‘jumpy’ your input is. I’ve used it to wait for a valid number from a scale.