Skip to content

Can't write Float value to Float datatype Tag on opc ua server #669

@payalgaikwad42

Description

@payalgaikwad42

Hi,
I am using eclipse milo library to write data to opc ua kepserver in Java. I am facing issue while writing data of float type to tags on kepserver. The value I am proving is a api request body. I can see the values i am receiving are correct but after writing data to kepserver some of the values are set to garbage values.

My api request is :

{ "FaceLngth2":0.3, "FaceWght1":9.3, "FaceWght2":0.3, "FaceThickness1":0.3, "FaceThickness2":0.3, "FaceWidth1":0.3, "FaceWidth2":0.3, "WebLngth1":1.5, "WebLngth2":1.2, "WebThckn1":0.8, "WebThckn2":0.9, "WebWght1":0.7, "WebWght2":0.4, "WebWidth1":0.8, "WebWidth2":3.0 }

Following is the snippet of how I am writing data to Tags. It a switch case where I am checking cases against keys in request body.

case "FaceLngth1":
					statusCode = client
							.writeValue(new NodeId(nodeid, channelName + ".BLT.OUT.Out_FaceLength1_FaceLngth1"),
									new DataValue(new Variant(taginfo.getFaceLngth1()), null, null))
							.get();
					logger.info("outfacelength1 " + statusCode.toString());

					break;
case "WebLngth1":
					statusCode = client
							.writeValue(new NodeId(nodeid, channelName + ".BLT.OUT.Out_WebLength1_WebLngth1"),
									new DataValue(new Variant(taginfo.getWebLngth1()), null, null))
							.get();
					logger.info("outweblength1 " + statusCode.toString());

					break;
case "FaceLngth2":
					statusCode = client
							.writeValue(new NodeId(nodeid, channelName + ".BLT.OUT.Out_FaceLength2_FaceLngth2"),
									new DataValue(new Variant(taginfo.getFaceLngth2()), null, null))
							.get();
					logger.info("outfacelength2 " + statusCode.toString());

					break; 

Data written on kepserver is as follow:

1596173075402

As you can see in the screenshot some of the values for Tags with float datatype are not in the correct format.

Can someone please tell me how to write float data to kepserver/opc ua?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions