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
writeValue(..., ...., autoConvert=true) inconsistent behavior on Float/ Long
June 4, 2019
18:28, EEST
Avatar
Predixer
Member
Members
Forum Posts: 8
Member Since:
December 6, 2017
sp_UserOfflineSmall Offline

Hi,
The conversion of Java Double, Float values to OPC UA SignedLong seems to be inconsistent.
For all other data types an exception is thrown if the value exceeds the limits of the target type (com.prosysopc.ua.DataTypeConversionException / Value overflow).
Converting Double.MAX_VALUE or Float.MAX_VALUE into Signed Long results to Long.MAX_VALUE on the OPC Simulation Server.

This behavior is not reproducible on the Bosch OPC UA Server.
May be this the not a problem of the OPC UA Java SDK rather than of the OPC UA Simulation Server.

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.

Test:
Call “uaclient.writeValue(…, value, true)” with value=Float.MAX_VALUE or value=Double.MAX_VALUE

June 5, 2019
11:54, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Internally that method delegates the conversion to DataTypeConverter (client.getAddressSpace().getDataTypeConverter()). The primary use-case for that (at least was) to handle the Cast FilterOperator used in MonitoredItems for events. Therefore it tries to implement rules defined in the specification (1.04 Part 4, section 7.4.3, table 122).

OPC UA 1.02 seems to have added extra rules that “Converting a value that is outside the range of the target type causes a conversion error.”. In 1.01 it was undefined what should happen. It would seem we don’t have that rule in place yet, but some types might do it implicitly due how the code is done.

Will be also fixed in a future version, however for this one I do not see any easy workaround unfortunately (other than doing the conversion manually, but that sort of defeats the point).

I’m not sure why the issue wont happen with Bosch server (or it is possible that it would reject Long.MAX_VALUE always, which could mask this error).

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
19 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: 681

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

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

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