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: 6
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: 365
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: 78

Currently Online:
15 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 89

pramanj: 86

ibrahim: 68

kapsl: 57

gjevremovic: 49

TimK: 41

Fransua33: 39

fred: 36

Rainer Versteeg: 32

peterrob45: 25

Member Stats:

Guest Posters: 0

Members: 841

Moderators: 11

Admins: 1

Forum Stats:

Groups: 3

Forums: 14

Topics: 860

Posts: 3632

Newest Members:

augusthanks, jackbryan, jansmithsmth, uiuida, johnjorge, Ramraj, dimad, aku, Rakshan, claradsouza

Moderators: Jouni Aro: 824, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 365, Heikki Tahvanainen: 402, Jukka Asikainen: 1, Teppo Uimonen: 14

Administrators: admin: 0