Arrays and Buffers

Average Recent Measurements

medium

Averages the latest eight accepted measurements, using only received samples during warm-up.

What it teaches

A fixed window answers what happened recently. Build on Queue Parts for Processing to discard the oldest sample when a ninth arrives, then average the remaining eight. Writing each new reading over the oldest one, with a running total, gives the same answer without moving data. Zero is a reading like any other, and empty space must not drag the average down before the window fills.

Parameters

TagDirectionTypeDefaultDescription
In_SampleInputBOOL0Request to accept In_Value
In_ValueInputREAL12.5New finite measurement, magnitude at most 10000
In_ResetInputBOOL0Discard the measurement history
Out_CountOutputDINT0Number of valid readings, saturating at 8
Out_MeanOutputREAL0Average of the valid window, or 0 when empty
Sts_ReadyOutputBOOL01 once the window contains eight readings

Required behavior