Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
NodeId questions
March 25, 2013
19:50, EET
Avatar
TimK
Member
Members
Forum Posts: 41
Member Since:
June 27, 2012
sp_UserOfflineSmall Offline

in my application, I’m going to have multiple custom nodemanagers that will come and go over time. Right now, each one gets a namespaceIndex, and client can communicate with them. What happens if I have three nodemanagers with namespace indices of 2, 3, and 4, and then the middle one goes away? When the device restarts, the nodemanager that was third will be second and get index 3, and clients that were talking to 4 won’t be able to find their data anymore, correct? What is the best way to handle this? I would really prefer to use a name instead of an index. Is there a way to do this?

In the BigNodeManager sample, the code seems to convert NodeId to ExpandedNodeId often. What is the advantage of doing this? Is there somewhere in the code that a NodeId couldn’t be used instead? The two versions of getDataItem seem to use them both in exactly the same way
Why would I want to use an expanded node id instead of a regular one?

March 26, 2013
11:36, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, the namespaceIndex may change. So, if you store nodeIds on the client side, you should store the namespaceUri, instead of namespaceIndex. You can map between these, using the NamespaceTable of the server, available from UaClient.getNamespaceTable().

ExpandedNodeIds can use the namespaceUri instead of namespaceIndex. They also enable referring to nodes that point to a node on another server. Therefore some service methods in the UA interface are defined to use ExpandedNodeId instead of NodeId. That’s also why you see them both used in the BigNodeManager example as well.

January 27, 2014
6:20, EET
Avatar
cto
Member
Members
Forum Posts: 15
Member Since:
March 22, 2013
sp_UserOfflineSmall Offline

Jouni Aro said

Yes, the namespaceIndex may change. So, if you store nodeIds on the client side, you should store the namespaceUri, instead of namespaceIndex. You can map between these, using the NamespaceTable of the server, available from UaClient.getNamespaceTable().

ExpandedNodeIds can use the namespaceUri instead of namespaceIndex. They also enable referring to nodes that point to a node on another server. Therefore some service methods in the UA interface are defined to use ExpandedNodeId instead of NodeId. That’s also why you see them both used in the BigNodeManager example as well.

Hi ,
I tried , but I am getting the same uri for all the node ids. For example if node id is ns=3;s=DataItem_0998 , index is 3 then I am getting the uri as http://www.prosysopc.com/OPCUA…..dressSpace . But we need an unique id . Can I accomplish this with uri concept ? Please suggest if I am doing anything wrong.

Thanks in advance.

January 27, 2014
10:33, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

cto said

Hi ,
I tried , but I am getting the same uri for all the node ids. For example if node id is ns=3;s=DataItem_0998 , index is 3 then I am getting the uri as http://www.prosysopc.com/OPCUA…..dressSpace . But we need an unique id . Can I accomplish this with uri concept ? Please suggest if I am doing anything wrong.

Sorry, but I did not quite understand what you are trying.

The NodeId is composed of the Namespace and an ID. The namespace is usually defined with NamespaceIndex, e.g. 3, which refers to the index of the respective NamespaceUri in the NamespaceArray of the server. The index may change when the server is restarted, so it is not always safe to store NodeIds in the client using the indexes. Instead, you would store the NamespaceUri, e.g. http://www.prosysopc.com/OPCUA…..dressSpace.

The combination of the Namespace and the ID is always unique for the node.

January 27, 2014
11:41, EET
Avatar
cto
Member
Members
Forum Posts: 15
Member Since:
March 22, 2013
sp_UserOfflineSmall Offline

Jouni Aro said

cto said

Hi ,
I tried , but I am getting the same uri for all the node ids. For example if node id is ns=3;s=DataItem_0998 , index is 3 then I am getting the uri as http://www.prosysopc.com/OPCUA…..dressSpace . But we need an unique id . Can I accomplish this with uri concept ? Please suggest if I am doing anything wrong.

Sorry, but I did not quite understand what you are trying.

The NodeId is composed of the Namespace and an ID. The namespace is usually defined with NamespaceIndex, e.g. 3, which refers to the index of the respective NamespaceUri in the NamespaceArray of the server. The index may change when the server is restarted, so it is not always safe to store NodeIds in the client using the indexes. Instead, you would store the NamespaceUri, e.g. http://www.prosysopc.com/OPCUA…..dressSpace.

The combination of the Namespace and the ID is always unique for the node.

Thanks got my answer . Now suppose I have the following output .

node id –>> ns=3;s=DataItem_0998 :: name space index —>> 3 :: name space uri —>> http://www.prosysopc.com/OPCUA…..dressSpace

