Reputation: 25
I created a client application that has a subscription to monitor several tags through the OPC UA server(c#). If the connection between the OPC server and the PLC is lost while the client is running, the client stops receiving information from the server and it is never notified that the plc is not reachable any more.
I am evaluating to implement a periodic reading operation for one tag through the OPC server to actually know if the plc connection is active or not, but if there is a native mechanism in OPC UA I would like to avoid it.
Is there a way (eg. an event) to notify the client that the connection with the plc is lost for the running subscription?
Upvotes: 0
Views: 824
Reputation: 1608
A compliant OPC UA server must send notification with one of the "Bad" status codes, when the connection to the target system is lost. This is the normal notification event, same channel as the "good" ones, it just carries a different DataValue that happens to have the StatusCode with corresponding bits set so that it indicates a problem.
So, you need to check the StatusCode in the incoming notifications. If you are already doing that, but the server truly sends nothing in case of communication loss, you need to complain to the server vendor, because such behavior isn't really acceptable for any serious server.
Note: There are ways to specify a data change "filter" when subscribing to monitored item, and you can tell whether you want to be notified e.g. when just the timestamp changes and not the value, etc. But no matter how the filter is set, changes in StatusCode are always sent. Therefore the problem cannot be in having incorrect filter set.
Upvotes: 2