Micro Motion Modbus Interface Tool: Integer Scaling Manuals & Guides

Micro Motion® Modbus Interface Tool

Integer Scaling

IS 1 Overview

Integer scaling is used to represent process variable data as integer values, rather than floating-point values, without losing resolution. Integer scaling may be required for Modbus hosts that do not support floating-point.
Integer scaling may also be used to apply an offset to the process data so that it falls within a valid or convenient range. For example, negative values may be offset so that they can be read as positive values.
The scaled integer value is accurate to one part in 65535.
Example 1
Figures IS-1 and IS-2 provide two illustrations of integer scaling. These figures show how a floating-point value is represented as an integer value, given the user-specified values for the high end and low end of the range. Scale factor and offset are calculated from this information.
Section IS-2 provides integer scaling calculation and configuration instructions.
Section IS-3 provides information on using scaled integer data.
Section IS-4 provides detailed examples of scaled integer setup.
Problem: The quality of the process varies widely unless density remains between 1.0000 and 1.2000 grams per cubic centimeter
3
(g/cm
). Because the Modbus host does not have floating-point
capability, it interprets both values as 1 g/cm
Solution: Implement integer scaling for density, so that the integer 10000 represents a density of 1.0000 g/cm represents a density of 1.2000 g/cm
As a result, a change of 1 in the value of the scaled integer represents a 0.0001 g/cm 10001 represents a density of 1.0001 g/cm
3
change in temperature. For example, a density value of
3
.
3
.
3
, and the integer 12000
3
.
Integer Scaling
Scale factor = 1000 Offset = 31268
0–1.00 2.00 3.00 4.001.00–2.00 5.00Unscaled values
0 1500Scaled integer values 5000
Process variable values
• Floating-point range: –1.50 to +3.50
• Scaled integer range: 0 to 5000
3000 4000
Scale factor = 6 Offset = 30868
0–100 200 300 400100–200 500
Process variable values
• Floating-point range: –150 to +500
• Scaled integer range: 1000 to 4900
1000 4900Scaled integer values
Unscaled values
25001900 3700
500
3100 4300
y Ax B 32768()=
Figure IS-1 Integer scaling illustration
Figure IS-2 Integer scaling illustration

IS 2 Configuring integer scaling

Note: If you configure integer scaling for more than one process variable, the same maximum integer applies to all scaled process variables. Each scaled process variable can have its own offset and scale factor.
A scaled integer value is calculated using the following equation:
where:
y = Scaled integer to be returned by transmitter
A = Scale factor
x = Measured value of process variable
B = Offset
2 Micro Motion® Modbus Interface Tool
Integer Scaling
A
y
2y1
x
2x1
-----------------=
A
y
2y1
x
2x1
-----------------=
A
5000 0
3.50 1.50–()
------------------------ -------------=
A 1000=
A
y
2y1
x
2x1
-----------------=
A
5000 1000
500 150–()
------------------------ ----------=
A6.156==
Step 1 Calculate scale factor
The scale factor is the value of process variable range to the scaled integer range. The default scale factor is 1.
A in the preceding equation. The scale factor is a ratio that converts the
1. Use the following equation to calculate the scale factor:
where:
x1 = Lower range value (LRV) of process variable. Typically, but not necessarily, the
­LRV is the lowest value that the process variable can take in the application.
-
x2 = Upper range value (URV) of process variable. Typically, but not necessarily, the
URV is the highest value that the process variable can take in the application.
y1 = Scaled integer that will represent x1. y1 must be equal to or greater than 0 and
­less than or equal to the maximum integer.
y2 = Scaled integer that will represent x2. y2 must be equal to or greater than 0 and
­less than or equal to the maximum integer.
2. The scale factor must be an integer. If necessary, round the calculated scale factor down to the nearest integer. As a result, the scaled integer range will slightly exceed the process variable range.
Example 2
Refer to Figure IS-1. The mass flow rate ranges from –1.50 to +3.50 g/min. The integer 0 will be used to represent –1.50 g/min, and the integer 5000 will be used to represent a mass flow rate of
3.50 g/min.
Calculate the scale factor as follows:
Refer to Figure IS-2. The mass flow rate ranges from –150 to +500 g/min. The integer 1000 will be used to represent –150 g/min, and the integer 5000 will be used to represent a mass flow rate of 500 g/min.
Calculate the scale factor as follows, rounding down as required:
Micro Motion® Modbus Interface Tool 3
Integer Scaling
B ScaleFactor x1×()y132768+=
BScaleFactorx
1
×()y132768+=
B 1000 1.50–()×[]0 32768+=
B 1500–()0 32768+=
B 31268=
BScaleFactorx
1
×()y132768+=
B 6 150–()×[]1000 32768+=
B 900–()1000 32768+=
B 30868=
Step 2 Calculate offset
The offset for scaled integers is the value of
Use the following equation to calculate the offset:
Note: This equation is a simple transformation of the equation used to calculate scaled integers.
B in the preceding equation. The default offset is 0.
Example 3
The offset determines the intercept, which is the value of the process variable that will be reported as the scaled integer 0.
Refer to Figure IS-1.
Calculate the offset as follows:
Refer to Figure IS-2.
Calculate the offset as follows:
Step 3 Determine maximum integer
The maximum integer is the highest value of the scaled integer that you want to read. It may or may not be equivalent to the highest value that is possible or desirable for your application.
The overflow integer is the value that the transmitter will report for the process variable if the scaled integer value goes above the maximum integer or below 0. The overflow integer is automatically set to the maximum integer + 1.
The maximum integer and overflow integer values are shared by all scaled integers. Set the maximum integer so that both it and the overflow integer are in the range of integers supported by the Modbus host, and they will be appropriate for all process variables for which you will implement scaled integers.
The valid range for the maximum integer is 0 to 65534; the default value is 65534. Accordingly, the default value for the overflow integer is 65535.
4 Micro Motion® Modbus Interface Tool
Integer Scaling
Example 4
The transmitter also returns the overflow integer for all scaled integers if any of the following alarm conditions exists:
Note: Events can be used to show out-of-range conditions, just as the overflow integer does. However, these two functions are independent and can be programmed independently.
Step 4 Write the values to the transmitter
Integer scaling for density has been implemented, so that the integer 10000 represents a density of 1.0000 g/cm represents a density of 1.2000 g/cm
The maximum integer is set to 12000. Therefore, the overflow integer is
12001. Whenever the density scaled integer goes above 12000 (density goes above 1.2000 g/cm integer (12001) for the density process variable, which the Modbus host is programmed to recognize as an alarm condition.
Sensor failure
Input overrange
Density outside sensor limits
Temperature outside sensor limits
Transmitter electronics failure
3
3
.
3
), the transmitter reports the overflow
, and the integer 12000
Write the following values to the transmitter:
Maximum integer – Register 18
For each process variable:
- Scale factor – Registers 29–38
- Offset – Registers 19–28

