...
Code Block |
---|
value = (intValue + ref) / (10^scale) min = ref / 10^scale max = (2^width - 2 + ref) / (10^scale) intValue = (10^scale) * value - ref precision = 10^-scale |
Here Where scale=scale factor, ref=reference value (or bias) and width=bit width of the descriptor.
And "intValue" is an integer of N "width" bits from the Data Section (N=bit width of descriptor).
Example:
For "pressure" we have:
code=007004, type=long (integer), scale=-1, reference=0, bitwidth=14
...
Operator 207YYY means "Increase scale, reference value and data width"
Description: For Table B elements that are not CCITT IA5 (character data), code or flag tables:
1. Add YYY bits to the existing scale factor
2. Multiply the existing reference value by 10**YYY
3. Calculate ((10 * YYY) + 2) / 3, disregard any fractional remainder and add the result to the existing bit width."
That way Now we can encode pressure with 2 decimal digits:
"key" : "pressure",
"value" : 12.34,
"index" : 1,
"code" : "007004",
"units" : "Pa",
"scale" : 2,
"reference" : 0,
"width" : 24
Note the difference with the original 007004 descriptor:
"key" : "pressure",
"value" : 10,
"index" : 1,
"code" : "007004",
"units" : "Pa",
"scale" : -1,
"reference" : 0,
"width" : 14
so we increased the width by 10 bits and changed the scale to 2.
...
Content by Label | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...