OPC UA MonitoringMode is more than an on-off switch. DISABLED stops sampling and clears queued notifications. SAMPLING continues to evaluate the source and build a queue but normally withholds that queue from the Subscription. REPORTING samples, queues, and makes notifications available for transfer. Moving among these modes therefore preserves or destroys different parts of a robot signal's recent state.
The distinction supports bandwidth control, triggering, and redundant-server designs. It also creates traps. A client that changes to DISABLED expecting a pause-and-resume buffer loses queued data. A client that changes to SAMPLING expecting no server work still consumes sampling and queue resources.
## Three explicit behaviors
OPC UA Part 4 defines MonitoringMode as an enumeration for each MonitoredItem. In DISABLED, the item is not sampled or evaluated, notifications are not generated or queued, and reporting is off. In SAMPLING, the item is sampled and evaluated; notifications are generated and queued, but normal reporting is off. In REPORTING, the same sampling and queuing occur and reporting is enabled.
The Subscription's publishing-enabled setting is separate. Changing it does not change a MonitoredItem's MonitoringMode. Likewise, disabling a MonitoredItem does not erase its configured sampling interval, filter, or queue parameters, even though it stops their active behavior.
## DISABLED is a reset of queued evidence
The SetMonitoringMode service states that setting a MonitoredItem to DISABLED causes all queued notifications to be deleted. That rule makes DISABLED unsuitable for a pause in which the client expects to receive the backlog later.
Suppose a robot torque item has queued values from a short overload transition. If the client disables the item before publication, those queued notifications are removed. Re-enabling does not recover them. The client should record the transition boundary and treat the interval as unobserved.
When an item is created enabled, or changed from DISABLED to SAMPLING or REPORTING, the server reports the first sample as soon as possible. That sample establishes the starting point for the next sampling interval. It is a fresh enablement boundary, not continuation of the deleted queue.
## SAMPLING retains a hidden queue
SAMPLING is useful when the client wants the server to keep evaluating a signal without sending every notification immediately. Values that pass the filter are queued. They can later be reported through the triggering model when another MonitoredItem triggers them.
For example, joint position, torque, and speed items can remain in SAMPLING while a fault item acts as a trigger. When the fault notification is queued, the server can release the associated sampled context. This reduces normal wire traffic while keeping recent pre-fault evidence within the configured queues.
SAMPLING is not indefinite history. QueueSize and discardOldest still control capacity. If the trigger arrives after the queues overflow, the released context is incomplete and can carry overflow evidence. The queue must be sized for the longest expected interval between triggers.
Without a triggering link, switching an item from SAMPLING to REPORTING makes its queued notifications available through normal subscription reporting. Applications should test the server's exact delivery sequence and timestamps around the mode change.
## REPORTING is the ordinary streaming state
REPORTING enables the full path: sample, evaluate, generate, queue, and report. Notifications become available to the Subscription and are packaged according to its publishing cycle and Publish requests.
Changing to REPORTING does not make the source sample immediately beyond the rules for enabling from DISABLED. If the item was already in SAMPLING, it has remained active and may already contain queued notifications. The first delivery can therefore include older context rather than only a value captured at the mode-change instant.
Client diagnostics should distinguish mode-change time, notification SourceTimestamp, and receive time. Those timestamps answer different questions and explain why the first reported batch may precede the command.
## Mode transitions need explicit contracts
Before changing modes, define what happens to queued history. REPORTING to SAMPLING keeps sampling and queuing but stops normal reporting. SAMPLING to REPORTING exposes accumulated notifications. Either enabled mode to DISABLED deletes queues and stops evaluation. DISABLED to an enabled mode starts with a first sample as soon as possible.
The SetMonitoringMode response returns a StatusCode for each requested MonitoredItem. Check every result. A batch request can succeed for some items and fail for others, leaving a group in mixed modes. Record the server-assigned MonitoredItem identifiers, intended mode, confirmed result, and transition time.
Do not infer mode from a quiet network. A REPORTING item may have no changes. A SAMPLING item may be building a queue. A DISABLED item may be silent because no evaluation occurs. Read and retain the configuration state managed by the client, and use diagnostics or a controlled stimulus to validate behavior.
## Redundancy and triggering use the same semantics
Part 4 describes redundant-client patterns in which one server reports while backup servers remain sampling. On failover, the client enables reporting on the next server. Queue sizes must preserve enough data across the switchover, and timestamps are needed to reconcile overlap or gaps.
The same principle applies to event-triggered robot diagnostics. Sampling-only items are valuable because their queues preserve context, not because SAMPLING is a low-cost disabled mode. Capacity and server load should include those active items.
## A practical test matrix
Create one MonitoredItem with a known source and queue. In REPORTING, verify normal delivery. Change to SAMPLING, produce several changes, and confirm they are withheld. Restore REPORTING and inspect the released queue. Repeat with a trigger link. Then enter DISABLED, produce changes, re-enable, and verify that pre-disable queued notifications do not return and that a new first sample appears.
Also test queue overflow while in SAMPLING, partial failures in a batch SetMonitoringMode call, and Subscription publishing disabled independently of MonitoredItem mode. Those cases reveal assumptions hidden by simple steady-state testing.
MonitoringMode lets an OPC UA client decide whether a MonitoredItem does no evaluation, retains private queued context, or participates in normal reporting. Robot applications remain predictable when they treat mode transitions as changes to state retention and delivery, not merely changes to network traffic.