---
title: Configuring swinging door compression and noise filtering
slug: how-tos/configuring-swinging-door-compression-and-noise-filtering
docTags: GOo15ntkoXThxPf_Z8vVm
createdAt: 2026-12-01T14:32:59.640Z
---

A collector can drop points before it sends them to Historian, so you store less data. It has two ways to do this:

- **Swinging door compression** keeps the shape of the signal. It drops every point that lies on a straight line between two stored points, give or take a tolerance. Ramps and plateaus are stored as their corner points.
- **Noise filtering** (a deadband) drops a point when its value differs from the last stored value by less than a tolerance. It can also drop points that come in too fast, and repeated values for booleans and strings.

This page explains how each one works, what to expect, and how to pick the settings. For every setting and its default, see the [base collector reference](https://docs.factry.io/reference/base-collector).

## Prerequisites

- Permissions in Factry Historian to manage collectors and measurements.
- A collector that supports compression. The OPC-UA collector supports it from v2.2.0. Use v2.5.5 or later (base collector v4.3.2): older versions store extra points on flat signals when another measurement on the same collector changes quality.

## Collector settings and measurement overrides

Both features are configured the same way.

- **On the collector**, the settings apply to every measurement on that collector. Saving them restarts the collector.
- **On a measurement**, set `SwingingDoorOverride` or `NoiseFilterOverride` to true. That measurement then uses its own settings for that feature and ignores the collector's. To exclude one measurement, set the override to true and `SwingingDoorEnabled` or `NoiseFilterEnabled` to false.

Tolerances are either absolute, in the measurement's engineering units (`SwingingDoorTolerance`, `NoiseFilterTolerance`), or a percent of the `ValueMin` to `ValueMax` span in the measurement's engineering specs (`SwingingDoorTolerancePercent`, `NoiseFilterTolerancePercent`). A percent lets one collector setting fit measurements with different ranges: 0.5% is 5 cm on a 0 to 10 m level and 30 mbar on a 0 to 6 bar pressure.

:::hint{type="info"}
A percent tolerance only takes effect on measurements that have a `ValueMin` and `ValueMax`. For other measurements, the collector uses the absolute tolerance instead.
:::

When both features are enabled, the collector runs the noise filter first and swinging door compression on the points that remain.

## Swinging door compression

### How it works

![Swinging door compression on a sine wave](https://raw.githubusercontent.com/emrumo/swingingdoor/4d3737971436c9965bb14a51991d958f5b0aee98/img/animation1.gif)

*Animation from&#x20;*[emrumo/swingingdoor](https://github.com/emrumo/swingingdoor)*&#x20;(MIT license).*

The animation uses the following terms:

- **Archived point**: a point the collector stored.
- **Snapshot point**: the latest point the collector holds back, not yet stored.
- **compDev**: the tolerance (`SwingingDoorTolerance`).
- **Cone slopes**: the two "doors". They start at the last stored point and pass the tolerance above and below each new point. With every point, the doors close a little.

While new points fall between the doors, the collector drops the held-back point and holds back the new one. When a point falls outside the doors, the collector stores the held-back point, and the doors start again from there. A straight line between two consecutive stored points stays within the tolerance of every point dropped between them.

### What gets compressed

- Only measurements with datatype number. Booleans and strings pass through unchanged.
- `NaN` and infinite values pass through unchanged. The collector first stores the point it was holding back.
- When the quality (status) of a point changes, the collector first stores the point it was holding back, then the point with the new quality. Swinging door never hides a quality change.

### Example

A measurement is sampled every second for 60 seconds. It is flat at 20 for 10 seconds, ramps to 30 over 10 seconds, then stays at 30. The tolerance is 0.5.

| Time           | Value    | Stored?                                                                   |
| -------------- | -------- | ------------------------------------------------------------------------- |
| 0 s            | 20       | Yes, the first point is always stored                                     |
| 1 to 8 s       | 20       | No                                                                        |
| 9 s            | 20       | Yes, the start of the ramp                                                |
| 10 to 18 s     | 21 to 29 | No                                                                        |
| 19 s           | 30       | Yes, the end of the ramp                                                  |
| 20 s and later | 30       | Not until the signal changes, or `SwingingDoorMaxTimeBetweenEmits` passes |

Of the 60 points, 3 are stored while the collector runs: the start and both corners of the ramp. The last value, 30, is stored when the collector stops. A trend through the stored points has the same shape as the original signal.

### The latest value lags

The collector holds back the latest point until a later point shows whether it is a corner. So the latest value in Historian lags behind the real one:

- While a signal is stable, nothing new is stored. A dashboard that shows the latest value, or an alert on stale data, sees an old timestamp.
- The point held back can be a corner. In the example, until a point after 19 s arrives, the latest stored value is 20 while the signal is already at 30.
- With `SwingingDoorMaxTimeBetweenEmits` at `0s` (the default), a signal that stays flat stores nothing until it changes or the collector stops.

Set `SwingingDoorMaxTimeBetweenEmits` on sources that deliver a sample at a fixed rate, such as polled OPC-UA measurements. With `15s` in the example above, the collector also stores 30 at 34 s and 49 s. Choose a value that matches how stale a latest value may be, for example `1m` for an operator dashboard or `1h` for slow utility meters.

:::hint{type="warning"}
Max time is only checked when a new sample arrives. Sources that only report changes, such as monitored OPC-UA measurements or MQTT topics that publish on change, deliver no samples while a value is flat. On those sources max time never fires, and the held-back point stays unstored until the value changes or the collector stops. The latest value in Historian can then be wrong, not only old. Do not use swinging door on such measurements when the latest value matters.
:::

On a clean stop, the collector stores the points it holds back. If the collector process is killed or crashes, those points are lost: at most one per measurement.

## Noise filtering

### How it works

The noise filter compares each point with the **last stored** point, not with the previous sample. It stores the point right away, or drops it for good. Nothing is held back, so the latest value does not lag.

A point is dropped when any of these is true:

- For a number: its value differs from the last stored value by less than the tolerance.
- For a boolean or string: the tolerance is above 0 and its value equals the last stored value. Only changes are stored.
- For any datatype: it comes less than `NoiseFilterMinTimeBetweenPoints` after the last stored point, whatever its value.

A point is always stored when `NoiseFilterMaxTimeBetweenEmits` has passed since the last stored point. Like swinging door, this is only checked when a new sample arrives, so it does not fire on a source that only reports changes.

A percent tolerance applies to any datatype whose engineering specs have a `ValueMin` and `ValueMax`. A boolean with a span of 0 to 1 and a percent tolerance above 0 therefore drops repeated values.

`NaN` and infinite values pass through unchanged.

:::hint{type="warning"}
The noise filter only looks at values, not at quality. When the quality changes but the value stays within the tolerance, the point is dropped. For example, a value that stays at 20 while its quality goes from Good to Bad and back stores no Bad point at all. Do not enable the noise filter on measurements where you need to see quality changes.
:::

### Example

The same signal as above: flat at 20, a ramp of 1 per second to 30, then flat at 30. The tolerance is 3.

| Time           | Value | Stored?                               |
| -------------- | ----- | ------------------------------------- |
| 0 s            | 20    | Yes, the first point is always stored |
| 12 s           | 23    | Yes, 3 away from 20                   |
| 15 s           | 26    | Yes                                   |
| 18 s           | 29    | Yes                                   |
| 19 s and later | 30    | No, only 1 away from 29               |

The plateau at 30 is stored as 29. The noise filter can leave a stored value up to one tolerance away from the real value, for as long as the signal stays within that band. `NoiseFilterMaxTimeBetweenEmits` corrects this: the next forced point carries the real value.

The bound of one tolerance holds when a trend holds each stored value until the next one (step interpolation). A trend that draws straight lines between stored points can be much further off at a step change. If the value is 20 until 9 s and jumps to 50 at 10 s, the stored points are 20 at 0 s and 50 at 10 s, and a linear trend shows 47 at 9 s.

Because the filter compares with the last stored value, a slow drift is not lost. A signal that rises 0.1 per second with a tolerance of 0.5 is stored every 5 seconds.

### Minimum time drops changes too

`NoiseFilterMinTimeBetweenPoints` drops every point that comes too soon after the last stored point, also large changes and boolean or string changes. What that does to a short event depends on when the last point was stored. With a minimum of 5 seconds, take a spike from 20 to 50 that lasts 2 seconds:

- If a point was stored just before the spike, the spike is not stored at all.
- If the last stored point is older than 5 seconds, the spike value 50 is stored, the return to 20 is dropped, and Historian shows 50 until the next point is stored, at the earliest 5 seconds later.

Only use it to cap the rate of a signal that updates much faster than you need, never on a signal where short events matter. When both `NoiseFilterMinTimeBetweenPoints` and `NoiseFilterMaxTimeBetweenEmits` are set, the minimum must be smaller than the maximum. Otherwise the settings are rejected. On a collector, the collector fails to start. On a measurement, the collector logs a warning and does not fall back to the collector settings: a new measurement gets no noise filtering at all, and an existing one keeps its previous settings.

## Swinging door or noise filter?

Swinging door keeps a trend drawn with straight lines between stored points within the tolerance of what the sensor reported. The noise filter keeps each stored value within the tolerance until the next one, which matches a step trend. The difference is in what they store.

|                 | Swinging door                                                                                        | Noise filter                                                      |
| --------------- | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| Datatypes       | Numbers only                                                                                         | Numbers, booleans, strings                                        |
| Ramps           | Stores the two corners                                                                               | Stores a point every tolerance step                               |
| Latest value    | Lags until the signal changes or max time passes; can stay wrong on sources that only report changes | Stored right away                                                 |
| Quality changes | Stored, unless the noise filter is also enabled                                                      | Dropped when the value stays within the tolerance                 |
| Best for        | Analog values that ramp and settle: temperatures, levels, flows                                      | Signals that sit still with small noise, booleans, status strings |

As an indication, an hour of a 1-second signal (a slow sine wave of ±10 with noise of 0.2 standard deviation) keeps this many points of 3600:

| Tolerance | Swinging door | Noise filter |
| --------- | ------------- | ------------ |
| 0.1       | 2622          | 2623         |
| 0.5       | 516           | 527          |
| 1         | 52            | 211          |
| 2         | 26            | 106          |

At tolerances close to the noise level, both store about the same number of points. Once the tolerance is well above the noise, swinging door stores far fewer points on a changing signal.

### Using both

When both are enabled, swinging door only sees the points the noise filter lets through. This has three effects:

- Points the noise filter drops never reach swinging door, so `SwingingDoorMaxTimeBetweenEmits` cannot fire on a flat signal. Set `NoiseFilterMaxTimeBetweenEmits` as well. A point the noise filter forces through is then held back by swinging door, so the latest value can lag by up to about both max times added together.
- The errors add up: a stored trend can be off by up to about both tolerances together.
- The noise filter drops quality changes before swinging door sees them, so with both enabled, quality changes within the tolerance are lost.

## Changing settings

When you change compression settings on a collector or measurement, the collector stores the point swinging door was holding back, and both features start again from the next point. Data already stored is not changed.

## Choosing a tolerance

- Start from the accuracy you need, not from a compression ratio. With swinging door, a tolerance of 0.5 °C means a trend through the stored points is within 0.5 °C of what the sensor reported.
- Keep the tolerance above the sensor noise, otherwise little is dropped.
- Keep it below the smallest change that matters for your analysis or alarms. Changes smaller than the tolerance are smoothed away.
- Try it on a few measurements first with an override, and compare the trend and point count with an uncompressed period.
