Hi,
I’m developing a new device module following the “opc-ua-device” example in the SDK 8.3 library that communicates with one of my machines through Ethernet.
Since my device accepts “Browse” function, I create the tag tree and generate all nodes during the module’s startup and then, using the Runnable class, I update all the tags values using a “Read” function. Everything works fine, however the polling time to update all tags is quite high (20~25 seconds).
That is due to the for-loop implemented in the Runnable function, which is basically the same approach as the example. The loop takes too long to read and receive the response from the machine for every tag, which makes the overall polling time too high.
@Override
public void run() {
for (Map.Entry<String, Variant> entry : trackedValues.entrySet()) {
String itemPath = entry.getKey();
Object o = readNode(itemPath);
trackedValues.put(itemPath, new Variant(o));
}
}
My first idea was to create a specific thread for every tag, so they could run in an independent way. However, I’m concerned on what would happen to the system if I had multiple devices connected, increasing dramatically the number of tags.
I wonder if anyone would have a suggestion in how to implement the Runnable function, so I could read all the tags in “real time”.