Can anyone suggest to me how to do the conversion from 4 integers data to double float data after i get it from 1 device through OPC UA communication. The device side is a OPC UA Server. PI will act as OPC UA Client.
Hi all,Hopefully can get some reply from expert member. Got urgent case.Thank you.
It seems like you are asking about IEEE 754 double-precision binary floating-point format.
The IEEE 754 standard specifies a binary64 as having:
Sign bit: 1 bit
Exponent: 11 bits
Significand precision: 53 bits (52 explicitly stored)
The bits are laid out as follows:
Source: Double-precision floating-point format - Wikipedia
I don't completely get your question. Are you planning on doing the conversion or are you asking for the functionality in PI OPC UA client?
Yes, you are correct. I asking for the functionality in PI OPC UA client to do the conversion. Example do the arithmethic operation.
I short, the first 3 bytes of the first number give the exponent, except the first bit for sign. So it should be arithmetic to derive the floating point.
The fraction is easy:
It's a bit early to do the math for the first number, and likewise for stripping the sign. I'll need a coffee first. Shifting or subtracting powers of two, but my binary math is a bit rusty...
Thanks for your feedback. I already know how to do the calculation for this conversion. But i want to know if the PI POC UA Client have function/features to do this conversion directly. For example. the PI OPC UA Client get the data in 4 integer. How can i do the conversion?
Assuming you use the PI Connector for OPC UA:
The connector does not have provisions to change the data received. Thus if your source system presents 4 integers, then 4 integers is what you get. The integrator cannot change this, so you must transform the data afterwards.
Best case you can detect these situations in your asset data, and extend the asset model by the integrator to add this automatically (watch limitations: https://livelibrary.osisoft.com/LiveLibrary/content/en/con-opcua-v4/GUID-15663C0E-146B-43A4-9A25-E17514B97296)
If the PI connector OPC UA cannot do the conversion functionality, do you have any suggestion of OPC UA client can do similar application with the conversion functionality to convert the 4 integers into 1 double float data? The last platform to collect data is OPC UA Client. No other platforms afterward.
Nothing that i know of, except for building your own wrapper. But that seems a bit too much of an effort compared to the problem.
Is there is a specific reason you need to remediate this before reading in the data using the integrator, instead of after reading in the data? The latter should be not too difficult to build.
My reason is the application are direct conversion from 1 controller (flow computer) to the server. But the conversion is about the communication. From FC(flow computer) is MODBUS RTU and to the server (using PI OPC UA Client). Between that, we add 1 device to do communication conversion. The device cannot show the double float data (64bit). Thats why we do split from the FC (1 double float data to 4 integers data). And the device can pass through the data to server(PI). But now the server(PI) must do the conversion data (4 integers data to 1 double float data). Hope you can understand my requirement.
Retrieving data ...