Devices > Remote Devices > Device Template Files > Reference Methods > Scaling by Factor and Offset Examples

Scaling by Factor and Offset Examples

This topic provides numerous useful examples of the various ways you can use reference methods in your device template files to perform conversions with constant values and/or reference data group element values. A sample device template file using each example is available upon request; it can be loaded to a DDS and used to test your reference methods. It is called ReferenceTester.dtf. The original, non-scaled input value must be preserved in a different data group element element.

See the following subsections for details:

For information about example data group element IDs and values used below, see Example Values.

Scaling by Factor and Offset Data Group Element (A)

The following example references the data group element raw61 and applies a scale factor from raw10 and a scale offset from raw5 to it. The result is 615 because 61 is multiplied by a factor of 10, then 5 is added to 610.

<ScaleFOIdA desc="Scale Factor and Offset DEID Method A" readOnly="true" type="ui2" ref="raw61" scaleFactorId="raw10" scaleOffsetId="raw5"/>

Useful attributes to know are ref, scaleFactorId, and scaleOffsetId.

Scaling by Factor and Offset Data Group Element (B)

The following example uses three child elements to compute a scaled value. The first child element references the operation opAssignId and the data group element raw61 to assign the current value of raw61 as the initial value for ScaleFOIdB. The second child element references the opScaleFactorId operation and applies a referenced scale offset from raw10 to the value assigned by the first child element. The result is 610. The third child element references the opScaleOffsetId operation and applies a referenced scale offset from raw5 to 610. The final result is 615 because 5 is added to 610.

<ScaleFOIdB desc="Scale Factor and Offset DEID Method B" readOnly="true" type="ui2" isRef="1">

<ref prec="0" refOp="opAssignId" deid="raw61"/>

<ref prec="1" refOp="opScaleFactorId" deid="raw10"/>

<ref prec="2" refOp="opScaleOffsetId" deid="raw5"/>

</ScaleFOIdB>

Useful attributes to know are isRef, prec, refOp, and deid. A useful element to know is ref.

Scaling by Factor Constant (A)

The following example references the data group element raw61 and applies a constant scale factor of "10" to it. The result is 610 because 61 is multiplied by a factor of 10.

<ScaleFA desc="Scale Factor Constant Method A" readOnly="true" type="ui2" ref="raw61" scaleFactor="10"/>

Useful attributes to know are ref and scaleFactor.

Scaling by Factor Constant (B)

The following example uses two child elements to compute a scaled value. The first child element references the operation opAssignId and the data group element raw61 to assign the current value of raw61 as the initial value for ScaleFB. The second child element references the opScaleFactor operation and applies a constant scale factor of 10 to the value assigned by the first child element. The result is 610 because 61 is multiplied by a factor of 10.

<ScaleFB desc="Scale Factor Constant Method B" readOnly="true" type="ui2" isRef="1">

<ref prec="0" refOp="opAssignId" deid="raw61"/>

<ref prec="1" refOp="opScaleFactor" scaleFactor="10"/>

</ScaleFB>

Useful attributes to know are isRef, prec, refOp, deid, and scaleFactor. A useful element to know is ref.

Scaling by Factor Data Group Element (A)

The following example references the data group element raw61 and applies a scale factor from raw10 to it. The result is 610 because 61 is multiplied by a factor of 10.

<ScaleFIdA desc="Scale Factor DEID Method A" readOnly="true" type="ui2" ref="raw61" scaleFactorId="raw10"/>

Useful attributes to know are ref and scaleFactorId.

Scaling by Factor Data Group Element (B)

The following example uses two child elements to compute a scaled value. The first child element references the operation opAssignId and the data group element raw61 to assign the current value of raw61 as the initial value for ScaleFIdB. The second child element references the opScaleFactorId operation and applies a referenced scale factor from raw10 to the value assigned by the first child element. The result is 610 because 61 is multiplied by a factor of 10.

<ScaleFIdB desc="Scale Factor DEID Method B" readOnly="true" type="ui2" isRef="1">

<ref prec="0" refOp="opAssignId" deid="raw61"/>

<ref prec="1" refOp="opScaleFactorId" deid="raw10"/>

</ScaleFIdB>

Useful attributes to know are isRef, prec, refOp, and deid. A useful element to know is ref.

Scaling by Offset Constant (A)

The following example references the data group element raw61 and applies a constant scale offset of "5" to it. The result is 66 because 61 is added to the offset 5.

<ScaleOA desc="Scale Offset Constant Method A" readOnly="true" type="ui2" ref="raw61" scaleOffset="5"/>

Useful attributes to know are ref and scaleOffset.

Scaling by Offset Constant (B)

The following example uses two child elements to compute a scaled value. The first child element references the operation opAssignId and the data group element raw61 to assign the current value of raw61 as the initial value for ScaleOB. The second child element references the opScaleOffset operation and applies a constant scale offset of "5" to the value assigned by the first child element. The result is 66 because 61 is added to the offset 5.

<ScaleOB desc="Scale Offset Constant Method B" readOnly="true" type="ui2" isRef="1">

<ref prec="0" refOp="opAssignId" deid="raw61"/>

<ref prec="1" refOp="opScaleOffset" scaleOffset="5"/>

</ScaleOB>

Useful attributes to know are isRef, prec, refOp, deid, and scaleOffset. A useful element to know is ref.

Scaling by Offset Data Group Element (A)

The following example references the data group element raw61 and applies a scale offset from raw5 to it. The result is 66 because 61 is added to the offset 5.

<ScaleOIdA desc="Scale Offset DEID Method A" readOnly="true" type="ui2" ref="raw61" scaleOffsetId="raw5"/>

Useful attributes to know are ref and scaleOffsetId.

Scaling by Offset Data Group Element (B)

The following example uses two child elements to compute a scaled value. The first child element references the operation opAssignId and the data group element raw61 to assign the current value of raw61 as the initial value for ScaleOIdB. The second child element references the opScaleOffsetId operation and applies a referenced scale offset from raw5 to the value assigned by the first child element. The result is 66 because 61 is added to the offset 5.

<ScaleOIdB desc="Scale Offset ID Method B" readOnly="true" type="ui2" isRef="1">

<ref prec="0" refOp="opAssignId" deid="raw61"/>

<ref prec="1" refOp="opScaleOffsetId" deid="raw5"/>

</ScaleOIdB>

Useful attributes to know are isRef, prec, refOp, and deid. A useful element to know is ref.

Back to top

Let us know how we can improve this topic.

CygNet at weatherford.com

© 2020 Weatherford. All rights reserved.