A
Hi All,
I am trying to read metering data from Deif MTR-2-315 power transducer using Modbus RS485-RTU two wire connection. A Siemens S7-200 PLC acts as a master on this network. I have no problem reading voltage, current, KW, and KVAR values, which are in IEEE 754 floating point format. However Frequency and Power Factor are in some different data format. The data format is as follows:<pre>
Frequency (unsigned 32 bit measurement)
-----------------------------------
Bits #31...24 Decade Exponent (signed 8 bit)
Bits #23...00 Binary unsigned value (24 bit)
Power Factor (32 bit)
---------------------
Bits #31...24 Sign: Import/Export (00/FF)
Bits #23...16 Sign: Inductive/Capacitive (00/FF)
Bits #15...00 Unsigned value (16 bit), 4 decimal places
The binary data for frequency is as follows:
Register Address Bytes
30051 Byte #1 = 1111 1101
Byte #2 = 0000 0000
30052 Byte #1 = 1110 1010
Byte #2 = 0101 1110</pre>
Since the frequency data type looks very close to the standard IEEE floating point format. I tried to combine the two bytes at address 30052. After combining the two bytes, I could get value of 5999, which looked logical. I could also figure out that if I leave the sign bit off (1 at the beginning of Byte#1 at address 30051), the resulting decimal number comes out to be 125. And as per the standard floating point notation if I subtract 127 (which is the bias) from 125 I get -2, which means if I multiply the mantissa (5999) by 1/100 (10^-2) I should get 59.99. However, I am struggling as how to combine all four bytes in a PLC program so that I arrive at the answer 59.99 or 0.85 in case of the power factor. I tried using double integer to real conversion instruction, but it did not work. If I combine the two registers at the address 30051 and 30052, it gives me a 10 digit decimal number. Swapping and then combining the registers also results in a 10 digit decimal number.
Thanks in advance for the help.
I am trying to read metering data from Deif MTR-2-315 power transducer using Modbus RS485-RTU two wire connection. A Siemens S7-200 PLC acts as a master on this network. I have no problem reading voltage, current, KW, and KVAR values, which are in IEEE 754 floating point format. However Frequency and Power Factor are in some different data format. The data format is as follows:<pre>
Frequency (unsigned 32 bit measurement)
-----------------------------------
Bits #31...24 Decade Exponent (signed 8 bit)
Bits #23...00 Binary unsigned value (24 bit)
Power Factor (32 bit)
---------------------
Bits #31...24 Sign: Import/Export (00/FF)
Bits #23...16 Sign: Inductive/Capacitive (00/FF)
Bits #15...00 Unsigned value (16 bit), 4 decimal places
The binary data for frequency is as follows:
Register Address Bytes
30051 Byte #1 = 1111 1101
Byte #2 = 0000 0000
30052 Byte #1 = 1110 1010
Byte #2 = 0101 1110</pre>
Since the frequency data type looks very close to the standard IEEE floating point format. I tried to combine the two bytes at address 30052. After combining the two bytes, I could get value of 5999, which looked logical. I could also figure out that if I leave the sign bit off (1 at the beginning of Byte#1 at address 30051), the resulting decimal number comes out to be 125. And as per the standard floating point notation if I subtract 127 (which is the bias) from 125 I get -2, which means if I multiply the mantissa (5999) by 1/100 (10^-2) I should get 59.99. However, I am struggling as how to combine all four bytes in a PLC program so that I arrive at the answer 59.99 or 0.85 in case of the power factor. I tried using double integer to real conversion instruction, but it did not work. If I combine the two registers at the address 30051 and 30052, it gives me a 10 digit decimal number. Swapping and then combining the registers also results in a 10 digit decimal number.
Thanks in advance for the help.