Skip to content

Commit 651118c

Browse files
committed
update opc ua
1 parent ce57345 commit 651118c

File tree

10 files changed

+332
-494
lines changed

10 files changed

+332
-494
lines changed
51.9 KB
Loading
54.8 KB
Loading

src/UserGuide/Master/Tree/API/Programming-OPC-UA_timecho.md

Lines changed: 40 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -21,55 +21,19 @@
2121

2222
# OPC UA Protocol
2323

24-
## 1. OPC UA
24+
## 1. OPC UA Subscription Data
2525

26-
OPC UA is a technical specification used in the automation field for communication between different devices and systems, enabling cross platform, cross language, and cross network operations, providing a reliable and secure data exchange foundation for the Industrial Internet of Things. IoTDB supports OPC UA protocol, and IoTDB OPC Server supports both Client/Server and Pub/Sub communication modes.
26+
This feature allows users to subscribe to data from IoTDB using the OPC UA protocol. The communication modes for subscription data support both Client/Server and Pub/Sub.
2727

28-
### 1.1 OPC UA Client/Server Mode
28+
Note: This feature is not about collecting data from external OPC Servers and writing it into IoTDB.
2929

30-
- **Client/Server Mode**:In this mode, IoTDB's stream processing engine establishes a connection with the OPC UA Server via an OPC UA Sink. The OPC UA Server maintains data within its Address Space, from which IoTDB can request and retrieve data. Additionally, other OPC UA Clients can access the data on the server.
30+
![](/img/opc-ua-new-1-en.png)
3131

32-
<div align="center">
33-
<img src="/img/OPCUA15.png" alt="" style="width: 70%;"/>
34-
</div>
35-
36-
37-
- Features:
38-
39-
- OPC UA will organize the device information received from Sink into folders under the Objects folder according to a tree model.
40-
41-
- Each measurement point is recorded as a variable node and the latest value in the current database is recorded.
42-
43-
### 1.2 OPC UA Pub/Sub Mode
44-
45-
- **Pub/Sub Mode**: In this mode, IoTDB's stream processing engine sends data change events to the OPC UA Server through an OPC UA Sink. These events are published to the server's message queue and managed through Event Nodes. Other OPC UA Clients can subscribe to these Event Nodes to receive notifications upon data changes.
46-
47-
<div align="center">
48-
<img src="/img/OPCUA16.png" alt="" style="width: 70%;"/>
49-
</div>
50-
51-
- Features:
52-
53-
- Each measurement point is wrapped as an Event Node in OPC UA.
54-
55-
56-
- The relevant fields and their meanings are as follows:
57-
58-
| Field | Meaning | Type (Milo) | Example |
59-
| :--------- | :--------------- | :------------ | :-------------------- |
60-
| Time | Timestamp | DateTime | 1698907326198 |
61-
| SourceName | Full path of the measurement point | String | root.test.opc.sensor0 |
62-
| SourceNode | Data type of the measurement point | NodeId | Int32 |
63-
| Message | Data | LocalizedText | 3.0 |
64-
65-
- Events are only sent to clients that are already listening; if a client is not connected, the Event will be ignored.
66-
67-
68-
## 2. IoTDB OPC Server Startup method
32+
## 2. OPC Service Startup Method
6933

7034
### 2.1 Syntax
7135

72-
The syntax for creating the Sink is as follows:
36+
The syntax to start the OPC UA protocol:
7337

7438

