A.3.2 Data and error mapping

A.3.2.1 General

In a DA server, Automation Data is represented by Value, Quality and Time Stamp for a Tag.

The COM UA Wrapper maps the VQT data to the Data Value and Diagnostic Info structures.

The Error codes returned by the DA server are based on the HRESULT type. The COM UA Wrapper maps this error code to an OPC UA Status Code. Figure A.14 illustrates this mapping.

Figure A.14 – OPC COM DA to OPC UA data and error mapping
A.3.2.2 Value

The data values in the DA server are represented as Variant data type. The COM UA Wrapper converts them to the corresponding OPC UA DataType. The mapping is shown in Table A.2:

Table A.2 – DataTypes and mapping

Variant Data Type

(In DA server)

OPC UA Data type Mapping in COM UA Server

(DataValue structure)

VT_I2Int16
VT_I4Int32
VT_R4 Float
VT_R8Double
VT_BSTRString
VT_BOOLBoolean
VT_UI1Byte
VT_I1SByte
VT_UI2UInt16
VT_UI4UInt32
VT_I8Int64
VT_UI8UInt64
VT_DATEDouble
VT_DECIMALDecimal
VT_ARRAYArray of OPC UA types

.

A.3.2.3 Quality

The Quality of a Data Value in the DA server is represented as a 16 bit value where the lower 8 bits is of the form QQSSSSLL (Q: Main Quality, S: Sub Status, L: Limit) and higher 8 bits is vendor specific.

The COM UA Wrapper maps the DA server to the OPC UA Status code as shown in Figure A.15:

Figure A.15 – Status Code mapping

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

Please note that the Vendor quality is currently discarded.

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

Table A.3 – Quality mapping
OPC DA Primary Quality (Quality & Sub status QQSSSS)OPC UA Status Code
GOODGood
LOCAL_OVERRIDE Good_LocalOverride
UNCERTAINUncertain
SUB_NORMALUncertain_SubNormal
SENSOR_CALUncertain_SensorNotAccurate
EGU_EXCEEDEDUncertain_EngineeringUnitsExceeded
LAST_USABLEUncertain_LastUsableValue
BADBad
CONFIG_ERRORBad_ConfigurationError
NOT_CONNECTEDBad_NotConnected
COMM_FAILUREBad_NoCommunication
DEVICE_FAILUREBad_DeviceFailure
SENSOR_FAILUREBad_SensorFailure
LAST_KNOWNBad_OutOfService
OUT_OF_SERVICEBad_OutOfService
WAITING_FOR_INITIAL_DATABad_WaitingForInitialData
A.3.2.4 Timestamp

The Timestamp provided for a value in the DA server is assigned to the SourceTimeStamp of the DataValue in the COM UA Wrapper.

The ServerTimeStamp in the DataValue is set to the current time by the COM UA Wrapper at the start of the Read Operation.