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
Reading tags
January 6, 2016
14:05, EET
Avatar
pramanj
Member
Members
Forum Posts: 86
Member Since:
October 21, 2014
sp_UserOfflineSmall Offline

How to read group of tags?
Are Nodes ID’s unique in the whole OPCUA server?
How to specify the fully qualified tag path of a node?
Is it enough to specify the NodeID in the read method?
regards
PRAMANJ

January 7, 2016
9:27, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

“Are Nodes ID’s unique in the whole OPCUA server?”
NodeIds are unique in the server.

“Is it enough to specify the NodeID in the read method?”
The NodeId will specify the Node for which to read so yes. If you want to read the Value Attribute then UaClient.readValue(nodeId) is enouhg. If you want read other Attributes then you need to use UaClient.readAttribute. There are overloads which allows spefying max age and index range too.

“How to specify the fully qualified tag path of a node?”
Usually you know the NodeId of the node directly. If the server supports it, you can use TranslateBrowsePathsToNodeIds Service from UaClient.getAddressSpace().translateBrowsePathsToNodeIds, but I would say it is easier to use the NodeIds directly..

“How to read group of tags?”
For Value Attributes, e.g. by UaClient.readValues(NodeId[]). For other Attributes, construct ReadValueIds and pass them to UaClient.read

– Bjarne

January 7, 2016
12:04, EET
Avatar
pramanj
Member
Members
Forum Posts: 86
Member Since:
October 21, 2014
sp_UserOfflineSmall Offline

Thanks a lot Bjarne for your clear replies.
If I have a third party server then the tags are defined as a fully qualified path with its own syntax such as “ns=2;s=[default]New Tag1”; “ns=2;s=[default]New Tag2” etc. Will your client API’s for translating these paths to NodeIDs understand this syntax? Do all OCUA servers follow a standard convention for Tag paths?
regards
PRAMANJ

January 7, 2016
14:00, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

“ns=2;s=…” means it is a NodeId with NamespaceIndex 2, Identifier type is a String (the ‘s’), and the part after “s=” is the value part of the NodeId, i.e. it is not a path, just an id for a node. For example the “ns=2;s=[default]New Tag1” would be created as

new NodeId(2, "[default]New Tag1")

.

By path I tought you meant e.g. “(Root)/Objects/MyObjects/MyDevice/MyLevel” (The MyLevel sample node in the SampleConsoleServer). The Translate.. Service call uses BrowseNames (BrowseName is an attribute of a node, it also has a namespace index in addition to the string part), for visual usually the DisplayName attribute is used. Anyway the service is on the server side so it’s functionality depends on the server. There are not many cases where knowing the path is of any use if you know the NodeId directly (e.g. you have Browsed the address space).

If you don’t have them yet, I would suggest you download the specifications from https://opcfoundation.org/developer-tools/specifications-unified-architecture (you need to register, but otherwise it is free). The part 4 lists all the Service calls you can make to the server (note that some of them are optional so it depends on the server). It will also make understanding some parts of the SDK easier.

– Bjarne

January 7, 2016
17:34, EET
Avatar
pramanj
Member
Members
Forum Posts: 86
Member Since:
October 21, 2014
sp_UserOfflineSmall Offline

Thanks a lot Bjarne for the detailed explanation. I will download and read the specifications.
What is the meaning and need of namespace in a Node ID? How many name spaces can be there?
Is it a number or string?
I hope reading the specs will help.
regards
PRAMANJ
Smile

January 8, 2016
8:52, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Probably better to read from the spec, but essentially the same thing as in a programming language namespaces (or packages in java): to avoid naming conflicts.

The 0 namespace index is always the one defined by the specification, i.e. the standard namespace. 1 is for server itself (e.g. for some diagnostic nodes and such). After that it depends on the server. The NodeId data types is defined in the part 3 (section 8.2), there are 4 data types. Usually it is numeric or string (some diagnostic nodes use GUIDs). The namespace index is defined as UInt16 so there is theoretically 65535 possible namespaces in the server.

