Modbus (or other 3rd party communications protocol) not displaying correct value even though coefficients (gain and offset) have been defined
- Device Template
The Xenta 913/731 uses an abnormal equation when applying the coefficient in device templates for 3rd party interfaces: y=m(x+b)
Traditionally, the slope-intercept form is used when applying a coefficient: y =mx+b
This means that the gain in the coefficient is applied after the offset rather than before it.
If you have the information that fits a traditional slope-intercept form and need to apply a coefficient in a XBuilder device template then use the following as your variables where m and b are from the slope-intercept form equation:
The following is an example of one manufacturer's specifications for its Modbus values and how to correctly enter them into the device template:
For a temperature sensor reading that is being sent as a Modbus point a certain manufacturer specifies that to correct the raw value the following should be used:
- Gain = 0.1
- Offset = -40
However, the manufacturer assumes the standard slope-intercept form will be used, so entering the data without any adjustments would cause the value to be converted incorrectly in the Xenta Server.
For example, if the temperature was 80 °F then the raw Modbus value would be 1200 and the Xenta Server would apply the coefficient as y=0.1(1200+(-40)), simplified as y=120-4. This means the Xenta Server would return a value of 116 °F instead of 80 °F.
In order to fix this the offset should be multiplied by the gain in order to compensate for the difference in how the Xenta Server utilizes the coefficient compared to how the 3rd party manufacturer intended it to be used. So the following would be used:
- Gain = 0.1
- Offset = (-40)*0.1 or -400
Now, with a temperature of 80 °F the raw Modbus value will still be 1200 and the Xenta Server will apply the coefficient as y=0.1(1200+(-400)), simplified as y=120-40. The Xenta Server now returns the correct value of 80 °F.