Professional Documents
Culture Documents
Api 2540
Api 2540
Implementation OF API2540
In OMAR-LGx Flow Computer
Conversion of Hydrocarbon Liquids to Net Volumes at Reference Conditions
1.0 INTRODUCTION
The following describes the means and methods used for measurement of Hydrocarbon
Liquids on the Allen Bradley PLC-5 platform using the OMAR-LGx Flow Computer Software by
Octal Systems Inc.
The OMAR-LGx Flow Measurement package developed by Octal Systems Inc. of Calgary,
Alberta has been designed to run in the Allen Bradley 1771 DMC Coprocessor under the
Microware OS-9 multitasking Operating System environment. The software package has
been coded in the 'C programming language. It is compiled to a binary format in the native
Motorola MC6800 machine language code before downloading to the Coprocessor. The
executable file as it runs in the Coprocessor is inaccessible to the PLC user or programmer,
and hence no unauthorized changes can be made to this code.
The DMC 1771 is a high performance 32 bit state of the art Coprocessor that is capable of
high precision mathematical calculations equal to or better than any Flow Computer
available at this time. When used with a suitable PLC5 processor, it provides a reliable and
flexible platform for liquids measurement applications.
The OMAR-LGx Software designed for measurement of Hydrocarbon liquids is capable of two
types of measurements.
I - The GPA 8173 Standard for converting Mass of Natural Gas Liquids and Vapours to
Equivalent Liquid Volumes. (Value of physical constants as per GPA Standard 2145).
2 - The API 2540 standard for Hydrocarbon Liquids flow measurement with density from 500
kg/m3 to 1075 kg/m3. The calculation supports the complete density range by
implementation of the full API Tables (Table 23/53 for density correction and Table 24/54 for
Ctl computation) in the Coprocessor.
3 – The AGA3, AGA7 and AGA8 standards for the measurement of Hydrocarbon fluids.
The PLC I/O modules serve as an interface to the liquid flow process. The following line
conditions are monitored by the PLC:
- Line Temperature
- Line Pressure
- Line Density
- Flow Meter pulses
- Differential Pressure (Orifice)
The above process conditions are sampled by the PLC on a continuous basis and made
available to the Coprocessor for the API 2540 calculations.
The measurement process may be broken down into four main stages described below.
Depending on the value of the Line Density, appropriate subroutines are selected to carry out
the Density correction. If the Line Density is between 500 kg./ou.m and 610 kg./cu.rn, the
API Table 23A/53A is used to look up the density at 15 Deg.C.
If the Line Density is greater than 610 kg./cu.m but less than 1075 kglcu.m, then the API
algorithms are used to reference the density to 15 Deg.C. The subroutine adheres strictly to
the API standard ensuring that the calculations are done within the density and temperature
constraints specified by the standard. If these constraints are violated by the process inputs,
the measurement subroutines are designed to annunciate this condition and use default
values.
• Note: The logic of the OMAR Measurement system allows the user to input density
already referenced to 15 Deg.C (instead of the density at flowing conditions). When this
is done, Stage I is completely bypassed by the Coprocessor logic.
Two process input variables are required by the API Standard (Table 54/24) for generating the
Volume Correction Factor Ctl:
The subroutines utilize table look up for product density between 500 kg/cu.m and 610
kg/cu.m. For densities higher than 610 kg/cu.m and less than 1075 kg/cu.m, algorithms are
used within the API specified temperature and density constraints. If the process conditions fall
outside of these constraints, then this condition is annunciated and a user defined default
numeric value is used for Ctl.
Note 1: The OMAR measurement system logic allows the user to bypass the Ctl
calculation entirely and utilize a user defined default numeric value for Ctl.
In order to calculate the Compressibility factor, the algorithms require the following input variables:
- Line Temperature
- Line pressure
- Equilibrium Vapour Pressure (Note 2)
- Density corrected to 15 Deg C / 60 Deg F
The algorithm adheres strictly to the API Standard to ensure that all the specified constraints
are implemented. Provided the corrected input density is between 350 kg/cu.m and 1047
kg/cu.m, the measurement routines calculate a value for the compressibility factor Cpl. If any
of the specified limits are violated, this condition is annunciated and a user defined default
numeric value for Cpl is used in the calculations.
• Note 1: The OMAR measurement system logic allows the user to bypass the Cpl
calculation entirely and use a fixed numeric value of 1.
• Note 2: The system software allows for the automatic calculation of the product
Equilibrium Vapour Pressure per the GPA-TP15 technical paper (A simplified Vapour
Pressure Correlation for Commercial NGLs. See OCTAL Information Abstract IA004-
V9509.)
The OMAR measurement system software running in the Coprocessor can monitor
incremental flowing product volume at every program scan in two possible ways:
If the application involves use of a pulse input device (turbine meter, vortex meter, positive
displacement meter etc.) the Coprocessor uses the PLC I/0 resources (pulse input card) to
track the number of pulses being received at every program scan. This information is used to
calculate the incremental volume for the previous scan as follows:
Where:
UVgrs : Incremental Gross Volume
UPulses : Incremental Number of Meter Pulses
MKF : Meter Base K Factor (pulses per unit volume)
MCF : Meter Correction Factor
Where:
• Note: The OMAR measurement system includes the facility to characterize the Meter Base
K Factor relative to the measured flow rate of the product using the Lagrange or the Linear
Curve Fit method. The user may use or bypass this option on a per meter basis. ( See
OCTAL Information Abstract IA005-9505)
If the application involves use of a differential producer device (orifice plate, pitot tube etc.)
the Coprocessor uses the PLC I/O resources (analog input card) to sample the differential
pressure and the static line pressure at every program scan. At the same time the program
also tracks the time interval since the previous program scan. This information is used to
calculate the instantaneous product flowrate (per AGA 3 Report) as follows:
Where:
Qhg : Product Gross Flow Rate (Unit Volume per hour)
C’ : 'Me measurement device constant
Hw : Differential Pressure
Density : Line Density
UVgrs = (Qgh/3600) * UT
Where:
UT : Time interval for the previous program scan (seconds)
The net incremental product volume per program scan is calculated as follows:
Where:
UVnet : incremental Net Volume
Where:
The incremental mass is calculated from incremental net volume and the product density
referenced to 15 Deg.C as follows:
Where:
UMass : Incremental product mass
Denl5C : Product density corrected to 15 Deg.C
Where:
• Note: Alternate method for calculating product mass uses Gross Volume and Flowing Density
APPENDIX A