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: 1032
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: 1919

Currently Online:
32 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 729

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466, zkxwilliemae, gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0

Administrators: admin: 1