UOMs.Add Method (String, String, UOM, Double, Double)
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
The Add method creates a new object and adds it to the collection.
Namespace: OSIsoft.AF.UnitsOfMeasure
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public UOM Add( string name, string abbreviation, UOM refUOM, double refFactor, double refOffset )
Public Function Add ( name As String, abbreviation As String, refUOM As UOM, refFactor As Double, refOffset As Double ) As UOM Dim instance As UOMs Dim name As String Dim abbreviation As String Dim refUOM As UOM Dim refFactor As Double Dim refOffset As Double Dim returnValue As UOM returnValue = instance.Add(name, abbreviation, refUOM, refFactor, refOffset)
public: UOM^ Add( String^ name, String^ abbreviation, UOM^ refUOM, double refFactor, double refOffset )
member Add : name : string * abbreviation : string * refUOM : UOM * refFactor : float * refOffset : float -> UOM
Parameters
- name
- Type: SystemString
The name for the new object. The name must be unique within the collection. If the name ends with an asterisk (*), then a unique name will be generated based on the supplied name. See the ValidateName(String, String) method for a description of what is valid when setting the name of the object. - abbreviation
- Type: SystemString
The abbreviation for the new UOM. The abbreviation must be unique within the collection or the same as the name parameter. If not specified (empty or ), the abbreviation defaults to the same as the name. - refUOM
- Type: OSIsoft.AF.UnitsOfMeasureUOM
The reference unit of measure (UOM) for this UOM conversion. This UOM must belong to the same UOM class and not create any circular references. - refFactor
- Type: SystemDouble
The factor to multiply the reference UOM by to obtain this UOM. - refOffset
- Type: SystemDouble
The optional offset to add to the factored reference UOM to obtain this UOM. The default value is 0.
Return Value
Type: UOMReturns the newly created object that was added.
Remarks
This method creates the UOM with the conversion specified. Avoid creating circular references. Enter the conversion factors according to the following formula: [X in this UOM] = [X in Reference UOM] * RefFactor + RefOffset;
The reference UOM must belong to the same UOM class as this UOM. Conversions to the canonical unit for this UOM class are automatically computed.
The canonical UOM for a class cannot be removed without deleting the entire UOMClass that it was created from. It can be updated using the UOM.Update method.