OPC UA data type question

Unified Architecture topics related to OPC UA Specification, compliant behavior and any technical issues of OPC UA, like Security, Information Model, Companion Specs DI, PLCopen, ADI, ...

Moderator: Support Team

Post Reply
Lost+Found
Hero Member
Hero Member
Posts: 20
Joined: 07 Feb 2013, 11:01

OPC UA data type question

Post by Lost+Found »

Hello

I have a question regarding data type conversion for write.

Before I write a value from our systen to the OPC Server I need to do a conversion from our data types to the right OPC UA datatype. I know the node id of the tag to write, so I use the read OpcUa_Attribute_DataType. This gives me the node Id of the datatype.

I noticed that in the type nodeId the identifierType is numeric and the identifier values corresponds with the OpcUaType as defined by the OPC-UA spec part 6 and in opcua_builtintypes.h.

Can I expect this always to be the case in ever UA Server? It seems logical to me but I couldn’t find it in the spec.

If not, what is the best way the get the data type of a tag?

User avatar
Support Team
Hero Member
Hero Member
Posts: 2532
Joined: 18 Mar 2011, 15:09

Re:OPC UA data type question

Post by Support Team »

Hello,

If the data type is a built-in type, the numeric value in the NodeId matches the OpcUaType.

If the data type is a derived type from
- Built-in type
- Enumeration
- Structure
the data type NodeId is the NodeId of the derived data type in the address space.

If it is not a built-in type, you should browse from the data type up until you find one of the three types I mentioned above. If the base type is a built-in type, you can just convert to the built-in type. If it is an enumeration, you can write a Int32 and if it is a structure, you must handle the structure.

Best regards
Unified Automation Support Team
Best regards
Unified Automation Support Team

Post Reply