Moving Average Filtering in DCS and PLC Analog Control
A moving-average filter is the sliding-window smoother most instrument engineers drop into DCS and PLC analog paths. Here is how the window works, how N and ...
Open a DCS or PLC analog path and you will often find a function block that is doing nothing more glamorous than averaging. It keeps the last five samples, adds them, divides by five, and writes that result as the PV the PID actually sees. That block is a moving-average filter—the sliding-window smoother most instrument engineers reach for first, because the arithmetic is obvious and the lag is predictable.
It is not a transmitter damping setting, and it is not a recursive first-order (PT1) filter. Same job—kill noise, keep the process variable usable—but a different algorithm, and a different cost in lag.
Honeywell Experion PKS C300 in a Series C cabinet: the class of DCS controller where analog PVs are commonly smoothed in Control Execution Environment function blocks before they hit a PID.
A sliding window, not a recursive memory
Keep the newest N samples. On each new scan, drop the oldest value, add the newest, and output the arithmetic mean of what remains:
Y(n) = [X(n) + X(n−1) + … + X(n−N+1)] / N
If the analog input is scanned once per second and N = 10, each output is the mean of the last ten seconds. The window width stays fixed; one sample enters as one sample leaves. That is the whole mechanism.
A first-order filter is recursive: this scan’s output depends on the previous output plus a fraction of the new sample. A moving average does not. It looks only at the raw history in the window. That is why it is easier to explain to a board operator, and why it sits naturally in a DCS or PLC that already has the memory to hold N analog values.
ABB AC500 (including AC500-S safety I/O): the same sliding-window average is typically a function block or ST snippet in Automation Builder, not a hidden transmitter menu.
Two knobs: window length and sample time
Filter strength is not N alone. Response time is N × sample period. N = 10 at 1 s is a ten-second window. The same N at 100 ms is one second. Treat them as a pair or you will copy a “good” setting from one loop onto another and wonder why the valve now crawls.
Larger N kills more noise and adds more lag. After a true step in the measurement, the filtered PV needs N samples to fully catch the new value. On a slow temperature well that is often acceptable. On a pressure or flow loop that must reject a load, a window that is too long makes the PID look lazy when the filter is the delay.
Periodic noise is the one case where you can size the window with intent. If the interference repeats about once per second and you scan at 100 ms, N = 10 covers one full cycle and averages the ripple toward zero. That is the moving average at its best: match the window to the disturbance period, not to a round number that “looks smooth” on a trend.
| Choice | What you get | What you pay |
|---|---|---|
| Small N | Faster tracking of real process steps | More residual noise on the PV |
| Large N | Smoother trend, better spike rejection | More lag; slower PID response |
| Match N to a noise period | Strong attenuation of that cycle | Wrong if the noise frequency changes |
| Faster sample, same N | Shorter real-time window | More CPU and buffer use |
Moving average versus first-order (PT1) filtering
Both are low-pass tools. The moving average is the more visual of the two: you can point at the last N samples. It also needs more memory and more additions per scan. A first-order filter is a handful of multiplies—cheap enough for a transmitter or a small embedded I/O module that cannot store a window.
On a full DCS or PLC, that memory argument rarely wins. Honeywell Experion PKS C300 processors in Series C C300 hardware and ABB AC500 CPUs in the ABB PLC series have plenty of room for a short analog history. Program the smoother where you can see it, document N and the scan rate next to the PID, and leave transmitter damping at a known, usually small, value so you are not filtering twice in series without noticing.
What it will not do
Lag is the bill for every smoother. Temperature often absorbs it. Pressure and flow loops generally do not—over-filter those PVs and the controller fights a delayed plant.
Spikes drop out of a window average reasonably well. Slow drift does not: a low-pass filter will follow a ramp, only later. If the problem is a wandering zero or a plugged impulse line, fix the measurement; do not hide it in a longer window.
A simple moving average also has no extra kick at the window edge—every sample in the buffer has equal weight. A weighted moving average (newer samples count more) tracks a step a little faster and costs more arithmetic. Use the weighted form when lag on a fast loop is the complaint and you still need averaging; stay with equal weights when you want the behavior to be obvious on the next night shift.
About the Author
Elena Vargas | Process Instrumentation Engineer
Elena Vargas works on analog signal paths for process plants—transmitter configuration, DCS/PLC filtering, and loop response on Experion PKS and PAC platforms. Her field work is mostly pressure, flow, and temperature loops where a poorly sized filter shows up as lag, not as a neat trend.