baggio2008 Posted January 6 Report Posted January 6 Hello every one and happy new year to all. I have a question about OPC UA. Is it possible to register a variable using the identifier (Varaible Name) and get the corresponding node ID of that Identifier. I want to register a list of Variable in the Server for monitoring purpose. With the external tool UaExpert it is possible to manually register a defined Variable and get the Node ID. But how can i progammatically do it using OPC UA Toolkit. Quote
Rolf Kalbermatter Posted January 7 Report Posted January 7 (edited) You will have to provide some example. For string named nodes, the NodeID normally simply is "ns={x};s={YourNodeName}" 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). The only thing you need to somehow know is what namespace index your variable is in and then you can easily construct a nodeID from a variable name yourself. If you want to do it programmatically you would have to enumerate the namespace of the server with the Browse functionality and search for your specific variable name, but note that that may not always lead to a correct result. It is very possible that a server has multiple variables with the same name but under different namespaces. So programmatic resolution may end up giving you the wrong NodeID, as it can not know which it should use if it only has the name to go by. Edited January 7 by Rolf Kalbermatter Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.