(some more explanation below, depending what you do this might not be that relevant for now)
I guess I should also mention that the namespace index points to the Objects/Server/NamespaceArray’s values. It contains the NamespaceURI for that namespace. See Part 3, section 8.2.2. The basic idea is that data transfer between client and the server uses the namespaceindex. Since it is a number it is shorter (smaller in binary) to transfer than e.g. a 20 character URI. Since the NodeIds are used a lot in the communication this makes it more efficient. In practice this means the client should check the NamespaceArray of the server to see which index matches which URI (because the order is not fixed beyond 0 and 1). UaClient fetches this information for you then it is connected, see UaClient.getNamespaceTable().

– Bjarne

January 8, 2016
14:05, EET
Avatar
pramanj
Member
Members
Forum Posts: 86
Member Since:
October 21, 2014
sp_UserOfflineSmall Offline

Dear Bjarne,
Thanks a lot for the detailed explanation. In short I will use the name space provided by the server for each tag that I am interested in. I will also ask the server supplier what namespaces it supports apart from 0 and 1 which are I guess reserved for system tags. Hopefully it will be only namespace 2 for rest of the address space.

I have one more question. If I have to read value attribute of a group of tags periodically requested from my client (pulled from server not pushed from server), then I guess I have to issue a periodic read request. But my worry is if have to pass the array of nodes to read value of in every read call, will it not be an avoidable overhead? If I can set a list of nodes of interest once for all on the server from the client, then client can keep issuing the read requests giving only the list name. Is there a service request that allows you to set a list once keep getting it value by a read request from client?

Of course there is a service available in server which allows client to subscribe to a list of nodes on changed value basis from server, but that will be a push from server. I want to pull values to client. How can I implement this mechanism?

Request your thoughts on this.
Regards
PRAMANJ

January 11, 2016
8:43, EET
Avatar
pramanj
Member
Members
Forum Posts: 86
Member Since:
October 21, 2014
sp_UserOfflineSmall Offline

pramanj said

Dear Bjarne,
Thanks a lot for the detailed explanation. In short I will use the name space provided by the server for each tag that I am interested in. I will also ask the server supplier what namespaces it supports apart from 0 and 1 which are I guess reserved for system tags. Hopefully it will be only namespace 2 for rest of the address space.

“I have one more question. If I have to read value attribute of a group of tags periodically requested from my client (pulled from server not pushed from server), then I guess I have to issue a periodic read request. But my worry is if have to pass the array of nodes to read value of in every read call, will it not be an avoidable overhead? If I can set a list of nodes of interest once for all on the server from the client, then client can keep issuing the read requests giving only the list name. Is there a service request that allows you to set a list once keep getting it value by a read request from client?”

Of course there is a service available in server which allows client to subscribe to a list of nodes on changed value basis from server, but that will be a push from server. I want to pull values to client. How can I implement this mechanism?

Request your thoughts on this.
Regards
PRAMANJ

Hi Bjarne,
I will appreciate your reply to my second question given in “…” abobe.
Regards
PRAMANJ

January 11, 2016
9:09, EET
Avatar
Heikki Tahvanainen
Moderator
Members

Moderators
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hello Pramanj,

The OPC UA subscription service is designed for this use case that you described and is ideally suited to this situation. However I understand that you have some requirements that prevent you from using subscriptions. What kind of reasons do you have for not using subscriptions in this case? If you must use the read service then there is unfortunately no other way than to pass the array of nodes to read in every read call.

Best regards,
Heikki

January 11, 2016
14:54, EET
Avatar
pramanj
Member
Members
Forum Posts: 86
Member Since:
October 21, 2014
sp_UserOfflineSmall Offline

Dear Heikki,
Thanks for the reply. OK then I can use Subscription in that case. However how do I ensure that the server doesn’t send data more often than I want (say once every 1 to 5 seconds, configurable)? I don’t know if the subscription sends changed values as soon as they are changed or there is a periodicty also definable? I guess the max scan time is specifiable for every node? Please correct me if I am wrong.
Best Regards
PRAMANJ.

January 11, 2016
15:39, EET
Avatar
Heikki Tahvanainen
Moderator
Members

Moderators
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Two most important parameters defining the data sampling are publish interval of subscriptions and sampling interval of monitored data items. See this blog post for more details: https://www.prosysopc.com/blog/opc-ua-sessions-subscriptions-and-timeouts/

