@amigo9090/ih-libiec61850-node 1.0.58 → 1.0.59

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.
@@ -552,29 +552,26 @@ async function handleConnectionOpened2() {
552
552
  async function exploreModel() {
553
553
  try {
554
554
  console.log('\n=== 1. Получение корневых узлов ===');
555
- const rootNodes = await client.browseDataModel(); // теперь только name, reference, type
555
+ const rootNodes = await client.browseDataModel(); // массив логических узлов с dataSets и reports
556
556
 
557
557
  console.log('\nНайдено Logical Nodes:');
558
558
  for (const ln of rootNodes) {
559
559
  console.log(`\n${ln.name} (${ln.reference})`);
560
560
 
561
- // Получаем детальную информацию о логическом узле
562
- const lnDetails = await client.browseDataModel(ln.reference);
563
-
564
- // Выводим DataSets
565
- if (lnDetails.dataSets && lnDetails.dataSets.length > 0) {
566
- console.log(` Datasets (${lnDetails.dataSets.length}):`);
567
- lnDetails.dataSets.forEach((ds, idx) => {
561
+ // Выводим DataSets (уже есть в ln)
562
+ if (ln.dataSets && ln.dataSets.length > 0) {
563
+ console.log(` Datasets (${ln.dataSets.length}):`);
564
+ ln.dataSets.forEach((ds, idx) => {
568
565
  console.log(` ${idx + 1}. ${ds.name}: ${ds.reference}`);
569
566
  });
570
567
  } else {
571
568
  console.log(` Datasets: 0`);
572
569
  }
573
570
 
574
- // Выводим Reports
575
- if (lnDetails.reports && lnDetails.reports.length > 0) {
576
- console.log(` Reports (${lnDetails.reports.length}):`);
577
- lnDetails.reports.forEach((report, idx) => {
571
+ // Выводим Reports (уже есть в ln)
572
+ if (ln.reports && ln.reports.length > 0) {
573
+ console.log(` Reports (${ln.reports.length}):`);
574
+ ln.reports.forEach((report, idx) => {
578
575
  const typeDesc = report.type === 'RP' ? 'Unbuffered' : 'Buffered';
579
576
  console.log(` ${idx + 1}. ${report.name} (${report.type} - ${typeDesc}): ${report.reference}`);
580
577
  });
@@ -587,27 +584,31 @@ async function exploreModel() {
587
584
  const lln0 = rootNodes.find(ln => ln.name === 'LLN0');
588
585
  if (lln0) {
589
586
  console.log('\n=== 2. Исследуем LLN0 ===');
590
- const lln0Details = await client.browseDataModel(lln0.reference);
591
-
592
- console.log(`\nDataObjects в ${lln0Details.reference}: ${lln0Details.dataObjectsCount}`);
593
- console.log(`DataSets в ${lln0Details.reference}: ${lln0Details.dataSetsCount}`);
594
587
 
595
- // Показываем ВСЕ DataObjects
596
- console.log('\nВсе DataObjects:');
597
- lln0Details.dataObjects.forEach((doObj, index) => {
598
- console.log(`${index + 1}. ${doObj.name} (${doObj.cdc || 'Unknown'}) - ${doObj.reference}`);
588
+ // Получаем массив DataObject для LLN0
589
+ const dataObjects = await client.browseDataModel(lln0.reference);
590
+ console.log(`\nDataObjects в ${lln0.reference}: ${dataObjects.length}`);
591
+ dataObjects.forEach((doObj, index) => {
592
+ // Выводим полный объект для наглядности
593
+ console.log(`${index + 1}.`, doObj);
594
+ });
595
+
596
+ // Получаем атрибуты конкретного DataObject
597
+ console.log('\n=== 2.1 Атрибуты WAGO61850ServerDevice/XCBR1.Pos ===');
598
+ const attributes = await client.browseDataModel("WAGO61850ServerDevice/XCBR1.Pos");
599
+ attributes.forEach(attr => {
600
+ console.log(attr); // вывод в виде объекта
599
601
  });
600
602
 
601
- // Выбираем первый DataSet для кэширования
602
- // Выбираем первый DataSet для кэширования
603
- if (lln0Details.dataSets.length > 0) {
604
- const firstDataSet = lln0Details.dataSets[0];
603
+ // Выбираем первый DataSet из LLN0 для кэширования
604
+ if (lln0.dataSets && lln0.dataSets.length > 0) {
605
+ const firstDataSet = lln0.dataSets[0];
605
606
  console.log(`\n=== 3. Кэшируем DataSet ${firstDataSet.reference} ===`);
606
607
 
607
- // ПРАВИЛЬНО: вызываем readDataSetModel для заполнения кэша структур
608
+ // Заполняем кэш структур через readDataSetModel
608
609
  await client.readDataSetModel([firstDataSet.reference]);
609
610
 
610
- // Теперь можно быстро читать этот DataSet
611
+ // Быстрое чтение DataSet
611
612
  console.log('\n=== 4. Быстрое чтение DataSet ===');
612
613
  const pollResults = await client.pollDataSetValues([firstDataSet.reference]);
613
614
 
@@ -618,7 +619,6 @@ async function exploreModel() {
618
619
  console.log(` Read time: ${result.readTimeMicros} µs`);
619
620
  console.log(` Process time: ${result.processTimeMicros} µs`);
620
621
 
621
- // Выводим ВСЕ значения
622
622
  console.log('\n Значения:');
623
623
  Object.entries(result.values).forEach(([ref, value], index) => {
624
624
  console.log(` [${index + 1}] ${ref}:`, util.inspect(value, {
@@ -633,8 +633,8 @@ async function exploreModel() {
633
633
  });
634
634
  }
635
635
 
636
- // Выбираем первый отчет для кэширования
637
- if (lln0.reports.length > 0) {
636
+ // Выбираем первый отчет для подписки
637
+ if (lln0.reports && lln0.reports.length > 0) {
638
638
  const firstReport = lln0.reports.find(r => r.reference.includes('ReportBlock0101'));
639
639
  if (firstReport) {
640
640
  console.log(`\n=== 5. Кэшируем отчет ${firstReport.reference} ===`);
@@ -650,14 +650,13 @@ async function exploreModel() {
650
650
  console.log(` Buffer Time: ${reportDetails.bufTm} ms`);
651
651
  console.log(` GI: ${reportDetails.gi}`);
652
652
 
653
- // Подписываемся на отчет
654
653
  console.log(`\n=== 6. Подписываемся на отчет ===`);
655
654
  await client.enableReporting(firstReport.reference, reportDetails.datasetRef);
656
655
  }
657
656
  }
658
657
  }
659
658
 
660
- // Пример чтения одиночного значения
659
+ // Пример чтения одиночных значений
661
660
  console.log('\n=== 7. Чтение одиночных значений ===');
662
661
  const singleValues = await client.readData([
663
662
  'WAGO61850ServerDevice/XCBR1.Pos[ST]',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amigo9090/ih-libiec61850-node",
3
- "version": "1.0.58",
3
+ "version": "1.0.59",
4
4
  "description": "Node.js addon for IEC 61850 client (MMS, GOOSE) using libiec61850",
5
5
  "main": "index.js",
6
6
  "keywords": [