@amigo9090/ih-libiec61850-node 1.0.41 → 1.0.42
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/builds/linux_arm/addon_iec61850.node +0 -0
- package/builds/linux_arm64/addon_iec61850.node +0 -0
- package/builds/linux_x64/addon_iec61850.node +0 -0
- package/builds/macos_arm64/addon_iec61850.node +0 -0
- package/builds/macos_x64/addon_iec61850.node +0 -0
- package/builds/windows_x64/addon_iec61850.node +0 -0
- package/examples/index_iec61850_client2.js +62 -13
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -118,7 +118,7 @@ async function handleConnectionOpened() {
|
|
|
118
118
|
console.log(` Значений: ${res.count}, Удаляемые: ${res.isDeletable}`);
|
|
119
119
|
|
|
120
120
|
// Функция для рекурсивного вывода вложенных структур
|
|
121
|
-
const printValue = (value, indent = ' ') => {
|
|
121
|
+
/*const printValue = (value, indent = ' ') => {
|
|
122
122
|
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
123
123
|
Object.entries(value).forEach(([key, val]) => {
|
|
124
124
|
if (val && typeof val === 'object' && !Array.isArray(val)) {
|
|
@@ -144,10 +144,59 @@ async function handleConnectionOpened() {
|
|
|
144
144
|
Object.entries(res.values).forEach(([ref, value]) => {
|
|
145
145
|
console.log(` ${ref}:`);
|
|
146
146
|
printValue(value, ' ');
|
|
147
|
+
});*/
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
// Функция для рекурсивного вывода с полным отображением всех элементов
|
|
151
|
+
const printModel = (model, indent = '') => {
|
|
152
|
+
if (Array.isArray(model)) {
|
|
153
|
+
model.forEach((item, index) => {
|
|
154
|
+
console.log(`${indent}[${index}]:`);
|
|
155
|
+
printModel(item, indent + ' ');
|
|
156
|
+
});
|
|
157
|
+
} else if (model && typeof model === 'object') {
|
|
158
|
+
Object.entries(model).forEach(([key, value]) => {
|
|
159
|
+
if (key === 'dataObjects' && Array.isArray(value)) {
|
|
160
|
+
console.log(`${indent}${key}: [`);
|
|
161
|
+
value.forEach((doObj, idx) => {
|
|
162
|
+
console.log(`${indent} [${idx}]:`);
|
|
163
|
+
printModel(doObj, indent + ' ');
|
|
164
|
+
});
|
|
165
|
+
console.log(`${indent}]`);
|
|
166
|
+
} else if (key === 'attributes' && typeof value === 'object') {
|
|
167
|
+
console.log(`${indent}${key}: {`);
|
|
168
|
+
printModel(value, indent + ' ');
|
|
169
|
+
console.log(`${indent}}`);
|
|
170
|
+
} else if (Array.isArray(value)) {
|
|
171
|
+
console.log(`${indent}${key}: [`);
|
|
172
|
+
value.forEach((item, idx) => {
|
|
173
|
+
console.log(`${indent} [${idx}]: ${item}`);
|
|
174
|
+
});
|
|
175
|
+
console.log(`${indent}]`);
|
|
176
|
+
} else if (typeof value === 'object') {
|
|
177
|
+
console.log(`${indent}${key}: {`);
|
|
178
|
+
printModel(value, indent + ' ');
|
|
179
|
+
console.log(`${indent}}`);
|
|
180
|
+
} else {
|
|
181
|
+
console.log(`${indent}${key}: ${value}`);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
} else {
|
|
185
|
+
console.log(`${indent}${model}`);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
console.log('\n=== Полная модель устройства ===');
|
|
190
|
+
printModel(dataModel);
|
|
191
|
+
console.log('=== Конец модели устройства ===\n');
|
|
192
|
+
|
|
193
|
+
// Также можно сохранить модель в файл для анализа
|
|
194
|
+
//const fs = require('fs');
|
|
195
|
+
//fs.writeFileSync('device_model.json', JSON.stringify(dataModel, null, 2));
|
|
196
|
+
//console.log('Модель устройства сохранена в device_model.json');
|
|
147
197
|
});
|
|
148
|
-
});
|
|
149
198
|
|
|
150
|
-
|
|
199
|
+
console.log('Reading data...');
|
|
151
200
|
const dataRefs = [
|
|
152
201
|
'WAGO61850ServerDevice/XCBR1.Pos[ST]',
|
|
153
202
|
'WAGO61850ServerDevice/GGIO1.Ind1.stVal',
|
|
@@ -159,26 +208,26 @@ async function handleConnectionOpened() {
|
|
|
159
208
|
const rcbRef2 = 'WAGO61850ServerDevice/LLN0.RP.ReportBlock0201';
|
|
160
209
|
const dataSetRef2 = 'WAGO61850ServerDevice/LLN0.DataSet02';
|
|
161
210
|
console.log(`Enabling reporting for ${rcbRef2} with dataset ${dataSetRef2}`);
|
|
162
|
-
await client.enableReporting(rcbRef2, dataSetRef2)
|
|
211
|
+
await client.enableReporting(rcbRef2, dataSetRef2);
|
|
163
212
|
|
|
164
|
-
console.log('Reading data...');
|
|
213
|
+
/*console.log('Reading data...');
|
|
165
214
|
const dataRefs = [
|
|
166
215
|
'A01LD0/Q1_XCBR1.Pos[ST]',
|
|
167
216
|
'A01LD0/In_GGIO1.Ind1',
|
|
168
217
|
'A01LD0/CALH1.GrAlm.stVal'
|
|
169
218
|
];
|
|
170
219
|
const readRefResult = await client.readData(dataRefs);
|
|
171
|
-
console.log("readRefResult " + util.inspect(readRefResult, { depth: null }))
|
|
220
|
+
console.log("readRefResult " + util.inspect(readRefResult, { depth: null }));*/
|
|
172
221
|
|
|
173
222
|
/* const rcbRef = 'A01LD0/LLN0.RP.repTI1';
|
|
174
223
|
const dataSetRef = 'A01LD0/LLN0.TI_ASU';
|
|
175
224
|
console.log(`Enabling reporting for ${rcbRef} with dataset ${dataSetRef}`);
|
|
176
225
|
await client.enableReporting(rcbRef, dataSetRef);*/
|
|
177
226
|
|
|
178
|
-
const rcbRef2 = 'A01LD0/LLN0.BR.repTS1';
|
|
227
|
+
/*const rcbRef2 = 'A01LD0/LLN0.BR.repTS1';
|
|
179
228
|
const dataSetRef2 = 'A01LD0/LLN0.TS_ASU';
|
|
180
229
|
console.log(`Enabling reporting for ${rcbRef2} with dataset ${dataSetRef2}`);
|
|
181
|
-
await client.enableReporting(rcbRef2, dataSetRef2)
|
|
230
|
+
await client.enableReporting(rcbRef2, dataSetRef2);*/
|
|
182
231
|
|
|
183
232
|
} catch (err) {
|
|
184
233
|
console.error('Error in handleConnectionOpened:', err.message);
|
|
@@ -189,7 +238,7 @@ async function main() {
|
|
|
189
238
|
try {
|
|
190
239
|
console.log('Starting client...');
|
|
191
240
|
await client.connect({
|
|
192
|
-
ip: '192.168.0.
|
|
241
|
+
ip: '192.168.0.106',
|
|
193
242
|
port: 102,
|
|
194
243
|
clientID: 'mms_client1',
|
|
195
244
|
reconnectDelay: 2,
|
|
@@ -201,13 +250,13 @@ async function main() {
|
|
|
201
250
|
console.log('Waiting for data and reports...');
|
|
202
251
|
await sleep(30000);
|
|
203
252
|
|
|
204
|
-
const rcbRef = 'A01LD0/LLN0.BR.repTS1';
|
|
253
|
+
/*const rcbRef = 'A01LD0/LLN0.BR.repTS1';
|
|
205
254
|
console.log(`Disabling reporting for ${rcbRef}`);
|
|
206
|
-
await client.disableReporting(rcbRef)
|
|
255
|
+
await client.disableReporting(rcbRef);*/
|
|
207
256
|
|
|
208
|
-
|
|
257
|
+
const rcbRef2 = 'WAGO61850ServerDevice/LLN0.RP.ReportBlock0201';
|
|
209
258
|
console.log(`Disabling reporting for ${rcbRef2}`);
|
|
210
|
-
await client.disableReporting(rcbRef2)
|
|
259
|
+
await client.disableReporting(rcbRef2);
|
|
211
260
|
|
|
212
261
|
console.log('Client status:', client.getStatus());
|
|
213
262
|
console.log('Closing client...');
|