11:21, EET
July 27, 2021
Hi,
We are reading values from OPCUA server with prosys using the below onDataChange method:
onDataChange(MonitoredDataItem monitoredDataItem, DataValue prevValue, DataValue dataValue)
But we are seeing different status for monitoredDataItem and dataValue.
i.e. Ex:
monitoredDataItem.getErrorCode() – GOOD (0x00000000) “The operation succeeded.”
Whereas dataValue.getStatusCode().getValue() – 2147483648
The above code refers to Bad status, as per OPCUA error codes.
Can you please explain the difference between them?
Why we have different status for these for same node?
And which one we should consider for specifying the status for the read. And persist in our system?
Thank you!
11:59, EET
Moderators
February 11, 2020
Hello,
The StatusCode returned by the getErrorCode method of MonitoredItem class refers to the StatusCode returned by the Server when the MonitoredItem was created. Typically this StatusCode is good, but if creating the MonitoredItem fails, e.g. because the NodeId the MonitoredItem is being created for is not recognized by the Server, the ErrorCode will be bad.
The StatusCode of the DataValue in onDataChange method of MonitoredDataItemListener interface is the StatusCode of the Value reported by the MonitoredItem. Even if creating the MonitoredItem succeeds and getErrorCode returns a good StatusCode, the DataValue in onDataChange could have a bad StatusCode, e.g. when the Value of the Node has not been initialized yet and the StatusCode of the DataValue is set to Bad_WaitingForInitialData.
The StatusCode in the DataValue is the StatusCode you’re interested in when processing Values of the Node. The StatusCode returned by the getErrorCode method is only needed for checking whether or not the MonitoredItem was created successfully and it has nothing to do with the Value of the Node.
16:33, EET
July 27, 2021
Thanks for the clear explanation!
Further, I want to understand on below things.
1. If the dataValue status code is bad, do we always have the value as null object?
i.e. in above case I received null for ‘dataValue.getValue()’.
2. Is there a way, we can have more details, what happened with the subscription etc, than just status code?
Ex: In my scenario, when I check values with prosys browser, I see it. But I started receiving null values with status code -2147483648. This is for some nodes.
And I do not have more information on what happened or how to resolve this.
3. Do you know when the status code -2147483648, happens in Prosys ? I see it form multiple nodes intermittently..
Thank you!
8:26, EET
Moderators
February 11, 2020
Hello,
1. The OPC UA Specification states the following for value field of a DataValue: “If the StatusCode indicates an error then the value is to be ignored and the Server shall set it to null” (https://reference.opcfoundation.org/Core/Part4/v105/docs/7.11). Therefore, you should ignore the value when the StatusCode is Bad.
2. You can use SubscriptionAliveListener and SubscriptionNotificationListener to monitor the Subscription in more detail. But if you start receiving null Values from the Server, it would imply that the Subscription is still alive and something has happened to the Nodes corresponding to its MonitoredItems. If you can read the Values of those Nodes with Browser after receiving null Values via MonitoredItems, this does seem like an error in the Server and you should contact its manufacturer for advice. Has the Server been developed with Prosys OPC UA SDK for Java?
3. StatusCodes are defined as 32-bit unsigned integers (https://reference.opcfoundation.org/Core/Part4/v105/docs/7.39). Your number, -2147483648, is the minimum value of signed int32, so it would be 0x80000000 in hexadecimal form and that would corresponds to the generic Bad StatusCode (https://github.com/OPCFoundation/UA-Nodeset/blob/latest/Schema/StatusCode.csv).
Typically Servers would use some other StatusCode that is more specific to the error. Which Server are you connecting your Client to? Has it been developed with Prosys OPC UA SDK for Java?
In general, StatusCodes are referred to by their names, not by their exact numerical values. When you have a StatusCode object, you would typically use the getName method to get the name of the StatusCode. Using toString would also convert the StatusCode into understandable format.
16:07, EET
July 27, 2021
16:21, EET
July 27, 2021
8:14, EET
Moderators
February 11, 2020
Hello,
If the MonitoredItems are reporting StatusCode Bad, then that is the code sent by the Kepware Server. You will need to investigate the Server to understand why it does that for no apparent reason if reading the Nodes directly is still working.
While troubleshooting the Kepware Server itself is outside the scope of support provided on this forum, we would recommend using Wireshark to capture traffic between the applications and sending the logs to uajava-support@prosysopc.com so that we can verify the problem. See https://www.prosysopc.com/blog/opc-ua-wireshark/ for instructions on how to capture OPC UA communication with Wireshark. If you’re running the applications on the same host, remember to select “Support loopback traffic” option when installing Wireshark.
MonitoredDataItems have MonitoredDataItemListener. Its onChange method can be used to check the StatusCode in the reported DataValue. The OPC UA Specification defines that StatusCode Bad_NodeIdUnknown should be reported if the Node is removed from the Server’s AddressSpace, but other StatusCodes do not have any “special” meaning when used in DataValues reported via MonitoredItems.
In general, we would recommend you to report this problem to the support of the Kepware Server. It is very unusual that a MonitoredItem would stop reporting Values normally while reading the Value directly from the Node is working.
Most Users Ever Online: 1919
Currently Online:
21 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 730
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1529
Posts: 6471
Newest Members:
inilarythikibia, rickykennion, PromotionToold, HypromeImpupe, toneylapham544, rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0
Administrators: admin: 1