Configuration Manual Owner's manual

Function Code 165 - Moving Average
GENERAL DESCRIPTION
The moving average function code computes a moving average from n samples taken at
a defined interval. The sample buffer fills with an input value at the end of each cycle.
At every sample interval, the current input value replaces the oldest value in the buffer.
At each sample interval, a new average is calculated.
UTILIZATION
The MOD 30ML/MODCELL compound FC165 uses Ex (expression) and Timer blocks.
Figure 165 .1.
FC165 Compound
The moving average compound calculates the average of n values by dividing the sum of
the samples by the number of samples. It operates in two modes, normal and track. In the
normal mode, the block reads a new input, discards the oldest sample, and calculates a
new average each time the sample interval passes.
In the track mode, the output equals the input. At each cycle, the buffer fills with the
tracked value.
S1 is the input to be averaged and S2 is the number of samples (n). S3 is the sample
interval in ms time and S4 is the track value.
165 - 1