IS 3 Using scaled integers

To read scaled integer values, read the appropriate integer registers (Registers 2–11). To reset scaled integer totals or inventories, write 0 to the appropriate register (Registers 8–11).
Micro Motion® Modbus Interface Tool 5
Integer Scaling
y2y1–
x
2x1
-----------------=
4095 0
300 100–()
----------------------------------=
4095
400
-------------=
10.2375=
Scale factor x×()y32768,+=
10 100–()[]0 32 768,+=
1000 32 768,+=
31 768,=
0 10x 31768 32768()=
x 100=
4095 10x 31768 32768()=
x309.5=

IS 4 Scaled integer examples

Example 5
The transmitter is connected to a Honeywell TDC3000 control system using a PLC Gateway. The transmitter’s volume flow measurement will be reported to the control system via an analog input point.
On the control system, an analog input point has limits of 0 and 4095. Any input greater than 4095 indicates a “bad” process variable.
The lowest expected value for volume flow is –100 barrels/day; the highest expected value is 300 barrels/day.
1. Choose the scaled integers that will represent the LRV and URV. They must be in the range 0–4095. This example will use 0 and
4095.
2. Determine the scale factor.
Because the scale factor must be an integer, round down to 10.
3. Determine the offset.
4. Because the calculated scale factor of 10.2375 was rounded down to 10, calculate the actual process variable values that correspond to scaled integer values of 0 and 4095. This will allow correct scaling of the analog input at the control system.
Scaled integer = 0
Scaled integer = 4095
5. Set the maximum integer, if desired. It should be 300 or greater.
6 Micro Motion® Modbus Interface Tool
Integer Scaling
y2y1–
x
2x1
-----------------=
30 000 0,
200 100–()
----------------------------------=
30 000,
300
-------------------=
100=
Scale factor x1×()y132 768,+=
100 100–()[]0 32 768,+=
22 768,=
y2y1–
x
2x1
-----------------=
10000 0
40 30
--------------------------=
10000
10
----------------=
1000=
Scale factor x1×()y132 768,+=
1000 30×[]0 32 768,+=
62768=
Example 6
Example 7
Scale the mass flow rate so 0 represents –100 lb/min and 30,000 represents 200 lb/min.
Scale factor
Offset
The mass flow rate needs to remain between 30 and 40 g/min. Scale the mass flow rate so 0 represents a flow rate less than or equal to
30.000 g/min, 10,000 represents a flow rate of 40.000 g/min, and 10,001 represents any flow rate greater than 40.000 g/min.
Scale factor
Offset
Maximum integer = 10000
Micro Motion® Modbus Interface Tool 7
©2008, Micro Motion, Inc. All rights reserved. P/N MMI-20011358, Rev. A
*MMI-20011358*
Loading...