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
Node changes data type
August 29, 2025
13:13, EEST
Avatar
rocket science
Member
Members
Forum Posts: 105
Member Since:
March 16, 2017
sp_UserOfflineSmall Offline

Hi,

I made some strange observation with an OpcUa server.

I’m reading a node which return normally a Float value, but sometimes it returns a Boolean value (in the same session, only some seconds later). Is this even possible or could this be a bug in the OpcUa server?

Basically I call client.read(1.0, TimestampsToReturn.Both, readValueIds) where readValueIds contain only one nodeId

When getting the response I get the DataValue using dataValue = response.getResults()[0]

And from the dataValue I use dataValue.getValue() to get the Variant (this seems to be sometime a float and sometimes a boolean for the same nodeId)

And when print out the variant.getValue().getClass().getCanonicalName() it sometime shows me java.lang.Float and sometime java.lang.Boolean

Do you have any idea if this might be allowed by OpcUa specification? From my point of view the node has a DataType and this should not change during server runtime?

August 29, 2025
14:23, EEST
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 362
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

There are effectively three possible scenarios here:

1. The DataType of the Node is either Boolean or Float. In this case, it is mistake in the Server if the Value of Node is set to a value that doesn’t match the correct DataType.

2. The DataType of the Node is BaseDataType. In this case, it is acceptable for the Node to have both Boolean and Float values, but it is questionable design to use BaseDataType as the DataType without very good reason to do so.

3. The DataType of the Node is changing between Boolean or Float (or the entire Node keeps changing while keeping the same NodeId). Technically, the DataType of a Variable Node is allowed to change, but this is also questionable design choice.

In short, it is unusual that you receive Boolean and Float values from the Node and should contact the manufacturer of the Server about this.

August 29, 2025
15:21, EEST
Avatar
rocket science
Member
Members
Forum Posts: 105
Member Since:
March 16, 2017
sp_UserOfflineSmall Offline

Thank you for your thoughts. I will check if any of the 3 scenarios apply to the server

September 1, 2025
13:11, EEST
Avatar
rocket science
Member
Members
Forum Posts: 105
Member Since:
March 16, 2017
sp_UserOfflineSmall Offline

Hi,

I’ve another scenarios which might happen here.

When calling the read …

client.read(1.0, TimestampsToReturn.Both, readValueIds)

… and building the readValueIds, I accidently added a node twice.

So my array was like:
readValueIds[0] = NodeId1
readValueIds[1] = NodeId2
readValueIds[2] = NodeId1 (which is the same as readValueIds[0])

NodeId1 and NodeId2 are of type Float

But the server returned as readResult in this case:

readResult[0] = Variant(Float) of NodeId1
readResult[1] = Variant(Float) of NodeId2
readResult[2] = Variant(Boolean,false) ?

So, I guess thats a bug in this particular OpcUa server and the server can not handle it when the readValueIds contain duplicate NodeIds.

Tried the same with some Demo-Servers and they could handle it correctly.

September 1, 2025
13:35, EEST
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 362
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

OPC UA allows the same NodeId to appear multiple times in a Read request. If the Server can’t handle that and is behaving as you describe, then it is definitely an error in the implementation of the Server.

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online:
Guest(s) 62
Currently Browsing this Page:
1 Guest(s)
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:
willardmackellar, vnedrenie_koPi, shaylaholton205, PhilesiaGen, rosaurathiel524, Arthurobext, stefanmacneil3, ralni, illuminationscanada, PhillipGit
Moderators: Jouni Aro: 1039, Pyry: 1, Petri: 1, Bjarne Boström: 1054, Jimmy Ni: 26, Matti Siponen: 359, Lusetti: 0
Administrators: admin: 1