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.

Is this the correct way to retrieve nodeId when uaDataDialog1.MultiSelect = True

More
18 Nov 2020 15:41 #9173 by support
A quote form the next version of our documentation:

OPC UA node ID is *not*, by itself, a string. It is primarily a structure, containing the namespace (URI, index or both), and the identifier. OPC UA Node Id *has* a string representation, but the string representation is not the Node ID itself. The very same OPC UA node ID can be represented by multiple strings. You should not assume that two strings that appear different represent different node IDs. For example, "ns=1;s=SomeNode", and "ns=1;SomeNode" are strings that represent precisely the same node ID, because the "s=" prefix (for string identifiers) is optional. Or, "ns=0;s=Objects" may be the same as simply "s=Objects", because the default parsing context assumes the namespace index zero (when missing from the string).

There are methods available to parse strings into node IDs, and to format node IDs into strings.


To apply this to your case: When speaking strictly, "nsu=http://opcfoundation.org/ReferenceApplications ;ns=2;s=Tag" is *not* a node ID. It is a *string representation of a node Id*.

If your other software expects OPC UA node ID input as a string, you need to make sure that you format it in the way *they* expect it to look. They probably do not expect the namespace URI part in it, but that's up to you to resolve. The way to do it would be to extract individual properties from the UANodeId (UANodeDescriptor.NodeId), such as the .NamespaceIndex, .NodeIdType, and .Identifier, and put them together to form the proper string.

Regards

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

More
18 Nov 2020 15:33 #9172 by micham
The error is coming from our OPC client. Not from QuickOPC. QuickOPC is used only for browsing.

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

More
18 Nov 2020 15:27 #9171 by support
I am somewhat confused. Where does this error come from? That doesn't look like that it is from QuickOPC.

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

More
18 Nov 2020 15:25 #9170 by micham
Hi,

Thank you for your answer. The problem is that when I try to subscribe to the following nodeId - nsu=http://opcfoundation.org/ReferenceApplications ;ns=2;s=Tag1

I get this error:

2020-11-18 17:19:12.108 [OPC] ERROR, AddItem 'nsu=http://opcfoundation.org/ReferenceApplications ;ns=2;s=Tag1' fail, itemResult = C0040008

Any idea why?

Thank you.

Michael

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

More
18 Nov 2020 13:37 #9169 by support
Yes, it is the right way to do it.

And, there is no problem with the node id returned. It *does* represent what you want. Please read this:

- 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

The true namespace in the node ID is identified by its URI ("nsu="). Except for reserved namespace 0, your code should not specify or persist namespace index ("ns=") without an accompanying namespace URI, because namespaces indexes are just "aliases" for namespace URIs, and THE OPC UA SERVER CAN CHANGE THE NAMESPACE INDEX OF A NAMESPACE URI BETWEEN SESSIONS - but it must not change the namespace URI.

QuickOPC returns both the namespace URI and the index from the browsing, but when you pass such node ID back in, it will use the namespace URI and will not let itself be confused by the namespace index, which may change.

Best regards

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

More
18 Nov 2020 12:58 - 18 Nov 2020 13:31 #9168 by micham
Hi,

Is this the right way to retrieve the node IDs when using MultiSelect?
If (MyServer.Length > 0) Then  ' MyServer = opc.tcp://dev2017:62640/IntegrationObjects/ServerSimulator
            uaDataDialog1.EndpointDescriptor = MyServer
            uaDataDialog1.MultiSelect = True
            If uaDataDialog1.ShowDialog() = DialogResult.OK Then
                values = uaDataDialog1.NodeDescriptors  'NodeDescriptors
                For i = 0 To (values.Count - 1)
                    itemF = ListView2.FindItemWithText(values(i).NodeId.ToString) ' 
                    If (itemF Is Nothing) Then
                        itmX = ListView2.Items.Add(values(i).NodeId.ToString, 0)
...
The problem is that the nodeId that I get is "nsu=http://opcfoundation.org/ReferenceApplications ;ns=2;s=Tag4". As far as I understand it should be "ns=2;s=Tag4"


Thank you.

Michael
Last edit: 18 Nov 2020 13:31 by support. Reason: code formatting

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

Moderators: support
Time to create page: 0.053 seconds