eclipse / milo

Eclipse Milo™ - an open source implementation of OPC UA (IEC 62541).
http://www.eclipse.org/milo
Eclipse Public License 2.0
1.17k stars 432 forks source link

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

Closed payalgaikwad42 closed 4 years ago

payalgaikwad42 commented 4 years ago

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?

kevinherron commented 4 years ago

From what you posted it doesn’t look like there’s a problem on this side. Maybe you can get a Wireshark capture and observe the values that are being sent to Kepware.