How to convert a floating value in DeltaV?

PLC sends 2773 but deltaV shows -8,6080655E + 9 in control module.

Looking at the cause, PLC is a high word first type, but deltaV is a low word first type.

How do I get the value of the High word first type method in deltaV?

Is there a way to get the 2733 by calculation without converting the card setting.

  • The right way would be to adjust settings at the card to swap words or bytes so that data is properly transferred.

    Attempting to determine the 32 individual bits of a Floating point number is not likely to win you any friends with those that have to deal with this in the future. it would be easier to read the data as integers and reform the float value, but that's not much nicer.

    The DeltaV Float is a 32 bit number with a 23 bit Mantissa, a 7 bit logarithm, sign bit for the logarithm (bigger or smaller than 1, and overall sign bit. ( I reserve the right to be wrong about these. Could be a 22 bit Mantissa, but if you know what you are doing, you can quickly figure this out).

    The number 2733 means the number is positive and greater than 1, so we have the first two bits. The logarithm comes next. Those 7 bits define the largest binary multiple or 2^x where x is 1 to 127. For this case, the number is greater than 2048, but less than 4096, so x= 11. 2^11=2048. that leaves us with 23 bits to represent 685. The Mantissa forms a fraction of 2048 that equates to 685. The value of the Mantissa is in proportion to the logarithm.
    where x=11, so 685/2^11 = (2^m/2^23), 2^m = 2805760. m therefore = 00101010110100000000000

    So we now know the content of the most significant bits: 0 0 001011 00101010110100000000000

    Now you want to swap the two 16 bit words, and you get
    0110100000000000 0 0 001011 0010101

    Now you can reverse the calculation.
    The logarithm is 2^-80,
    The mantissa is 0000000000010110010101 or 2^1429

    (As I mentioned, I reserve the right to be wrong in the example above, it is just for making the point that this is not trivial)
    OK, I'm done. The short of it is, you do not have access to the individual bits of a floating point number in DeltaV. converting from Float to integer will truncate the Float value and give you the integer value, if it is within the range of the integer (16 bit or 32 bit). And since the mantissa is 23 bits, numbers above that resolution will have error as the Floating point value resolution will have resolution error. You can't simply shift bits around to extract and invert the two 16 bit words that make up 2733. I mean you could, but it would be an arduous calculation using iterative loops to determine the value of the mantissa.

    If you can read a 32 bit Integer, DeltaV will let you extract the 16 bit words using the shift right function and bitwise Operators. You'd still have to reassemble the floating point value from the mantissa Log and sign bits.

    No, your best bet is to properly set the communication parameters to match the byte or word order so data is converted correctly during the data transfer to DeltaV.

    I'm going to bed now. My head hurts.

    Andre Dicaire