Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Doubts about subscription

More
17 Oct 2019 06:56 #7833 by Alberto_OVT
Thank you! Sorry for my late response, you have helped me a lot with your answer, now I understand better the working philosophy of opc ua.

Thank you,
Best regards

Please Log in or Create an account to join the conversation.

More
05 Oct 2019 09:31 #7803 by support
Replied by support on topic Doubts about subscription
Hello,

I understand the first and second half of your post separately, but I do not know how they relate. So, I will answer them as they are, and maybe something comes out of it.

1. How to identify the "source" of DataChangeNotification. There are many ways to do it, or their combinations:
a) Each event notification carries a copy of the arguments that were used to make the subscription, including the node descriptor. Example: opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...es%20for%20data%20changes.html . You can see theat in the event handler, e.Arguments.NodeDescriptor is printed out, allowing to distinguish the sources. Depending on what you have used to subscribe to the node, there is a valid NodeId, or BrowsePath (or bnoth) inside the node descriptor.
b) There are overloads of the SubscribeXXXX that allow you to pass in an arbitrary State object, and this object is then available (inside the e.Arguments again) to you in the event notifications.
c) You can use callbacks instead of event handlers, and use a different callback for different items. Example: opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...back%20using%20a%20lambda.html .

If you need the BrowseName or DisplayName (or any other) attribute of the node, you can read it. Example of reading specific attributes: opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...%20of%20a%20single%20node.html . But, it would not be a good idea to do so inside the DataChangeNotification event handler. If you really need it, read these attributes before you make the subscription, because they do not change. Also note that you have mentioned the BrowsePath attribute, but there is no such attribute in OPC UA. This is a principal thing - a node cannot have a (single) BrowsePath associated with it, because there can be many (in fact, sometime infinite number of) browse paths that lead to the same node. The browse path is something that *you* need to construct in your code first .

2. The error is telling you that the namespace you have used to identify the node (nsu=http://statusenterprise.com/StatusServer ) is incorrect - the server does not know such namespace. Check the spelling - and check that you understand the actual concept:
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...tml#OPC%20UA%20Node%20IDs.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...indices%20in%20Node%20Ids.html

You took the NamespaceUriString from item.NodeAddress , but I do not know what that is. Besides, it looks weird that you would take namespace URI from somewhere, but still kept the namespaceindex (ns=3) from elsewhere. What is it that you are trying to achieve here?

Best regards

Please Log in or Create an account to join the conversation.

More
04 Oct 2019 16:39 #7802 by Alberto_OVT
Hello, I have some question about subscriptions.

How can I get information (apart from value, timestamp and codestatus) about the current node when the event client_DataChangeNotification is fired? For example I'm interesting in the DisplayName or BrowsePath attribute, because I need to identify the signal that has changed in the opc server.
static void client_DataChangeNotification(object sender, EasyUADataChangeNotificationEventArgs e)
        {
            [b] //How get information about the node that has changed his value to identify it?[/b]
 
            // Display value
            if (e.Succeeded)
                Console.WriteLine("Value: {0}", e.AttributeData.Value);
            else
                Console.WriteLine("*** Failure: {0}", e.ErrorMessageBrief);
        }

I have tried the next but give me this error when the client_DataChangeNotification event is fired:

Failure: The OPC-UA node descriptor specifies an unknown namespace URI "nsu=http://statusenterprise.com/StatusServer;ns=3;s=364E835304634E1DA244993FE2BC794A". This URI is not among the 5 namespace(s) provided by the server on endpoint URL "opc.tcp://DESKTOP-095TDGS:62542/StatusEnterprise".
                                UANodeId nodeID = new UANodeId();
                                nodeID.NamespaceUriString = item.NodeAddress;
                                nodeID.Identifier =   "RandomTagTest";
 
                                UANodeDescriptor nodeDescriptor = new UANodeDescriptor(nodeID);
 
 
                                handle2 = UAclient.SubscribeDataChange(endpointDescriptorForSubscribing, nodeDescriptor, 2000);



Thank you,
Kind regards

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.059 seconds