qtopc-uaqt6

OpcUA address space


I'm working the first time on a project that requires an OpcUA connection. I'm using the Qt wrapper (Qt OPCUA) with the open62541 backend.

The manufacturer of the PLC that hosts the server told me the list of the variables I can access:

MT_MAX_SETUP (qreal)
MT_ALARM (bool)
...

and several others. Using the example Qt OPC UA Viewer Example I discovered the nodeId of those variables, for example:

`ns=4;s=MT_MAX_SETUP`

so I can retrieve its value after connection in this way:

_opcNode = _opcUaClient->node("ns=4;s=MT_MAX_SETUP");
connect(_opcNode, &QOpcUaNode::attributeRead, this, &MyOPC::handleAttributes);
connect(_opcNode, &QOpcUaNode::attributeUpdated, this, &MyOPC::handleAttributes);

_opcNode->readAttributes(QOpcUa::NodeAttribute::Value);

Is it correct this approach? Should the manufacturer have told me also the namespace ns=4?


Solution

  • Is it correct this approach? Should the manufacturer have told me also the namespace ns=4?

    That sounds correct to me. If something isn't working, I would double-check with them that both the namespace and the identifier are correct.

    If you need a user-facing tool to help you navigate through UA while developing, I'd recommend using UAExpert