I'm having problems with reading floating point values from a Delta DVP12SE PLC over modbus. The integral part of the floating point (that means the number before the "." sign) is correct. But the fractional part (that means the number after the "." sign) is wrong. For example;
PLC = 12.1 ---------> Ignition OPC UA Server Reads = 12.062
PLC = 12.5 ---------> Ignition OPC UA Server Reads = 12.5
PLC = 12.8 ---------> Ignition OPC UA Server Reads = 12.75
PLC = 298.73 -------> Ignition OPC UA Server Reads = 298
In my Modbus device configuration in Ignition, I have disabled the Reverse Word Order and I have enabled the Span Gaps.
Highly appreciate if anyone can guide me on how to solve this issue.
Thanks for the suggestion, I will try this out. BTW, the accuracy of the fractional part of the floating point numbers are extremely crucial because I'm trying to monitor the servo motor position coordinates inside the PLC.
According to the wireshark capture, since the ignition is getting 298.0 as the data passed over the network, I did the following thing to test if there are anything wrong with the Modbus registers which I'm reading.
Moved into another register called D10 in the PLC and assigned the value 900.70 to it.
By doing this I realized that there are actually more problems that I'm facing. Please see the attached photos. I have described what I have found in the photos.
I created the OPC tag manually for my floating point number following the document you have provided. But still I'm getting the same problem. As you can see when I assign 60.9 to the D3 register in the PLC, Ignition is reading the value as 60.75
Sorry, I didn't really expect that to fix the floating point issue, just to avoid introducing others.
You're going to have to take the Wireshark capture to the vendor of that PLC for support. It clearly shows that when we read the two registers that need to be combined to create a 32-bit float, the PLC is returning one of them as 0, which is where your missing precision is going to.
In the original capture screenshot, the PLC returns 0x4395 for register 4100 and 0x0000 for register 4101. This makes for 298.0. In order for the value to be 298.73 the value of 4101 needs to be 0x5d71.
I'm assuming your capture shows similar behavior for all the floating point register pairs but you only shared a screenshot so I'm just assuming.
edit: and again, there's still the possibility that you are just off by one on your register addressing, and that the missing precision is in 4099 and you need "Swap Words" enabled.
Yes, you are 100% correct. I found the root cause for my issue. The issue was that my Modbus addressing is actually off by one and also I had to enable the "swap Words" option in the Ignition. And now, Everything is working fine... Thank you very much for the guidance. Really appreciate your support.
Find the attached screen shots of the resolved issue;
Actually the "Zero based addressing" was enabled from the begining, but I haven't enabled the "Swap Words" option. I think I faced this issue as a result of not enabling the "swap word" option and also the issue with my Modbus addressing, both.