In node id I get that node id = ns=3;s=DataItem_0998 where namespace index is 3 . My concern is that in the node id does the s=DataItem_0998 part is fixed ?

January 27, 2014
14:47, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes the ID-part is always fixed.

January 28, 2014
6:10, EET
Avatar
cto
Member
Members
Forum Posts: 15
Member Since:
March 22, 2013
sp_UserOfflineSmall Offline

Jouni Aro said

Yes the ID-part is always fixed.

Is it possible that there in the same address space with different name space uri , tag with same id exists ? That is say I have DataItem_0998 against one uri and DataItem_0998 against another in the same address space ? Also is there any provision to know that the OPC UA server has restarted ? If the server restarts when I again connect is there any sdk method to know the node id with input namespace uri and id or I have to browse again and get it ?

January 28, 2014
12:33, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, different name spaces may have the same IDs.

You can monitor the server status with UaClient.addServerStatusListener() to get notified of a server shutdown.

If you store the NamespaceUri and ID, you can use that later. You can use UaClient.getNamespaceTable() to convert the NamespaceUri to NamespaceIndex, which you need for NodeId.

Note that in normal circumstances, the namespaces of the server are not expected to change, but it is always possible.

January 29, 2014
6:18, EET
Avatar
cto
Member
Members
Forum Posts: 15
Member Since:
March 22, 2013
sp_UserOfflineSmall Offline

Jouni Aro said

Yes, different name spaces may have the same IDs.

You can monitor the server status with UaClient.addServerStatusListener() to get notified of a server shutdown.

If you store the NamespaceUri and ID, you can use that later. You can use UaClient.getNamespaceTable() to convert the NamespaceUri to NamespaceIndex, which you need for NodeId.

Note that in normal circumstances, the namespaces of the server are not expected to change, but it is always possible.

Thanks. Could you please tell me how the namespace uri is constructed ? Suppose in the address space I have a tag located in the following location .

data–>dataitems–>dataitem1

So is the uri like data.dataitems.dataitem1.I guess it is not like that.

January 29, 2014
8:41, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

No, there is no generic rule how the NodeID is constructed. You will need to find it out, by browsing or from the documentation of the server.

January 29, 2014
9:14, EET
Avatar
cto
Member
Members
Forum Posts: 15
Member Since:
March 22, 2013
sp_UserOfflineSmall Offline

Jouni Aro said

No, there is no generic rule how the NodeID is constructed. You will need to find it out, by browsing or from the documentation of the server.

Thanks , is there a way that I can get the data type information of the tag ? Also another query is there a way so that I browse once and list all the tags in an address space in one go , instead of browsing individually ?

January 29, 2014
11:59, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

cto said

Thanks , is there a way that I can get the data type information of the tag ?

You can read the DataType attribute. In the SDK, UaVariable.getDataType() and/or getDataTypeId().

Also another query is there a way so that I browse once and list all the tags in an address space in one go , instead of browsing individually ?

No there isn’t. Also when browsing you may get back to nodes that you have already browsed, so beware of infinite loops.

February 3, 2014
10:35, EET
Avatar
cto
Member
Members
Forum Posts: 15
Member Since:
March 22, 2013
sp_UserOfflineSmall Offline

Jouni Aro said

cto said

Thanks , is there a way that I can get the data type information of the tag ?

You can read the DataType attribute. In the SDK, UaVariable.getDataType() and/or getDataTypeId().

Also another query is there a way so that I browse once and list all the tags in an address space in one go , instead of browsing individually ?

No there isn’t. Also when browsing you may get back to nodes that you have already browsed, so beware of infinite loops.

Hi,

Data was continuously getting fetched from OPC UA server , but suddenly the following exception is thrown. Could please explain this one .

02/02/2014 18:25:37.366 INFO [Blocking-Work-Executor-2279] org.opcfoundation.ua.transport.tcp.io.SecureChannelTcp – 318: Error recovery failed, security token has expired
02/02/2014 18:25:37.366 INFO [Blocking-Work-Executor-2279] org.opcfoundation.ua.transport.tcp.io.SecureChannelTcp – 318 Closed
02/02/2014 18:25:37.366 INFO [Blocking-Work-Executor-2279] org.opcfoundation.ua.transport.tcp.io.SecureChannelTcp – -1: Error recovery = false

February 3, 2014
13:29, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Hi, it is better to use a New Topic for a new question. I moved your question and answer here

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online: sagarchau
11 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

ibrahim: 75

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 679

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6259

Newest Members:

sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer, DavidROunc, fen.pang@woodside.com, aytule

Moderators: Jouni Aro: 1009, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1