Unit of measure conversion calculation
- Last UpdatedMay 21, 2025
- 2 minute read
- PI System
- PI Server 2024 R2
- PI Server
As a best practice, you should specify UOM conversion calculations with a scaling factor and base offset from the Reference UOM value.
Caution: Conversions that are based on Formula have some limitations as well as impact on performance. You should only select Formula when Simple conversions are inadequate.
Conversion calculation limitations
The following constraints exist with UOM conversion calculations.
|
Conversion type |
Limitations |
|---|---|
|
Factor |
None. |
|
Factor with offset |
For delta conversion calculations, you need to define a separate UOM. See the Temperature (Delta) UOM class for examples. |
|
Formula |
|
UOM formula evaluation
PI AF uses C# for UOM formula evaluation. Follow these guidelines:
-
Write all Units of Measure in terms of the UOM abbreviation. If an abbreviation is not a valid C# variable name, enclose it in brackets.
-
Adhere to C# evaluation rules.
-
You can optionally invoke standard .NET static methods, such as Math.Log10(), to perform the computation. You are limited to what is available in the System Assembly (.NET Framework Math Class).
Formula conversion method example
As an example, watts (W) is the canonical UOM in the Power class. To create a UOM of Decibel-milliwatts (dBm) in the Power class, you could enter the following formula:
W = Math.Pow(10,(dBm - 30)/10)
dBm = 10 * Math.Log10( W ) + 30