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

AF SDK Reference

UOM Class

  • Last UpdatedNov 18, 2025
  • 8 minute read
UOM Class
The unit-of-measure object describes the units of a value.

Inheritance Hierarchy

SystemObject
  OSIsoft.AFAFObject
    OSIsoft.AF.UnitsOfMeasureUOM

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

Syntax

[SerializableAttribute]
public sealed class UOM : AFObject, IComparable<UOM>
<SerializableAttribute>
Public NotInheritable Class UOM
	Inherits AFObject
	Implements IComparable(Of UOM)

Dim instance As UOM
[SerializableAttribute]
public ref class UOM sealed : public AFObject, 
	IComparable<UOM^>
[<SealedAttribute>]
[<SerializableAttribute>]
type UOM =  
    class
        inherit AFObject
        interface IComparable<UOM>
    end

The UOM type exposes the following members.

Properties

  NameDescription
Public property
Abbreviation
This property provides a unique abbreviation for the unit of measure.
Public property
Class
This read-only property indicates the class of measurement for this unit of measure.
Public property
Database
This read-only property allows access to the UOMDatabase associated with this object.
Public property
DayBasedTimeIntegralUOM
Returns the UOM that corresponds to the day-based time integral of this UOM or if none is defined.
Public property
DeltaUOM
The UOM that corresponds to the difference in two quantities in this UOM.
Public property
Description
Read/write property that provides a more detailed description of the object.
Public property
Factor
This read-only property provides the conversion factor to the canonical unit for this unit of measure.
Public property
ID
Read-only property that provides a unique identifier for the object to be used for quick access that is not dependent upon the index.
(Inherited from AFObject.)
Public property
Identity
This read-only property contains identity of the object.
(Inherited from AFObject.)
Public property
IsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public property
Name
Read/write property that identifies the name of the object.
Public property
Offset
This read-only property provides the conversion offset to the canonical unit for this unit of measure.
Public property
Origin
This read-only property indicates the origin of this unit of measure.
Public property
PISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public property
RefFactor
This property provides the conversion factor to the reference unit of measure for this unit of measure.
Public property
RefFormulaFrom
This property provides the formula to convert from the reference unit of measure to this unit of measure.
Public property
RefFormulaTo
This property provides the formula to convert to the reference unit of measure from this unit of measure.
Public property
RefOffset
This property provides the conversion offset to the reference unit of measure for this unit of measure.
Public property
RefUOM
This property indicates the reference unit of measure for this unit of measure.
Public property
TimeIntegralUOM
The UOM that corresponds to the time integral of this UOM.
Public property
UniqueID
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.)

Methods

  NameDescription
Public method
CompareTo(Object)
Compares this instance with a specified Object.
(Inherited from AFObject.)
Public method
CompareTo(AFObject)
Compares this instance with a specified AFObject.
(Inherited from AFObject.)
Public method
Convert
This method converts the specified value from the specified unit of measure (UOM) to the UOM represented by this object.
Public method
Equals(Object)
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.)
Public method
Equals(AFObject)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.)
Public methodStatic member
FindUOMs
Performs a non-paged text search within the UOMDatabase to retrieve a collection of UOM objects which have a field that match the specified query string.
Public method
GetGroupMapping
Gets the mapped UOM defined by a UOMGroup for the current UOM.
Public method
GetHashCode
Gets the hash code for this instance of the object which is suitable for use in hashing algorithms and data structures like a hash table.
(Inherited from AFObject.)
Public method
GetPath
Returns the full path to the object, using just the names.
(Inherited from AFObject.)
Public method
GetPath(AFObject)
Returns the path to the object relative from another object.
(Inherited from AFObject.)
Public method
GetPath(AFEncodeType, AFObject)
Returns the path to the object relative from another object, using the name and/or id as specified by encodeType.
(Inherited from AFObject.)
Public method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public method
Persist
This method returns the persistence string for the object.
(Inherited from AFObject.)
Public method
ToString
Returns a String that represents the current object.
(Inherited from AFObject.)
Public method
Update
This method updates the conversion factors for this unit of measure (UOM).
Public methodCode example
UpdateFormula
This method updates the conversion formulas for this unit of measure (UOM).

Remarks

The unit-of-measure (UOM) object describes the units of a value. The UOM also contains information needed to convert one unit to another unit.

Examples

// This example will create several UOMs of the same UOM class
// and then demonstrate how to perform conversions between them.

// Get the Database
PISystems myPISystems = new PISystems();
UOMDatabase myDB = myPISystems.DefaultPISystem.UOMDatabase;

// Set the UOM Class
UOMClass LengthUOMClass = myDB.UOMClasses.Add("QALength", "QAmeter", "QAm");

// Create UOMs
UOM Meter = myDB.UOMs["QAmeter"];
UOM Inch = myDB.UOMs.Add("QAinch", "QAin", Meter, 0.0254, 0);
UOM Foot = myDB.UOMs.Add("QAfoot", "QAft", Inch, 12, 0);
UOM Yard = myDB.UOMs.Add("QAyard", "QAyd", Inch, 3 * 12, 0);
UOM Mile = myDB.UOMs.Add("QAmile", "QAmi", Foot, 5280, 0);

// Display Information each UOM
foreach (UOM CurUom in myDB.UOMClasses["QALength"].UOMs)
{
    Console.WriteLine("Name of UOM = {0}", CurUom.Name);
    Console.WriteLine("Abbreviation = {0}", CurUom.Abbreviation);
}

// Convert 18 Inches to Feet
Console.WriteLine("18 Inches converted to Feet = {0}", Foot.Convert(18, Inch));

// Update the Formula for the Yard UOM
Yard.Update(Foot, 3.0, 0);

// Convert 18 Inches to Yards
Console.WriteLine("18 Inches converted to Yards = {0}", Yard.Convert(18, Inch));
' This example will create several UOMs of the same UOM class
' and then demonstrate how to perform conversions between them.

' Get the Database
Dim myPISystems As New PISystems
Dim myDB As UOMDatabase = myPISystems.DefaultPISystem.UOMDatabase

' Set the UOM Class
Dim LengthUOMClass As UOMClass = myDB.UOMClasses.Add("QALength", "QAmeter", "QAm")

' Create UOMs
Dim Meter As UOM = myDB.UOMs("QAmeter")
Dim Inch As UOM = myDB.UOMs.Add("QAinch", "QAin", Meter, 0.0254, 0)
Dim Foot As UOM = myDB.UOMs.Add("QAfoot", "QAft", Inch, 12.0#, 0)
Dim Yard As UOM = myDB.UOMs.Add("QAyard", "QAyd", Inch, 3.0# * 12.0#, 0)
Dim Mile As UOM = myDB.UOMs.Add("QAmile", "QAmi", Foot, 5280.0#, 0)

' Display Information each UOM
Dim CurUOM As UOM
For Each CurUOM In myDB.UOMClasses("QALength").UOMs
    Console.WriteLine("Name of UOM = {0}", CurUOM.Name)
    Console.WriteLine("Abbreviation = {0}", CurUOM.Abbreviation)
Next CurUOM

' Convert 18 Inches to Feet
Console.WriteLine("18 Inches converted to Feet = {0}", Foot.Convert(18, Inch))

' Update the Formula for the Yard UOM
Yard.Update(Foot, 3.0#, 0)

' Convert 18 Inches to Yards
Console.WriteLine("18 Inches converted to Yards = {0}", Yard.Convert(18, Inch))

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

Version Information

AFSDK


See Also

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