Hey folks,
I wanted to share, and also source your ideas on tag syntax for OPC UA.
I've managed to add missing messages and a bit of PoC logic to emulate event subscription. It seems to work, now its time to adjust subscription handling logic.

In principle OPC UA specification defines 3 kinds of notifications [1]:
1) Data Change
2) Event
3) Status Change

These have different calls to submit request and deliver different information. Before we go deeper, remember that in OPC UA everything is based on request/response paradigm. There is no push side per say, we send a publish request to receive notification message. What our Java driver currently cover is data change, so its more or less cyclic update / data change. The event notification requires pointing out what fields of event are interesting (i.e Id, Type, Time, Message), we then receive them. Still, event notification have to be hooked at specific NodeId, Milo's examples use Server (ns=0;i=2253) and EventNotifier (12 / 0x0c) attribute, whereas data change aim Value (13 / 0x0d) attribute. These of you who are familiar with OPC-UA can see some similarities due to multiple levels of complexity (object vs its property). Interesting animal in this zoo is status change which can be used to receive information about bad signal quality (whatever it means).

Out of these 3 notification kinds data and status change are pretty much 1:1 (node id -> value, node id -> status), so each subscribed tag returns single value. The metadata concept [2] opens possibility to return more information to caller, including status. The event notification however is different, because first and foremost, we subscribe static node id (not sure if it can change), and do not send node id but browse path which is just a text:

new SimpleAttributeOperand(nodeId,
  Arrays.asList(new QualifiedName(0, new PascalString >>("EventId")<<)),
  AttributeId.Value.getValue(),
  OpcuaProtocolLogic.NULL_STRING
)

Additionally, there might be filter criteria [3] (I didn't try yet), which can be used to supply more conditions for receiving data.

Coming to the point - what do you think about defining new tag type for OPC UA to cover event fields? With this we could use this tag to specify event fields (browse path), and eventually use tag attributes for criteria:

.addEventTagAddress("EventId;REAL")
.addEventTagAddress("ns=0;i=2253;EventId;REAL") // same as above
.addEventTagAddress("Time;DATETIME")
.addEventTagAddress("Message;STRING{like=Fatal error}")

In above example the default subscribe is assumed to be ns=0;i=2253, but each event tag address would require a path.

WDYT?

Best,
Łukasz

[1] https://reference.opcfoundation.org/Core/Part4/v104/docs/7.20
[2] https://github.com/apache/plc4x/pull/1725
[3] https://reference.opcfoundation.org/Core/Part4/v104/docs/7.4.4

Reply via email to