Page 1 of 1

OPC UA data type question

Posted: 17 Feb 2012, 15:27
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?

Re:OPC UA data type question

Posted: 17 Feb 2012, 15:58
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