Skip to main content

DataChangeFilter — Triggering and Dead-Zone Filtering

Overview​

OPC UA Part 4 §7.17 DataChangeFilter lets the client tell the server "when to push data to me", cutting pointless publish traffic:

  • Trigger — Trigger Conditions (Status / StatusValue / StatusValueTimestamp)
  • DeadbandType — Deadband Type (None / Absolute / Percent)
  • DeadbandValue — Deadband Value
Not currently in effect

SDK. There are overloads Add of this type and those with a filter, butFilter criteria are not sent to the server., Data is still being reported in full — see "Current Behavior" below for details.

API​

Class / FieldCategoryReading and WritingNote
DataChangeFilterClass—Filter Configuration (init-only)
.TriggerPropertiesReading and WritingDataChangeTrigger enumeration, default StatusValue
.DeadbandTypePropertiesReading and WritingDeadbandType Enumeration, default None
.DeadbandValuePropertiesReading and Writingdouble, default 0.0
sub.Add(nodeId, attr, samplingMs, mode, queueSize, discardOldest, filter)MethodsWriteMI Overload with filter (the filter is currently inactive)

Related Structures:

public enum DataChangeTrigger
{
Status = 0, // Report only when there is a change StatusCode
StatusValue = 1, // StatusCode or Value change (default)
StatusValueTimestamp = 2 // StatusCode / Value / SourceTimestamp Any change
}

public enum DeadbandType
{
None = 0, // No dead zone; any change is reported
Absolute = 1, // Absolute Dead Zone, |new - old| > DeadbandValue Just Reported
Percent = 2 // Percentage Dead Zone: Only reports when |new - old| > EURange.Range × DeadbandValue / 100
}

Code Example​

using DarraOpcUa_Client;

using var ua = new DarraOpcUa("opc.tcp://localhost:4840");
ua.Connect();

using var sub = ua.CreateSubscription(publishingIntervalMs: 100);

// 1) Absolute dead zone 0.5 — Reports only when the temperature change exceeds 0.5 degrees
var filter1 = new DataChangeFilter
{
Trigger = DataChangeTrigger.StatusValue,
DeadbandType = DeadbandType.Absolute,
DeadbandValue = 0.5
};
uint mi1 = sub.Add("ns=2;s=Temp",
AttributeId.Value, samplingIntervalMs: 100,
mode: MonitoringMode.Reporting, queueSize: 1, discardOldest: true,
filter: filter1);

// 2) Percentage deadband: 2% — Flow within 2% of the full scale is not reported
var filter2 = new DataChangeFilter
{
Trigger = DataChangeTrigger.StatusValueTimestamp,
DeadbandType = DeadbandType.Percent,
DeadbandValue = 2.0
};
uint mi2 = sub.Add("ns=2;s=Flow",
AttributeId.Value, 100,
MonitoringMode.Reporting, queueSize: 1, discardOldest: true,
filter: filter2);

// 3) Status Change Only — Check for a change in the communication link status
var filter3 = new DataChangeFilter { Trigger = DataChangeTrigger.Status };
uint mi3 = sub.Add("ns=2;s=Comm.Status",
AttributeId.Value, 200, MonitoringMode.Reporting, 1, true, filter3);

sub.DataChanged += (s, e) =>
{
Console.WriteLine($"[mi={e.MonitoredItemHandle}] {e.ValueString} ({e.Status})");
};

Current Behavior (Important)​

The filter is currently not active

Overloads Add with "filter"The filter criteria will not be sent to the server, Behaviors that must be avoided without exception:

  • MI Register as usual, Filter is not applied; all data is reported in full
  • Keep only one copy of the filter locally; Do not restore during reconnection and reconstruction
  • It will trigger a "Warn" event so that [subject Diagnostic ] can UI be notified.

So passing a filter now is the same as not passing one at all—dead zones and trigger filtering are required, so please filter the data yourself in the callback DataChanged.

  • Trigger / DeadbandType / DeadbandValue refers to Part 4 §7.17 Specified Semantics, which is currently not active on the server
  • CurrentlyNo Server-side filter-related errors such BadFilterNotAllowed as — the filter wasn't sent at all

Best Practices​

Filtering is currently disabled. Here are the configuration settings (you can use them directly once filtering is enabled):

  • Analog: Absolute Deadband is the Default — Intuitive engineering units, such as 0.5°C / 0.1 bar
  • Use "Percent" for wide-range signals — For a sensor with a range of 0-1000, writing 1% is more intuitive than writing 10.
  • Digital inputs (DI) and outputs (DO) do not require a filter — State transitions are sparse to begin with
  • The dead zone shouldn't be too large. — Trend lines may be distorted
  • To ensure no samples are missed, turn it up queueSize . — Default queueSize = 1 + discardOldest = true Only the latest value is retained; intermediate samples are discarded. If the queue is full, data will be discarded; there is no guarantee that data will not be discarded.

Cross-Language Comparison​

C#PythonJavaC++RustC
DataChangeFilterDataChangeFilterDataChangeFilterDataChangeFilterDataChangeFilterDarraUa_DataChangeFilter
DataChangeTriggerDataChangeTriggerDataChangeTriggerDataChangeTriggerDataChangeTriggerDarraUa_DataChangeTrigger
DeadbandTypeDeadbandTypeDeadbandTypeDeadbandTypeDeadbandTypeDarraUa_DeadbandType

Next Step​