Triggering Links — Triggering Linked Reporting
Overview
OPC UA Part 4 §5.12.5 SetTriggering makes one MonitoredItem the trigger; when it fires, a set of linked MI is reported in a burst. Typical scenarios:
- trigger MI = Threshold Monitoring (e.g.
Temp > 80°C,Reporting/ modeDisabled) - linked MI = A set of high-frequency events that are not reported
Samplingby default MI; collect evidence for all of them when a fire occurs.
Functions similarly to a PLC's "fault logging"—it does not record data under normal conditions, but outputs window data when triggered.
The API exists, but requests are not sent to the server—each link call always returns the same value BadNotSupported; see "Current Behavior" below for details.
API
| Methods | Category | Reading and Writing | Note |
|---|---|---|---|
| sub.AddTriggeringLinks(triggerMi, linkedMis) | Methods | Write | Add a link, return the value for each link StatusCode |
| sub.RemoveTriggeringLinks(triggerMi, linkedMis) | Methods | Write | Remove Link |
public static IReadOnlyList<StatusCode> AddTriggeringLinks(
this OpcUaSubscription sub, uint triggerMonitoredItemId, IEnumerable<uint> linkedMonitoredItemIds);
public static IReadOnlyList<StatusCode> RemoveTriggeringLinks(
this OpcUaSubscription sub, uint triggerMonitoredItemId, IEnumerable<uint> linkedMonitoredItemIds);
(Extension method, in the DarraOpcUa_Client namespace.)
Code Example
using DarraOpcUa_Client;
using var ua = new DarraOpcUa("opc.tcp://localhost:4840");
ua.Connect();
using var sub = ua.CreateSubscription(100);
// 1) Threshold Monitoring (trigger), Reporting Mode
uint trigMi = sub.Add("ns=2;s=Temp.High", AttributeId.Value, samplingIntervalMs: 200);
// 2) A set of high-frequency signals (linked), Sampling mode — Not normally reported
uint mi1 = sub.Add("ns=2;s=Vibration.X", AttributeId.Value, 50,
MonitoringMode.Sampling, 10, true, null);
uint mi2 = sub.Add("ns=2;s=Vibration.Y", AttributeId.Value, 50,
MonitoringMode.Sampling, 10, true, null);
uint mi3 = sub.Add("ns=2;s=Vibration.Z", AttributeId.Value, 50,
MonitoringMode.Sampling, 10, true, null);
// 3) Set up integration — When triggered Temp.High , send a Vibration.X/Y/Z burst report
var addRes = sub.AddTriggeringLinks(trigMi, new uint[] { mi1, mi2, mi3 });
for (int i = 0; i < addRes.Count; i++)
Console.WriteLine($"link[{i}] = {addRes[i]}");
sub.DataChanged += (s, e) =>
{
Console.WriteLine($"[mi={e.MonitoredItemHandle}] {e.ValueString}");
};
// 4) Disable the linkage
sub.RemoveTriggeringLinks(trigMi, new uint[] { mi3 });
Current Behavior (Important)
AddTriggeringLinks currently inactive / RemoveTriggeringLinks The association will not be sent to the server:
- In the returned list, Each one is
StatusCode.BadNotSupported - Post a message
DiagnosticCategory: Warn Event, Description: Triggering is unavailable - No requests SetTriggering will be sent, and the server will not report this information.
So "fault recording" isn't possible right now — linked MI If it's set to Sampling, it really won't push the data; I'll just have to collect the data myself in the callback DataChanged.
- Link relationships are not preserved and will not be restored after reconnection and reconstruction (see Subscription Resumes Automatically)
Interaction with MonitoringMode (Standardized behavior; currently not in effect)
Expected Behavior of Part 4 §:5.12.5
| trigger Mode | linked Mode | Behavior |
|---|---|---|
| Reporting | Sampling | When the trigger fires, a linked burst is reported (typical) |
| Reporting | Disabled | linked: Reports are not submitted at all; even if triggered, they are not retroactively submitted. |
| Sampling | Sampling | If none are reported, it is invalid SetTriggering. |
Best Practices
- Don't rely on trigger-based interactions at this stage. — If the linkage doesn't work, and linked is MI set to
Sampling true, it really won't push anything. To "collect evidence from the time window before and after the failure," you'll need to maintain a circular buffer yourself in the callbackDataChanged. - Configure per the rules once the triggering link is live: "trigger" uses a threshold +
Reporting; "linked" uses a high-frequency signal +Sampling - "trigger" and "linked" must be in the same subscription. — Does not apply across subscriptions
- link: Use it proactively
RemoveTriggeringLinks— Not dependent on GC - Check the returned StatusCode — Each link is returned separately; if the trigger does not exist MI or has been deleted, the server will return
BadMonitoredItemIdInvalid
Cross-Language Comparison
| C# | Python | Java | C++ | Rust | C |
|---|---|---|---|---|---|
| AddTriggeringLinks | add_triggering_links | addTriggeringLinks | AddTriggeringLinks | add_triggering_links | DarraUa_Subscription_AddTriggeringLinks |
| RemoveTriggeringLinks | remove_triggering_links | removeTriggeringLinks | RemoveTriggeringLinks | remove_triggering_links | DarraUa_Subscription_RemoveTriggeringLinks |