Usual pattern would be to define one subscription and multiple monitored items. The publish interval can be set with Subscription’s setPublishingInterval method and sampling interval can be set with MonitoredDataItem’s setSamplingInterval method.

Hopefully this helps. Let us know if you have further questions.

Br,
Heikki

January 13, 2016
11:49, EET
Avatar
pramanj
Member
Members
Forum Posts: 86
Member Since:
October 21, 2014
sp_UserOfflineSmall Offline

Thanks Heikki for the valuable information. But I have a few questions:
1. What is the default value of KeepAliveCount? is it 0 meaning forever?
2. What is default value for LifeTimeCount ?
3. When a client subscribes to a list of node values, then where is the question of sending PublishRequests from client again and again from client? I thought the server will maintain a loop based on PublishInterval and SamplingInterval specified by client at the time of subscription? Or is it that client maintains the loop to issues the PublishRequests to server once a Subscription is created?
Please clarify.
Best Regards
PRAMANJ

January 13, 2016
14:13, EET
Avatar
Heikki Tahvanainen
Moderator
Members

Moderators
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hi Pramanj,

The default value for KeepAliveCount is 20 and actually KeepAliveCount value 0 does not mean forever. The default value for LifeTimeCount is 60. These default values are also mentioned in the javadoc of the Subscription class.

If I understood the part 3 correctly then your question was about subscription model and why clients send Publish Requests constantly. Client issues publish requests in regular time intervals as you stated. These publish requests are queued at the server and dequeued when server responds with publish response. These regularly sent publish requests offer among other things possibility for client to acknowledge received notification messages. They also provide a life ping mechanism from the client to the server. To conclude, sending notification messages is server-triggered but clients also send regular publish requests to the server.

Br,
Heikki

January 13, 2016
16:12, EET
Avatar
pramanj
Member
Members
Forum Posts: 86
Member Since:
October 21, 2014
sp_UserOfflineSmall Offline

Dear Heikki,
Thanks for the reply. Regarding point 3, I thought once client adds subscription to a list of items, the server generated events for Publish respones at specified periodicity. Looks like the client generates the PublishRequests at a specified periodicity internally once a subscription has been added. Atleast that’s what it appears from the sample console example in your SDK. In the example for client, I don’t see any Publish Requests being fenerated from the client any where.
Request some clarification.
regards
PRAMANJ

January 13, 2016
16:12, EET
Avatar
pramanj
Member
Members
Forum Posts: 86
Member Since:
October 21, 2014
sp_UserOfflineSmall Offline

Dear Heikki,
Thanks for the reply. Regarding point 3, I thought once client adds subscription to a list of items, the server generated events for Publish respones at specified periodicity. Looks like the client generates the PublishRequests at a specified periodicity internally once a subscription has been added. Atleast that’s what it appears from the sample console example in your SDK. In the example for client, I don’t see any Publish Requests being fenerated from the client any where.
Request some clarification.
regards
PRAMANJ

January 14, 2016
11:55, EET
Avatar
Heikki Tahvanainen
Moderator
Members

Moderators
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

I thought once client adds subscription to a list of items, the server generated events for Publish respones at specified periodicity.

Yes, this is correct. The sampling interval of monitored items defines the rate the server checks for value changes and publish interval of subscription defines how often these notification messages are sent to the client. These notification messages are included in the publish response message.

Looks like the client generates the PublishRequests at a specified periodicity internally once a subscription has been added. Atleast that’s what it appears from the sample console example in your SDK. In the example for client, I don’t see any Publish Requests being fenerated from the client any where.

Yes, client sends PublishRequests at a specified periodicity once a subscription has been added. OPC UA client sends a list of publish requests to the server without expecting an immediate response. The server queues the publish requests until a notification message is ready for sending to the client. The algorithm for sending publish requests from the client to the server depends on multiple parameters including number of subscriptions, network latency and maximum queue size for publish requests in the server. As a user of Prosys OPC UA Java SDK, you should not have to worry about sending PublishRequests manually, just let the SDK handle that.

Br,
Heikki

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
15 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

TimK: 41

Member Stats:

Guest Posters: 0

Members: 683

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

Kickbiche, karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer

Moderators: Jouni Aro: 1010, 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