Professional Documents
Culture Documents
P YTHON M ODULE —
C ONVERSION F UNCTION
D OCUMENTATION
Version 6.0
Disclaimer of Warranties and Liability
The information contained in this manual is believed to be accurate and reliable. However, GE Intelligent Platforms, Inc.
assumes no responsibilities for any errors, omissions or inaccuracies whatsoever. Without limiting the foregoing, GE
Intelligent Platforms, Inc. disclaims any and all warranties, expressed or implied, including the warranty of merchantability
and fitness for a particular purpose, with respect to the information contained in this manual and the equipment or software
described herein. The entire risk as to the quality and performance of such information, equipment and software, is upon the
buyer or user. GE Intelligent Platforms, Inc. shall not be liable for any damages, including special or consequential damages,
arising out of the use of such information, equipment and software, even if GE Intelligent Platforms, Inc. has been advised
in advance of the possibility of such damages. The use of the information contained in the manual and the software
described herein is subject to GE Intelligent Platforms, Inc. standard license agreement, which must be executed by the
buyer or user before the use of such information, equipment or software.
Trademark Notices
All other product names and marks identified throughout this book are trademarks or registered trademarks of their respective
companies. They are used throughout this book in editorial fashion only. No such use, or the use of any trade name, is
intended to convey endorsement or affiliation.
No part of this publication may be reproduced in any form, or stored in a database or retrieval system, or transmitted or
distributed in any form by any means, electronic, mechanical photocopying, recording or otherwise, without the prior written
permission of GE Intelligent Platforms. Information contained herein is subject to change without notice.
We want to hear from you. If you have any comments, questions, or suggestions about our documentation, send them to the
following email address:
doc@ge.com
Table of Contents
Table of Contents
Introduction _____________________________________________________________ 1
Document Coverage ........................................................................................................................1
Available Objects _________________________________________________________ 2
Conversion Functions ______________________________________________________ 3
Generic Function Structure ............................................................................................................3
Signature and Parameters ........................................................................................................3
Return Value ..............................................................................................................................3
Example ......................................................................................................................................3
Electric Current Conversion ...........................................................................................................3
Electric Current Conversion Functions ................................................................................3
Units ............................................................................................................................................4
Example for Conversion of Electric Current .......................................................................4
Electric Potential Conversion .........................................................................................................4
Electric Potential Conversion Functions ..............................................................................4
Units ............................................................................................................................................4
Example for Conversion of Electric Potential .....................................................................5
Mass Flow Rate Conversion ...........................................................................................................5
Mass Flow Rate Conversion Functions.................................................................................5
Units ............................................................................................................................................6
Example for Conversion of Mass Flow Rate .......................................................................7
Volume Flow Rate Conversion ......................................................................................................7
Volume Flow Rate Conversion Functions ...........................................................................7
Units ............................................................................................................................................9
Example for Conversion of Volume Flow Rate ..................................................................11
Frequency Conversion .....................................................................................................................11
Frequency Conversion Functions ..........................................................................................11
Units ............................................................................................................................................11
Example for Conversion of Frequency .................................................................................11
Length Conversion ...........................................................................................................................12
Length Conversion Functions ................................................................................................12
Units ............................................................................................................................................12
Example for Conversion of Length .......................................................................................12
Mass Conversion ..............................................................................................................................13
Mass Conversion Functions ....................................................................................................13
Units ............................................................................................................................................13
Example for Conversion of Mass ..........................................................................................13
Power Conversion ............................................................................................................................14
Power Conversion Functions .................................................................................................14
Units ............................................................................................................................................14
Example for Conversion of Power ........................................................................................15
i
Table of Contents
ii
Introduction
Introduction
The Unit of Measure (“uom”) Python Module is a collection of Python classes and utility functions
for converting a value from one unit of measure to another.
Conversion functions
o These functions convert a value from one unit of measure to another.
Enumeration classes
o These classes (such as the Mass class or the Temperature class) enumerate
properties (such as Kilograms or Celsius) representing units of measure for a
particular physical quantity.
o The properties enumerated in those classes are used by the conversion functions in
the uom module.
Document Coverage
This document covers the following:
1
Available Objects
Available Objects
The Unit of Measure (“uom”) Python Module has been originally designed for use in either Proficy
Historian or the Proficy Historian Analysis (PHA) suite. The module does not have to be used in
these contexts. However, if you are using it in one of these contexts, then this section will be
helpful to you.
This boolean indicates whether or not the quality of the sample is good.
o is_quality_bad
This boolean indicates whether or not the quality of the sample is bad.
o timestamp
You can use the conversion functions in the uom Python Module to convert the value of the value
property of a TagSample object, provided that the value property is a float or easily evaluates to
one.
For example, if your values represent temperatures in degrees Celsius and you want to convert the
representation to degrees Fahrenheit, then you can use a function from the uom module to do it in
the following way:
uom.to_Fahrenheit(ExhaustTemperature.value, uom.Temperature.Celsius)
for a declared TagSample instance “ExhaustTemperature”. See the to_Fahrenheit function and the
applicable properties of the Temperature class in the Temperature Conversion section of this
document for further details.
Consult the Historian or PHA documentation for details on the use of TagSample objects.
2
Conversion Functions
Conversion Functions
Generic Function Structure
Signature and Parameters
The function signatures in the uom module are all of the form:
uom.to_<toUnit>(value, fromUnit)
where:
Return Value
Each such function returns a float representation of the value passed in, converted to the requested
new unit of measure.
Example
uom.to_Amps(100,ElectricCurrent.Milliamps)
where
<toUnit> is “Amps”
value is 100
fromUnit is ElectricCurrent.Milliamps (where the ElectricCurrent class enumerates )
This returns a float value of 0.1.
3
Conversion Functions
Units
Electric current units are represented by the following properties of the ElectricCurrent
enumeration class:
Property Meaning
Amps Amps
Kiloamps Kiloamps
Milliamps Milliamps
Use Case
The user wants to convert an electric current value of 200 milliamps to amps.
Expression
uom.to_Amps(200, uom.ElectricCurrent.Milliamps)
Result
0.2
Units
Property Meaning
Kilovolts Kilovolts
Millivolts Millivolts
4
Conversion Functions
Property Meaning
Volts Volts
Use Case
The user wants to convert an electric potential value of 150 volts to kilovolts.
Expression
uom.to_Kilovolts(150, uom.ElectricPotential.Volts)
Result
0.15
5
Conversion Functions
Units
Mass flow rate units are represented by the following properties of the FlowRateMass enumeration
class:
Property Meaning
kgPerDay Kilograms per day
kgPerHour Kilograms per hour
kgPerMinute Kilograms per minute
kgPerSecond Kilograms per second
MetricTonPerDay Metric ton per day
MetricTonPerHour Metric ton per hour
MetricTonPerMinute Metric ton per minute
MetricTonPerSecond Metric ton per second
LBMPerDay Pound per day
LBMPerHour Pound per hour
LBMPerMinute Pound per minute
LBMPerSecond Pound per second
kLBMPerDay Kilopound per day
kLBMPerHour Kilopound per hour
kLBMPerMinute Kilopound per minute
kLBMPerSecond Kilopound per second
MLBMPerDay Megapound per day
MLBMPerHour Megapound per hour
MLBMPerMinute Megapound per minute
6
Conversion Functions
Property Meaning
MLBMPerSecond Megapound per second
Use Case
The user wants to convert a mass flow rate value of 2.5 metric ton per minute to kilograms of mass
per day.
Expression
uom.to_KilogramsOfMassPerDay(2.5, uom.FlowRateMass.MetricTonPerMinute)
Result
3599999.999999999
7
Conversion Functions
8
Conversion Functions
Units
Volume flow rate units are represented by the following properties of the FlowRateVolume
enumeration class:
Property Meaning
BBD Barrels of oil per day
BBH Barrels of oil per hour
BBM Barrels of oil per minute
BBS Barrels of oil per second
kBBD Thousands of barrels of oil per day
kBBH Thousands of barrels of oil per hour
kBBM Thousands of barrels of oil per minute
kBBS Thousands of barrels of oil per second
MBBD Millions of barrels of oil per day
MBBH Millions of barrels of oil per hour
MBBM Millions of barrels of oil per minute
MBBS Millions of barrels of oil per second
GPD Gallons per day
GPH Gallons per hour
GPM Gallons per minute
GPS Gallons per second
9
Conversion Functions
Property Meaning
LPD Liters per day
LPH Liters per hour
LPM Liters per minute
LPS Liters per second
in3PerDay Cubic inches per day
in3PerHour Cubic inches per hour
in3PerMinute Cubic inches per minute
in3PerSecond Cubic inches per second
CFD Cubic feet per day
CFH Cubic feet per hour
CFM Cubic feet per minute
CFS Cubic feet per second
kCFD Thousands of cubic feet per day
kCFH Thousands of cubic feet per hour
kCFM Thousands of cubic feet per minute
kCFS Thousands of cubic feet per second
MCFD Millions of cubic feet per day
MCFH Millions of cubic feet per hour
MCFM Millions of cubic feet per minute
MCFS Millions of cubic feet per second
ccPerDay Cubic centimeters per day
ccPerHour Cubic centimeters per hour
ccPerMinute Cubic centimeters per minute
ccPerSecond Cubic centimeters per second
m3PerDay Cubic meters per day
m3PerHour Cubic meters per hour
m3PerMinute Cubic meters per minute
m3PerSecond Cubic meters per second
ThousandsOfCubicMetersPerDay Thousands of cubic meters per day
ThousandsOfCubicMetersPerHour Thousands of cubic meters per hour
ThousandsOfCubicMetersPerMinute Thousands of cubic meters per minute
ThousandsOfCubicMetersPerSecond Thousands of cubic meters per second
MillionsOfCubicMetersPerDay Millions of cubic meters per day
MillionsOfCubicMetersPerHour Millions of cubic meters per hour
MillionsOfCubicMetersPerMinute Millions of cubic meters per minute
MillionsOfCubicMetersPerSecond Millions of cubic meters per second
10
Conversion Functions
Use Case
The user wants to convert a volume flow rate value of 70 thousands of barrels of oil per minute to
barrels of oil per day.
Expression
uom.to_BarrelsOfOilPerDay(2.5, uom.FlowRateVolume.kBBM)
Result
3599999.9999999963
Frequency Conversion
Conversion from one unit of measure of frequency to another can be done with these functions
from the uom module.
Units
Frequency units are represented by the following properties of the Frequency enumeration class:
Property Meaning
CPM Cycles per minute
CPS Cycles per second
Hertz Hertz
RPM Revolutions per minute
Use Case
The user wants to convert a frequency value of 5000 revolutions per minute to hertz.
11
Conversion Functions
Expression
uom.to_Hertz(5000, uom.Frequency.RPM)
Result
83.33333333333333
Length Conversion
Conversion from one unit of measure of length to another can be done with these functions from
the uom module.
Units
Length units are represented by the following properties of the Length enumeration class:
Property Meaning
cm Centimeters
ft Feet
In Inches
m Meters
mils Milliinches
mm Millimeters
um Micrometers
Use Case
12
Conversion Functions
Expression
uom.to_Feet(800, uom.Length.In)
Result
63.166666666666664
Mass Conversion
Conversion from one unit of measure of mass to another can be done with these functions from the
uom module.
Units
Mass units are represented by the following properties of the Mass enumeration class:
Property Meaning
Kilograms Kilogram
Kilopounds Kilopound
Pounds Pound
Use Case
Expression
uom.to_Kilograms(100, uom.Mass.Pounds)
Result
45.359236999999915
13
Conversion Functions
Power Conversion
Conversion from one unit of measure of power to another can be done with these functions from
the uom module.
Units
Power units are represented by the following properties of the Power enumeration class:
Property Meaning
BTU per hour, where
BTUPerHour
BTU = British Thermal Unit
MBTUPerHR Millions of BTU per hour
HP Horsepower
W Watt
kW Kilowatt
MW Megawatt
NmPerSecond Newton meters per second
Millivar Millivar
Var Var
Kilovar Kilovar
Megavar Megavar
14
Conversion Functions
Use Case
Expression
uom.to_Horsepower(350, uom.Power.W)
Result
0.4693577313582599
Pressure Conversion
Conversion from one unit of measure of pressure to another can be done with these functions from
the uom module.
15
Conversion Functions
Units
Pressure units are represented by the following properties of the Pressure enumeration class:
Property Meaning
Atm Standard atmosphere
Bar Bar
BarG Bar - gauge
mBar Millibar
mBarG Millibar - gauge
uPa Micropascal
milliPa Millipascal
cPa Centipascal
dPa Decipascal
Pa Pascal
daPa Decapascals
hPa Hectopascal
KPa Kilopascal
MPa Megapascal
ftH2O Feet of H2O
ftH2OG Feet of H2O - gauge
inH2O Inches of H2O
inH2OG Inches of H2O - gauge
mmH2O Millimeters of H2O
mmH2OG Millimeters of H2O - gauge
inHg Inches of mercury
inHgG Inches of mercury - gauge
mmHg Millimeters of mercury
16
Conversion Functions
Property Meaning
mmHgG Millimeters of mercury - gauge
Kilograms per square centimeter -
KilogramsPerSquareCentimeterAbsolute
absolute
KilogramsPerSquareCentimeterGauge Kilograms per square centimeter - gauge
PSIA Pounds per square inch - absolute
PSIG Pounds per square inch - gauge
Torr Torr
Use Case
Expression
uom.to_Torrs(2.5, uom.Pressure.Atm)
Result
1899.9999738262197
Speed Conversion
Conversion from one unit of measure of speed to another can be done with these functions from the
uom module.
Units
Speed units are represented by the following properties of the Speed enumeration class:
17
Conversion Functions
Property Meaning
FPM Feet per minute
FeetPerSecond Feet per second
IPS Inches per second
MPM Miles per minute
MetersPerSecond Meters per second
MillimetersPerSecond Millimeters per second
MicrometersPerSecond Micrometers per second
Use Case
The user wants to convert a speed value of 20 feet per second to inches per second.
Expression
uom.to_InchesPerSecond(20, uom.Speed.FeetPerSecond)
Result
240
Temperature Conversion
Conversion from one unit of measure of temperature to another can be done with these functions
from the uom module.
Units
Temperature units are represented by the following properties of the Temperature enumeration
class:
Property Meaning
Celsius Celsius
18
Conversion Functions
Property Meaning
Fahrenheit Fahrenheit
Kelvin Kelvin
Rankine Rankine
Use Case
Expression
uom.to_Fahrenheit(25, uom.Temperature.Celsius)
Result
76.99999999999949
Time Conversion
Conversion from one unit of measure of time to another can be done with these functions from the
uom module.
Units
Time units are represented by the following properties of the Time enumeration class:
Property Meaning
Years Years
Days Days
Hours Hours
Minutes Minutes
Seconds Seconds
19
Conversion Functions
Use Case
Expression
uom.to_Days(1.5, uom.Time.Years)
Result
547.86375
Torque Conversion
Conversion from one unit of measure of torque to another can be done with these functions from
the uom module.
Units
Torque units are represented by the following properties of the Torque enumeration class:
Property Meaning
FtLBF Foot pounds of force
Nm Newton meters
20
Conversion Functions
Use Case
The user wants to convert a torque value of 100 foot pounds of force to newton meters.
Expression
uom.to_NewtonMeters(100, uom.Torque.FtLBF)
Result
135.5817948331401
21