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
writeValue(..., ...., autoConvert=true) seems not to work correct
June 3, 2019
20:16, EEST
Avatar
Predixer
Member
Members
Forum Posts: 8
Member Since:
December 6, 2017
sp_UserOfflineSmall Offline

Hi,
Environment:
– Prosys SDK: 4.0.2-808
– Prosys OPC UA Simulation Server (v3.2.0-214)
+ The simulation server is configured with several data nodes (for each numeric data type one variable).
+ Checkbox “Run Simulation” is switched off.

– data to write to the OPC UA server: UnsignedByte value = UnsignedByte.valueOf(28);

Test 1.
– For each data nodes on the server run “writeValue(…, value, false).
– Result:
+ Only the data node with type “UNSIGNED BYTE” succeeded. For the others I got a StatusException: Bad_TypeMismatch.
+ The value on the OPC UA server has changed.
=> Test OK.

Test 2.
– For each data nodes on the server run “writeValue(…, value, true).
– Result:
+ For each data node “writeValue(…, …, true) succeeded.
+ But non of the data nodes on the OPC UA server has changed. (The data node with the correct type hasn’t changed too !)
=> Test FAIL.
I would expect the value 28 could be changed into every other numeric type and written to the data nodes.

The behavior is reproducible with other OPC UA servers too.

June 4, 2019
12:33, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1068
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Thanks for reporting the issue. Would seem to be a bug.

This will happen at least if the UaNode for the DataType of the node to be written is not fetched via AddressSpace.getNode before the writeValue is called. 4.0.0 changed on how the AddressSpace is initialized to fix some other issues, but seems it caused this as a side effect and our tests didn’t catch exactly this scenario.

Will be fixed for future version, before that you could try the following as a workaround:

NodeId dataTypeId = (NodeId) client.readAttribute(nodeId, Attributes.DataType).getValue().getValue();
client.getAddressSpace().getType(dataTypeId);
client.writeValue(…)

(not including error handling)

June 4, 2019
14:42, EEST
Avatar
Predixer
Member
Members
Forum Posts: 8
Member Since:
December 6, 2017
sp_UserOfflineSmall Offline

Works, thank you. 🙂

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online:
Guest(s) 83
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