OPC DA (OPC Data Access) is a communication protocol standard in the field of industrial automation and a core part of the classic OPC (OLE for Process Control) technology. Its primary goal is to enable real-time data exchange between industrial devices and software (such as SCADA, HMI, and databases) in a Windows environment. OPC DA is implemented based on COM/DCOM and is a lightweight protocol with two roles: server and client.
IoTDB (available since V1.3.5.2 for V1.x) provides an OPC DA Sink that supports pushing tree-model data to a local COM server plugin. It encapsulates the OPC DA interface specifications and their inherent complexity, significantly simplifying the integration process. The data flow diagram for the OPC DA Sink is shown below.
---- Note: The clsID here needs to be replaced with your own clsID create pipe opc ( 'sink'='opc-da-sink', --- 'opcda.progid'='opcserversim.Instance.1' 'opcda.clsid'='CAE8D0E1-117B-11D5-924B-11C0F023E91C' );
| Parameter | Description | Value Range | Required |
|---|---|---|---|
| sink | OPC DA Sink | String: opc-da-sink | Yes |
| sink.opcda.clsid | The ClsID (unique identifier string) of the OPC Server. It is recommended to use clsID instead of progID. | String | Either clsID or progID must be provided |
| sink.opcda.progid | The ProgID of the OPC Server. If clsID is available, it is preferred over progID. | String | Either clsID or progID must be provided |
When used, IoTDB will push the latest data from its tree model to the server. The itemID for the data is the full path of the time series in the tree model, such as root.a.b.c.d. Note that, according to the OPC DA standard, clients cannot directly create items on the server side. Therefore, the server must pre-create items corresponding to IoTDB's time series with the itemID and the appropriate data type.
| IoTDB | OPC-DA Server |
|---|---|
| INT32 | VT_I4 |
| INT64 | VT_I8 |
| FLOAT | VT_R4 |
| DOUBLE | VT_R8 |
| TEXT | VT_BSTR |
| BOOLEAN | VT_BOOL |
| DATE | VT_DATE |
| TIMESTAMP | VT_DATE |
| BLOB | VT_BSTR (Variant does not support VT_BLOB, so VT_BSTR is used as a substitute) |
| STRING | VT_BSTR |
| Symbol | Error Code | Description |
|---|---|---|
| OPC_E_BADTYPE | 0xC0040004 | The server cannot convert the data between the specified format/requested data type and the canonical data type. This means the server‘s data type does not match IoTDB’s registered type. |
| OPC_E_UNKNOWNITEMID | 0xC0040007 | The item ID is not defined in the server‘s address space (when adding or validating), or the item ID no longer exists in the server’s address space (when reading or writing). This means IoTDB's measurement point does not have a corresponding itemID on the server. |
| OPC_E_INVALIDITEMID | 0xC0040008 | The itemID does not conform to the server's syntax specifications. |
| REGDB_E_CLASSNOTREG | 0x80040154 | Class not registered |
| RPC_S_SERVER_UNAVAILABLE | 0x800706BA | RPC service unavailable |
| DISP_E_OVERFLOW | 0x8002000A | Exceeds the maximum value of the type |
| DISP_E_BADVARTYPE | 0x80020005 | Type mismatch |
Modify the server configuration to prevent IoTDB‘s write client and Kepware’s read client from connecting to two different instances, which would make debugging impossible.
Help > Show OPC Server Infocreate pipe opc ('sink'='opc-da-sink', 'opcda.clsid'='CAE8D0E1-117B-11D5-924B-11C0F023E91C')
create timeseries root.a.b.c.r string;
insert into root.a.b.c (time, r) values(10000, "SomeString")
Check the data in Quick Client; it should have been updated.