Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

UOM.Convert Method

  • Last UpdatedNov 18, 2025
  • 3 minute read
UOM.Convert Method
This method converts the specified value from the specified unit of measure (UOM) to the UOM represented by this object.

Namespace:  OSIsoft.AF.UnitsOfMeasure
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public double Convert(
	Object fromValue,
	UOM fromUOM
)
Public Function Convert ( 
	fromValue As Object,
	fromUOM As UOM
) As Double

Dim instance As UOM
Dim fromValue As Object
Dim fromUOM As UOM
Dim returnValue As Double

returnValue = instance.Convert(fromValue, 
	fromUOM)
public:
double Convert(
	Object^ fromValue, 
	UOM^ fromUOM
)
member Convert : 
        fromValue : Object * 
        fromUOM : UOM -> float 

Parameters

fromValue
Type: SystemObject
The value to be converted. Normally, this is sent as a double.
fromUOM
Type: OSIsoft.AF.UnitsOfMeasureUOM
The unit of measure of the specified value. If this is not specified, or is specified, then the unit of measure should be specified in the fromValue by passing it as a string.

Return Value

Type: Double
Returns the value converted to this unit of measure.

Exceptions

ExceptionCondition
InvalidCastException Thrown when the conversion cannot be performed.

Remarks

The UOM class for the specified parameter must match the class for this UOM. If the two UOMs share the same reference object, or are a direct reference to each other, then the conversion is done directly using these reference units. This allows fewer mathematical operations and reduces the loss of precision during conversion. Otherwise, the canonical unit-of-measure factors are used to convert.

Optionally, you can specify for the fromUOM parameter and specify the units in the input parameter if it is represented in string notation. For example, "100.0 ft". In this case, the Convert function looks up the UOM from the text name or abbreviation that follows the floating point number.

Version Information

AFSDK


See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in