Reading Float 32

HI, please help I’m stuck.
I have power grid analyzer with Modbus RTU, because I don’t have RS485 @ PC so I rewrite registetrs to PLC and OH reads them from PLC by Modbus TCP. That is no big problem but analyzer keeps data as float32 with separate register for sign (+/-). And the question is what will be the best way to combine values with propriate sign?
I can try to do this @ PLC but dont’ know how (at least for now :slight_smile: )
I can make third item and via rule combine value with sign, but it looks like workaround, it have to be smoother solution.
Any ideas?

Yes. Putting the sign and the value in separate registers is an unusual thing to do, so you must workaround that.

Are the registers adjacent? If so, you could read as a 64-bit integer, then write a javascript read transform that breaks into parts, interprets the float part, and combines with the sign part. I don’t think that will be easy in javascript.

Thanks for suggestion , unfortunately there is one register that holds signs for 8 different values (8bit, one bit for one value).
Ideally it should be kind of offset with multiplication and division by a variable.

You’re going to have to write a rule, as each binding data Thing has access to only one data package of 1, 2 or 4 registers. There is no way to process together 32-bits from “here” and 1-bit from an arbitrary “there”.

Can I somehow read another item value and put it in transform.js?
Something like that:
(function(inputData) {

var multiply = sign; // sign - read item “sign” which holds 1 or -1 value

return parseFloat(inputData) * multiply;

Transformations have a single input.
From a rule, you can examine or update as many Items as you like.