

13:13, EEST

March 16, 2017

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?
14:23, EEST

Moderators
February 11, 2020

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.
15:21, EEST

March 16, 2017

13:11, EEST

March 16, 2017

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.
1 Guest(s)
