Avatar
Please consider registering
guest
sp_LogInOut Log Insp_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 RSSsp_TopicIcon
How can I bind data to variable
March 9, 2017
4:11, EET
Avatar
tzls
Member
Members
Forum Posts: 4
Member Since:
October 20, 2016
sp_UserOfflineSmall Offline

Hi
Now I have a periodic variation and want to bind it to a variable in address space.First I got the variable node by the method findNode(NodeId) in class com.prosysopc.ua.server.NodeManager,then change the value of the node by the method updateValue(Object) in class com.prosysopc.ua.server.nodes.UavariableNode.It can work ,but the methods should be called every few seconds.Do you have some suggestions ?

March 9, 2017
10:11, EET
Avatar
Heikki Tahvanainen
Member
Members
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hi,

Thank you for the question. Can you explain what is the problem with updating the data every few seconds?

If you use the UaNode-based approach, you will have to update the value to the node object. Alternatively, if your data is already in an existing subsystem, it may not feel very reasonable to replicate it all with UaNodes. In this case, you can implement a custom NodeManager (and other managers), which manages the service requests from the OPC UA clients and provides the requested data.

Without knowing more about your exact system, I would say that the best option is to just keep using the updateValue method and calling it whenever your data changes. For example, OPC UA subscriptions will only work if you provide all the value updates.

March 9, 2017
14:12, EET
Avatar
tzls
Member
Members
Forum Posts: 4
Member Since:
October 20, 2016
sp_UserOfflineSmall Offline

Hi,
Thanks for your reply.I try to explain my question clearly.when a variable in address space represents the value of a sensor in physical world,I wonder what should I do to make the value of the variable changes with the changing of the sensor value.

March 10, 2017
12:19, EET
Avatar
Heikki Tahvanainen
Member
Members
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hi,

You need to use the UaVariableNode.updateValue or UaVariableNode.setValue methods. Alternatively, if you are using the generic PlainVariable implementation, you can use the PlainVariable.setCurrentValue method.

March 16, 2017
18:05, EET
Avatar
hbbend
Member
Members
Forum Posts: 9
Member Since:
October 21, 2016
sp_UserOfflineSmall Offline

Hi,

is it Ok if I use read or writeAttribute, instead of UaVariableNode.updateValue or UaVariableNode.setValue methods”
in the OnDataChange method of MonitoredDataItemListener?

Thank’s in advance,
B/R

March 17, 2017
14:52, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1044
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

I assume that you are doing this in the client side. Yes, I is fine. But note that they validate the AccessLevel and WriteMask, if the operation is allowed. If you want to set the value unconditionally, you can use setAttribute().

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online:
Guest(s) 68
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 100
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 773
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1558
Posts: 6567
Newest Members:
aracelyhaley4, raphaelschonell, Ashmag, kathyreimann56, brittanylemos, dorthycundiff76, PromotionToold, CHHinrichs, rodricklienhop, jose_Wanderlei
Moderators: Jouni Aro: 1039, Pyry: 1, Petri: 1, Bjarne Boström: 1054, Jimmy Ni: 26, Matti Siponen: 359, Lusetti: 0
Administrators: admin: 1