OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Problem with monitoring multiple OPC UA nodes

  • Thread starter Thread starter Abdelhak Sidi Ali Mebarek
  • Start date Start date
A

Abdelhak Sidi Ali Mebarek

Guest
Current behavior

In a client, when monitoring multiple nodes using a forEach loop, only two nodes get monitored on version 2.30.0 and only one in 2.72.2 while the array that generates the loop contains 5 items.

Behaviour in 2.30.0

image


Bahaviour in 2.72.2

image


UA Expert screenshot for reference ua_expert screenshot

Expected behavior

The expected behavior is that all the item nodes get processed.

Code source for the reproduction of the problem


Code:
const idsToMonitor = ["ns=4;i=16", "ns=4;i=17", "ns=4;i=11", "ns=4;i=12", "ns=4;i=18"]
const monitoringParamaters = {
        samplingInterval: 100,
        discardOldest: true,
        queueSize: 10,
    };
    idsToMonitor.forEach((nodeId) => {
        opc_subscription.monitor({
            nodeId: resolveNodeId(nodeId),
            attributeId: AttributeIds.Value,
        },
        monitoringParamaters,
        TimestampsToReturn.Both,
        (err, monitoredItem) => {
            monitoredItem.on("changed", function (dataValue) {
            var Node = {nodeId: nodeId, nodeName: "111" , nodeValue: dataValue.value.value , nodeTimestamp: dataValue.sourceTimestamp.toISOString()};
            console.log(JSON.stringify(Node));
        });
    });
});

Please tell us about your environment:


  • [X] my request is related to node-opcua acting as a OPCUA CLIENT


  • [X] I have installed node-opcua as a package ( using npm install )


  • OS version: Windows 10
  • Node: node --version = 16.16.0

<p><strong>Current behavior</strong></p>

<p>In a client, when monitoring multiple nodes using a <code>forEach</code> loop, only two nodes get monitored on version 2.30.0 and only one in 2.72.2 while the array that generates the loop contains 5 items.</p>
<p>Behaviour in 2.30.0</p>
<p><img src="https://user-images.githubuserconte...7062-483ebce2-fda5-43e2-8dde-6367e800c726.png" alt="image" /></p>
<p>Bahaviour in 2.72.2</p>
<p><img src="https://user-images.githubuserconte...6891-c9b3cc20-3245-4d4b-9f6a-65c232e949ed.png" alt="image" /></p>
<p>UA Expert screenshot for reference
<a href="https://i.sstatic.net/7xTll.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7xTll.png" alt="ua_expert screenshot" /></a></p>
<p><strong>Expected behavior</strong></p>

<p>The expected behavior is that all the item nodes get processed.</p>
<p><strong>Code source for the reproduction of the problem</strong></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const idsToMonitor = ["ns=4;i=16", "ns=4;i=17", "ns=4;i=11", "ns=4;i=12", "ns=4;i=18"]
const monitoringParamaters = {
samplingInterval: 100,
discardOldest: true,
queueSize: 10,
};
idsToMonitor.forEach((nodeId) => {
opc_subscription.monitor({
nodeId: resolveNodeId(nodeId),
attributeId: AttributeIds.Value,
},
monitoringParamaters,
TimestampsToReturn.Both,
(err, monitoredItem) => {
monitoredItem.on("changed", function (dataValue) {
var Node = {nodeId: nodeId, nodeName: "111" , nodeValue: dataValue.value.value , nodeTimestamp: dataValue.sourceTimestamp.toISOString()};
console.log(JSON.stringify(Node));
});
});
});</code></pre>
</div>
</div>
</p>

<p><strong>Please tell us about your environment:</strong></p>

<ul>
<li><p>[X] my request is related to node-opcua acting as a OPCUA CLIENT</p>
</li>
<li><p>[X] I have installed node-opcua as a package ( using npm install )</p>
</li>
<li><p>OS version: Windows 10</p>
</li>
</ul>


<ul>
<li><strong>Node:</strong>
<code>node --version</code> = 16.16.0</li>
</ul>
 
Top