Please consider registering

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
Forum Posts: 6
Member Since:
December 6, 2017
sp_UserOfflineSmall Offline

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.

– 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.

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

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


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:
19 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: 857

Moderators: 12

Admins: 1

Forum Stats:

Groups: 3

Forums: 14

Topics: 872

Posts: 3676

Newest Members:

virgie88y3407, bennetcole, timbo, malissa6674, Markus Johansson, jonathancamp, michell9665, bqpkelvin990391, Christopher, HuMa

Moderators: Jouni Aro: 827, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 382, Heikki Tahvanainen: 402, Jukka Asikainen: 1, Teppo Uimonen: 15, Markus Johansson: 1

Administrators: admin: 0