@amigo9090/ih-libiec61850-node 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amigo9090/ih-libiec61850-node",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Node.js addon for IEC 61850 client (MMS, GOOSE) using libiec61850",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -13,6 +13,7 @@
13
13
  "files": [
14
14
  "index.js",
15
15
  "builds/",
16
+ "builds/windows_x64/iec61850.dll",
16
17
  "examples/"
17
18
  ],
18
19
  "dependencies": {
package/readme.md CHANGED
@@ -1,17 +1,19 @@
1
- # ih-lib60870-node
1
+ # ih-lib61850-node
2
2
 
3
- A cross-platform Node.js native addon for the **IEC 60870-5 protocol suite**, enabling seamless communication with industrial control systems, SCADA, and RTUs. Built with `node-gyp` and `prebuild`, this addon ensures compatibility across multiple operating systems and architectures.
3
+ A cross-platform Node.js native addon for the **IEC 61850 protocol**, enabling seamless communication with substation automation systems. Built with `node-gyp` and `prebuild`, this addon ensures compatibility across multiple operating systems and architectures.
4
4
 
5
5
  ---
6
6
 
7
7
  ## ✨ Features
8
8
 
9
- - **IEC 60870-5 Protocol Support**: Implements key functionalities of IEC 60870-5 standards (e.g., IEC 60870-5-101/104) for robust industrial automation communication.
9
+ - **IEC 61850 Protocol Support**: Implements key functionalities of the IEC 61850 standard for substation automation, including GOOSE (Generic Object Oriented Substation Events) and MMS (Manufacturing Message Specification).
10
10
  - **Cross-Platform Compatibility**: Supports Windows, Linux, and macOS with prebuilt binaries for x64, arm, and arm64 architectures.
11
11
  - **High Performance**: Native C++ implementation optimized for low-latency and reliable data exchange.
12
- - **File Transfer**: Supports file transfer operations in both monitoring and control directions.
12
+ - **GOOSE and MMS Support**: Real-time GOOSE message handling and client-server interaction via MMS.
13
+ - **File Transfer**: Supports file transfer operations as per IEC 61850 standards.
13
14
  - **Flexible Integration**: Easy-to-use APIs for integration with Node.js applications, SCADA systems, or custom control solutions.
14
15
  - **Prebuilt Binaries**: Includes precompiled binaries for Node.js v20, simplifying setup and deployment.
16
+ - **Windows DLL Support**: Includes `iec61850.dll` for Windows, automatically placed alongside `addon_iec61850.node` for ease of use.
15
17
 
16
18
  ---
17
19
 
@@ -31,7 +33,7 @@ A cross-platform Node.js native addon for the **IEC 60870-5 protocol suite**, en
31
33
  2. Install the package via npm:
32
34
 
33
35
  ```bash
34
- npm install ih-lib60870-node
36
+ npm install @amigo9090/ih-libiec61850-node
35
37
  ```
36
38
 
37
39
  3. Prebuilt binaries will be automatically downloaded for your platform and architecture. If a prebuilt binary is unavailable, the addon will be compiled using `node-gyp`, requiring:
@@ -40,81 +42,44 @@ A cross-platform Node.js native addon for the **IEC 60870-5 protocol suite**, en
40
42
  - `gcc` on Linux
41
43
  - `MSVC` on Windows
42
44
  - `clang` on macOS
45
+ 4. For Windows: The `iec61850.dll` file is automatically included in the `builds/windows_x64/` directory alongside `addon_iec61850.node`.
43
46
 
44
47
  ---
45
48
 
46
49
  ## 📖 Usage
47
50
 
48
- Below is an example of using `ih-lib60870-node` to establish an IEC 60870-5-104 connection and handle data:
51
+ Below is an example of using `ih-lib61850-node` to establish an IEC 61850 connection and handle GOOSE and MMS messages:
49
52
 
50
53
  ```javascript
51
- const { IEC104Client } = require('ih-lib60870-node');
52
- const util = require('util');
53
- const fs = require('fs');
54
-
55
- // Initialize an IEC 60870-5-104 client
56
- const client = new IEC104Client((event, data) => {
57
- if (data.event === 'opened') client.sendStartDT();
58
- console.log(`Server 1 Event: ${event}, Data: ${util.inspect(data)}`);
59
- if (data.event === 'activated') client.sendCommands([
60
- { typeId: 100, ioa: 0, asdu: 1, value: 20 }, // Interrogation command
61
- { typeId: 45, ioa: 145, value: true, asdu: 1, bselCmd: true, ql: 1 }, // C_SC_NA_1: On
62
- { typeId: 46, ioa: 4000, value: 1, asdu: 1, bselCmd: 1, ql: 2 }, // C_DC_NA_1: Off
63
- { typeId: 47, ioa: 147, value: 1, asdu: 1, bselCmd: 1, ql: 0 }, // C_RC_NA_1: Increase
64
- { typeId: 48, ioa: 148, value: 0.001, asdu: 1, selCmd: 1, ql: 0 }, // C_SE_NA_1: Normalized setpoint
65
- { typeId: 49, ioa: 149, value: 5000, asdu: 1, bselCmd: 1, ql: 0 }, // C_SE_NB_1: Scaled setpoint
66
- { typeId: 50, ioa: 150, value: 123.45, asdu: 1 }, // C_SE_NC_1: Floating point setpoint
67
- ]);
54
+ const { IEC61850Client } = require('@amigo9090/ih-libiec61850-node');
55
+
56
+ // Initialize an IEC 61850 client
57
+ const client = new IEC61850Client({
58
+ host: '192.168.0.1',
59
+ port: 102,
60
+ // Additional configuration parameters
68
61
  });
69
62
 
70
- const client2 = new IEC104Client((event, data) => {
71
- if (data.event === 'opened') client2.sendStartDT();
72
- console.log(`Server 2 Event: ${event}, Data: ${util.inspect(data)}`);
63
+ // Connect to the server
64
+ client.connect();
65
+
66
+ // Subscribe to GOOSE messages
67
+ client.subscribeGOOSE('domain', 'gooseId', (message) => {
68
+ console.log('Received GOOSE message:', message);
73
69
  });
74
70
 
75
- async function main() {
76
- const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
77
-
78
- client.connect({
79
- ip: "192.168.0.1",
80
- port: 2404,
81
- clientID: "client1",
82
- ipReserve: "192.168.0.2",
83
- reconnectDelay: 2, // Reconnection delay in seconds
84
- originatorAddress: 0,
85
- asduAddress: 1,
86
- k: 12,
87
- w: 8,
88
- t0: 30,
89
- t1: 15,
90
- t2: 10,
91
- t3: 20,
92
- maxRetries: 5
93
- });
94
-
95
- client2.connect({
96
- ip: "192.168.0.10",
97
- port: 2404,
98
- clientID: "client2",
99
- originatorAddress: 1,
100
- k: 12,
101
- w: 8,
102
- t0: 30,
103
- t1: 15,
104
- t2: 10,
105
- t3: 20,
106
- reconnectDelay: 2,
107
- maxRetries: 5
108
- });
109
-
110
- // Wait for synchronization (optional)
111
- await sleep(1000);
112
- }
113
-
114
- main();
71
+ // Send an MMS request
72
+ client.sendMMSRequest('domain', 'itemId', (response) => {
73
+ console.log('MMS response:', response);
74
+ });
75
+
76
+ // Handle events
77
+ client.on('event', (event) => {
78
+ console.log('Event:', event);
79
+ });
115
80
  ```
116
81
 
117
- 📚 **Additional Examples**: Examples for each supported protocol (e.g., IEC 60870-5-101, IEC 60870-5-104) are available in the [`examples/` directory](examples/). These demonstrate various configurations and use cases for industrial automation.
82
+ 📚 **Additional Examples**: Examples for all supported functionalities are available in the [`examples/` directory](https://github.com/intrahouseio/ih-lib61850-node/tree/main/examples). These demonstrate various configurations and use cases for substation automation.
118
83
 
119
84
  ---
120
85
 
@@ -125,8 +90,8 @@ To build the addon from source:
125
90
  1. Clone the repository:
126
91
 
127
92
  ```bash
128
- git clone https://github.com/intrahouseio/ih-lib60870-node.git
129
- cd ih-lib60870-node
93
+ git clone https://github.com/intrahouseio/ih-lib61850-node.git
94
+ cd ih-lib61850-node
130
95
  ```
131
96
 
132
97
  2. Install dependencies:
@@ -162,10 +127,10 @@ Contributions are welcome! To contribute:
162
127
 
163
128
  ## 📜 License
164
129
 
165
- This project is licensed under the [MIT License](LICENSE).
130
+ This project is licensed under the [MIT License](https://github.com/intrahouseio/ih-lib61850-node/blob/main/LICENSE).
166
131
 
167
132
  ---
168
133
 
169
134
  ## 💬 Support
170
135
 
171
- For issues, questions, or feature requests, please open an issue on the [GitHub repository](https://github.com/intrahouseio/ih-lib60870-node/issues).
136
+ For issues, questions, or feature requests, please open an issue on the [GitHub repository](https://github.com/intrahouseio/ih-lib61850-node/issues).