7539
```SQL
@@ -110,31 +74,29 @@ start pipe p1;
11074
11175
### 2.4 Usage Limitations
11276
113-
1. **DataRegion Requirement**: The OPC UA server will only start if there is a DataRegion in IoTDB. For an empty IoTDB, a data entry is necessary for the OPC UA server to become effective.
114-
115-
2. **Data Availability**: Clients subscribing to the server will not receive data written to IoTDB before their connection.
77+
1. After starting the protocol, data needs to be written to establish a connection. Only data after the connection is established can be subscribed to.
78+
2. Recommended for use in standalone mode. In distributed mode, each IoTDB DataNode acts as an independent OPC Server providing data and requires separate subscription.
11679
117-
3. **Multiple DataNodes may have scattered sending/conflict issues**
80+
## 3. Examples of Two Communication Modes
11881
119-
- For IoTDB clusters with multiple dataRegions and scattered across different DataNode IPs, data will be sent in a dispersed manner on the leaders of the dataRegions. The client needs to listen to the configuration ports of the DataNode IP separately.。
120-
121-
- Suggest using this OPC UA server under 1C1D.
122-
123-
4. **Does not support deleting data and modifying measurement point types:** In Client Server mode, OPC UA cannot delete data or change data type settings. In Pub Sub mode, if data is deleted, information cannot be pushed to the client.
82+
### 3.1 Client / Server Mode
12483
125-
## 3. IoTDB OPC Server Example
84+
In this mode, IoTDB's stream processing engine establishes a connection with the OPC UA Server via an OPC UA Sink. The OPC UA Server maintains data within its Address Space, from which IoTDB can request and retrieve data. Additionally, other OPC UA Clients can access the data on the server.
12685
127-
### 3.1 Client / Server Mode
86+
* Features:
87+
* OPC UA organizes device information received from the Sink into folders under the Objects folder according to a tree model.
88+
* Each measurement point is recorded as a variable node, storing the latest value from the current database.
89+
* OPC UA cannot delete data or change data type settings.
12890
129-
#### Preparation Work
91+
#### 3.1.1 Preparation Work
13092
13193
1. Take UAExpert client as an example, download the UAExpert client: https://www.unified-automation.com/downloads/opc-ua-clients.html
13294
13395
2. Install UAExpert and fill in your own certificate information.
13496
135-
#### Quick Start
97+
#### 3.1.2 Quick Start
13698
137-
1. Use the following SQL to create and start the OPC UA Sink in client-server mode. For detailed syntax, please refer to: [IoTDB OPC Server Syntax](#syntax)
99+
1. Use the following SQL to create and start the OPC UA Sink in client-server mode. For detailed syntax, please refer to: [IoTDB OPC Server Syntax](./Programming-OPC-UA_timecho.md#_2-1-syntax)
138100
139101
```SQL
140102
create pipe p1 with sink ('sink'='opc-ua-sink');
@@ -176,7 +138,26 @@ insert into root.test.db(time, s2) values(now(), 2)
176138
177139
### 3.2 Pub / Sub Mode
178140
179-
#### Preparation Work
141+
In this mode, IoTDB's stream processing engine sends data change events to the OPC UA Server through an OPC UA Sink. These events are published to the server's message queue and managed through Event Nodes. Other OPC UA Clients can subscribe to these Event Nodes to receive notifications upon data changes.
142+
143+
- Features:
144+
145+
- Each measurement point is wrapped as an Event Node in OPC UA.
146+
147+
- The relevant fields and their meanings are as follows:
148+
149+
| Field | Meaning | Type (Milo) | Example |
150+
| :--------- | :--------------- | :------------ | :-------------------- |
151+
| Time | Timestamp | DateTime | 1698907326198 |
152+
| SourceName | Full path of the measurement point | String | root.test.opc.sensor0 |
153+
| SourceNode | Data type of the measurement point | NodeId | Int32 |
154+
| Message | Data | LocalizedText | 3.0 |
155+
156+
- Events are only sent to clients that are already listening; if a client is not connected, the Event will be ignored.
157+
- If data is deleted, the information cannot be pushed to clients.
158+
159+
160+
#### 3.2.1 Preparation Work
180161
181162
The code is located in the [opc-ua-sink package](https://github.com/apache/iotdb/tree/rc/2.0.1/example/pipe-opc-ua-sink/src/main/java/org/apache/iotdb/opcua)under the iotdb-example package.
182163
@@ -187,7 +168,7 @@ The code includes:
187168
- Client configuration and startup logic(ClientExampleRunner)
188169
- The parent class of ClientTest(ClientExample)
189170
190-
### 3.3 Quick Start
171+
#### 3.2.2 Quick Start
191172
192173
The steps are as follows:
193174
@@ -199,7 +180,7 @@ insert into root.a.b(time, c, d) values(now(), 1, 2);
199180
200181
​ The metadata is automatically created and enabled here.
201182
202-
2. Use the following SQL to create and start the OPC UA Sink in Pub-Sub mode. For detailed syntax, please refer to: [IoTDB OPC Server Syntax](#syntax)
183+
2. Use the following SQL to create and start the OPC UA Sink in Pub-Sub mode. For detailed syntax, please refer to: [IoTDB OPC Server Syntax](./Programming-OPC-UA_timecho.md#_2-1-syntax)
203184
204185
```SQL
205186
create pipe p1 with sink ('sink'='opc-ua-sink',

src/UserGuide/V1.3.x/API/Programming-OPC-UA_timecho.md

Lines changed: 38 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -18,56 +18,19 @@
1818

1919
# OPC UA Protocol
2020

21-
## OPC UA
21+
## OPC UA Subscription Data
2222

23-
OPC UA is a technical specification used in the automation field for communication between different devices and systems, enabling cross platform, cross language, and cross network operations, providing a reliable and secure data exchange foundation for the Industrial Internet of Things. IoTDB supports OPC UA protocol, and IoTDB OPC Server supports both Client/Server and Pub/Sub communication modes.
23+
This feature allows users to subscribe to data from IoTDB using the OPC UA protocol. The communication modes for subscription data support both Client/Server and Pub/Sub.
2424

25-
### OPC UA Client/Server Mode
25+
Note: This feature is not about collecting data from external OPC Servers and writing it into IoTDB.
2626

27-
- **Client/Server Mode**:In this mode, IoTDB's stream processing engine establishes a connection with the OPC UA Server via an OPC UA Sink. The OPC UA Server maintains data within its Address Space, from which IoTDB can request and retrieve data. Additionally, other OPC UA Clients can access the data on the server.
27+
![](/img/opc-ua-new-1-en.png)
2828

29-
::: center
30-
31-
<img src="/img/OPCUA15.png" alt="" style="width: 70%;"/>
32-
33-
:::
34-
35-
- Features:
36-
37-
- OPC UA will organize the device information received from Sink into folders under the Objects folder according to a tree model.
38-
39-
- Each measurement point is recorded as a variable node and the latest value in the current database is recorded.
40-
41-
### OPC UA Pub/Sub Mode
42-
43-
- **Pub/Sub Mode**: In this mode, IoTDB's stream processing engine sends data change events to the OPC UA Server through an OPC UA Sink. These events are published to the server's message queue and managed through Event Nodes. Other OPC UA Clients can subscribe to these Event Nodes to receive notifications upon data changes.
44-
45-
::: center
46-
47-
<img src="/img/OPCUA16.png" alt="" style="width: 70%;"/>
48-
49-
:::
50-
51-
- Features:
52-
53-
- Each measurement point is wrapped as an Event Node in OPC UA.
54-
55-
- The relevant fields and their meanings are as follows:
56-
57-
| Field | Meaning | Type (Milo) | Example |
58-
| :--------- | :--------------------------------- | :------------ | :-------------------- |
59-
| Time | Timestamp | DateTime | 1698907326198 |
60-
| SourceName | Full path of the measurement point | String | root.test.opc.sensor0 |
61-
| SourceNode | Data type of the measurement point | NodeId | Int32 |
62-
| Message | Data | LocalizedText | 3.0 |
63-
64-
- Events are only sent to clients that are already listening; if a client is not connected, the Event will be ignored.
65-
66-
## IoTDB OPC Server Startup method
29+
## OPC Service Startup Method
6730

6831
### Syntax
6932

70-
The syntax for creating the Sink is as follows:
33+
The syntax to start the OPC UA protocol:
7134

7235
```sql
7336
create pipe p1
@@ -95,7 +58,7 @@ create pipe p1
9558
| sink.user | User for OPC UA, specified in the configuration | String | Optional | root |
9659
| sink.password | Password for OPC UA, specified in the configuration | String | Optional | root |
9760

98-
### 示例
61+
### Example
9962

10063
```Bash
10164
create pipe p1
@@ -107,21 +70,20 @@ start pipe p1;
10770

10871
### Usage Limitations
10972

110-
1. **DataRegion Requirement**: The OPC UA server will only start if there is a DataRegion in IoTDB. For an empty IoTDB, a data entry is necessary for the OPC UA server to become effective.
111-
112-
2. **Data Availability**: Clients subscribing to the server will not receive data written to IoTDB before their connection.
113-
114-
3. **Multiple DataNodes may have scattered sending/conflict issues**
73+
1. After starting the protocol, data needs to be written to establish a connection. Only data after the connection is established can be subscribed to.
74+
2. Recommended for use in standalone mode. In distributed mode, each IoTDB DataNode acts as an independent OPC Server providing data and requires separate subscription.
11575

116-
- For IoTDB clusters with multiple dataRegions and scattered across different DataNode IPs, data will be sent in a dispersed manner on the leaders of the dataRegions. The client needs to listen to the configuration ports of the DataNode IP separately.。
11776

118-
- Suggest using this OPC UA server under 1C1D.
77+
## Examples of Two Communication Modes
11978

120-
4. **Does not support deleting data and modifying measurement point types:** In Client Server mode, OPC UA cannot delete data or change data type settings. In Pub Sub mode, if data is deleted, information cannot be pushed to the client.
79+
### Client / Server Mode
12180

122-
## IoTDB OPC Server Example
81+
In this mode, IoTDB's stream processing engine establishes a connection with the OPC UA Server via an OPC UA Sink. The OPC UA Server maintains data within its Address Space, from which IoTDB can request and retrieve data. Additionally, other OPC UA Clients can access the data on the server.
12382

124-
### Client / Server Mode
83+
* Features:
84+
* OPC UA organizes device information received from the Sink into folders under the Objects folder according to a tree model.
85+
* Each measurement point is recorded as a variable node, storing the latest value from the current database.
86+
* OPC UA cannot delete data or change data type settings.
12587

12688
#### Preparation Work
12789

@@ -181,11 +143,30 @@ start pipe p1;
181143

182144
:::
183145

184-
### Pub / Sub Mode
146+
### Pub / Sub Mode
147+
148+
In this mode, IoTDB's stream processing engine sends data change events to the OPC UA Server through an OPC UA Sink. These events are published to the server's message queue and managed through Event Nodes. Other OPC UA Clients can subscribe to these Event Nodes to receive notifications upon data changes.
149+
150+
- Features:
151+
152+
- Each measurement point is wrapped as an Event Node in OPC UA.
153+
154+
- The relevant fields and their meanings are as follows:
155+
156+
| Field | Meaning | Type (Milo) | Example |
157+
| :--------- | :--------------------------------- | :------------ | :-------------------- |
158+
| Time | Timestamp | DateTime | 1698907326198 |
159+
| SourceName | Full path of the measurement point | String | root.test.opc.sensor0 |
160+
| SourceNode | Data type of the measurement point | NodeId | Int32 |
161+
| Message | Data | LocalizedText | 3.0 |
162+
163+
- Events are only sent to clients that are already listening; if a client is not connected, the Event will be ignored.
164+
- If data is deleted, the information cannot be pushed to clients.
165+
185166

186167
#### Preparation Work
187168

188-
The code is located in the [opc-ua-sink 文件夹](https://github.com/apache/iotdb/tree/rc/1.3.3/example/pipe-opc-ua-sink/src/main/java/org/apache/iotdb/opcua) under the iotdb-example package.
169+
The code is located in the [opc-ua-sink](https://github.com/apache/iotdb/tree/rc/1.3.5/example/pipe-opc-ua-sink/src/main/java/org/apache/iotdb/opcua) under the iotdb-example package.
189170

190171
The code includes:
191172

@@ -194,7 +175,7 @@ The code includes:
194175
- Client configuration and startup logic(ClientExampleRunner)
195176
- The parent class of ClientTest(ClientExample)
196177

197-
### Quick Start
178+
#### Quick Start
198179

199180
The steps are as follows:
200181

0 commit comments

Comments
 (0)