A.4.3 Data and error mapping

A.4.3.1 General

In an OPC UA Server, Automation Data is represented as a Data Value and and status, in addition additional error data can be provided via Diagnostic Info for a tag

The COM UA Proxy maps the Data Value structure into VQT data and error code.

For successful operations(StatusCode of Good and Uncertain), the COM UA Proxy maps the Status Code of the DataValue to the OPC DA Quality But in case of error(StatusCode of Bad), the Status Code is mapped to the OPC DA Error code.

The StatusCode in the Diagnostic Info returned by the OPC UA Server are mapped to OPC DA Error codes. Figure A.17 illustrates this mapping.

Figure A.17 – OPC UA to OPC DA data & error mapping
A.4.3.2 Value

The COM UA Proxy converts the OPC UA Data Value to the corresponding OPC DA Variant type. The mapping is shown in Table A.6. For DataTypes that are subtypes of an existing base DataType the conversion for the Base DataType is used.

Table A.6 – DataTypes and Mapping
OPC UA Data type (In UA Server)Variant Data Type (In DA server)
Int16VT_I2
Int32VT_I4
FloatVT_R4
DoubleVT_R8
DecimalVT_DECIMAL
StringVT_BSTR
BooleanVT_BOOL
ByteVT_UI1
SByteVT_I1
UInt16VT_UI2
UInt32VT_UI4
Int64VT_I8
UInt64VT_UI8
GuidVT_BSTR
DateTimeVT_DATE
NodeIdVT_BSTR
XmlElementVT_BSTR
ExpandedNodeIdVT_BSTR
QualifiedNameVT_BSTR
LocalizedTextVT_BSTR
StatusCodeVT_UI4
ExtensionObjectArray of VT_UI1
Array of above OPC UA typesArray of corresponding Variant type
A.4.3.3 Quality

The Quality of a Data Value in the OPC UA Server is represented as a StatusCode.

The COM UA Proxy maps the Severity, Subcode and the limit bits of the OPC UA Status code to the lower 8 bits of the OPC DA Quality structure (of the form QQSSSSLL). Figure A.18 illustrates this mapping.

Figure A.18 – OPC UA Status Code to OPC DA quality mapping

The Severity field of the Status code is mapped to the primary quality. The SubCode is mapped to the Sub Status and the Limit Bits are mapped to the Limit field.

Table A.7 shows a mapping of the OPC UA status code to OPC DA primary quality

Table A.7 – Quality mapping
OPC UA Status Code OPC DA Primary Quality (Quality & Sub status QQSSSS)
GoodGOOD
Good_LocalOverrideLOCAL_OVERRIDE
UncertainUNCERTAIN
Uncertain_SubNormalSUB_NORMAL
Uncertain_SensorNotAccurateSENSOR_CAL
Uncertain_EngineeringUnitsExceededEGU_EXCEEDED
Uncertain_LastUsableValueLAST_USABLE
BadBAD
Bad_ConfigurationErrorCONFIG_ERROR
Bad_NotConnectedNOT_CONNECTED
Bad_NoCommunicationCOMM_FAILURE
Bad_OutOfServiceOUT_OF_SERVICE
Bad_DeviceFailureDEVICE_FAILURE
Bad_SensorFailureSENSOR_FAILURE
Bad_WaitingForInitialDataWAITING_FOR_INITIAL_DATA
A.4.3.4 Timestamp

If available, the SourceTimestamp of the DataValue in the OPC UA Server is assigned to the Timestamp for the value in the COM UA Proxy. If SourceTimestamp is not available, then the ServerTimestamp is used.