felib.aga3 class

The aga3 performs the calculation of the:

 

1.      mass flow-rate [kg/s]

2.      volume flow rate at base conditions [m3/s]

3.      volume flow rate at flowing conditions [m3/s]

4.      coefficient of discharge

5.      expansion factor

6.      velocity of approach factor

7.      pipe Reynolds number

8.      orifice bore diameter at flowing conditions [m]

9.      meter tube internal diameter at flowing conditions [m]

10.   beta ratio at flowing conditions

 

in accordance with:

AGA Report No. 3: Orifice metering of natural gas and other related hydrocarbon fluids
Part1: General equations and uncertainty guidelines, American Gas Association and American Petroleum Institute.

Table 1: Description of the aga3 class interface: properties (variables), method (function) and error flags.

PROPERTIES

DESCRIPTION

SET PROPERTY VALUE

GET PROPERTY VALUE

Position of pressure tap:
0 - upstream
1 - downstream

void SetPositionOfPressureTap (short int newValue)

short int GetPositionOfPressureTap()

Static pressure [Pa]
(0 to 1.0E+9) at either up- or down-stream tap

void SetFlowingPressure(double newValue)

double GetFlowingPressure()

Local barometric pressure [Pa]
(0.1 to 2.0E+5) at either up- or down-stream tap

void SetLocalBarometricPressure(double newValue)

double GetLocalBarometricPressure()

Temperature [K]
(0 to 10000)

void SetTemperature(double newValue)

double GetTemperatureC()

Differential pressure [Pa]
(0 to 0.3*Pf-upstream)

void SetDifferentialPressure(double newValue)

double GetDifferentialPressure()

Reference temperature at which meter tube internal diameter is measured [K] (223.15 to 373.15)

void SetTempAtWhichTubeDiaWasMeasured (double newValue)

double GetTempAtWhichTubeDiaWasMeasured ()

Meter tube internal diameter at reference temperature [m] (0.04 Pd 1000)

void SetTubeDiameterAtRefCond (double newValue)

double GetTubeDiameterAtRefCond()

Linear coefficient of thermal expansion of the meter tube material [m/m-K] (0 to 0.1)

void SetTubeMaterialCoeffOfExpansion (double newValue)

double GetTubeMaterialCoeffOfExpansion()

Reference temperature at which orifice plate bore diameter is measured [K] (223.15 to 373.15)

void SetTempAtWhichOrifDiaWasMeasured (double newValue)

double GetTempAtWhichOrifDiaWasMeasured()

Orifice bore diameter at reference temperature [m] (0.05* Pd Od 0.75* Pd)

void SetOrificeDiameterAtRefCond (double newValue)

double GetOrificeDiameterAtRefCond()

Linear coefficient of thermal expansion of the orifice plate material [m/m-K] (0 to 0.1)

void SetOrificePlateCoefOfExpansion (double newValue)

double GetOrificePlateCoefOfExpansion()

Density [kg/m3]
(0.000001 to 10000)

void SetFluidDensity(double newValue)

double GetFluidDensity()

Base Density [kg/m3]
(0.000001 to 10000)

void SetFluidBaseDensity(double newValue)

double GetFluidBaseDensity()

Viscosity [Pa*s]
(0.0 to 10)

void SetFluidDynamicViscosity(double newValue)

double GetFluidDynamicViscosity()

Isentropic exponent
(0.1 to 2000); k=-1 for liquids

void SetIsentropicExponent(double newValue)

double GetIsentropicExponent()

Mass flow-rate [kg/s]

-

double GetMassFlowRate()

Volume flow rate at flowing conditions [m3/s]

-

double GetVolumeFlowRateAtFlowingCond()

Volume flow rate at base conditions [m3/s]

-

double GetVolumeFlowRateAtBaseCond()

Coefficient of discharge

-

double GetCoefficientOfDischarge()

Expansion factor

-

double GetExpansionFactor()

Velocity of approach factor

-

double GetVelocityOfApproachFactor()

Pipe Reynolds number

-

double GetPipeReynoldsNumber()

Orifice bore diameter at flowing conditions [m]

-

double GetOrificeDiameterAtFlowCond()

Meter tube internal diameter at reference temperature [m] (0.04 Pd 1000)

void SetTubeDiameterAtRefCond (double newValue)

double GetTubeDiameterAtRefCond()

Beta ratio at flowing temperature (0.05 to 0.75)

-

double GetBetaRatioAtFlowingTemperature ()

Protection key

void SetKeyCode(long int newValue)

-

Error status

-

long int GetErrorFlag()

METHOD

Flow-rate calculation

long int CalculateAga3(): calculates mass flow-rate, volume flow rate at base and flowing conditions, coefficient of discharge, expansion factor, velocity of approach factor, Pipe Reynolds number, orifice bore and meter tube diameter at flowing conditions, beta ratio at flowing conditions and returns long int representing error status. All the remaining properties must be set before calling the method.

ERROR STATUS

Error status bits are cleared or set upon the completion of any of the above methods, as follows

Bit 0 =1 (1H)

If pressure <0.0 Pa or >1000 MPa, else =0.

Bit 1 =1 (2H)

If temperature <0 K or >10000 K, else =0.

Bit 2 =1 (4H)

If differential pressure <0 Pa or >0.3* Pf_upstream Pa, else =0.

Bit 3 =1 (8H)

If local barometric pressure <0 MPa or >0.2 Mpa, else =0.

Bit 4 =1 (10H)

If meter tube internal diameter <40 mm or >1000 mm, else =0.

Bit 5 =1 (20H)

If temperature at which meter tube internal diameter was measured <223.15 K or >373.15 K, else =0.

Bit 6 =1 (40H)

If linear coefficient of thermal expansion of the meter tube material <0 m/m-K or >0.01 m/m-K, else =0.

Bit 7 =1 (80H)

If orifice bore diameter <4mm or >0.75*Pd, else =0.

Bit 8 =1 (100H)

If temperature at which orifice plate bore diameter was measured <223.15 K or >373.15 K, else =0.

Bit 9 =1 (200H)

If linear coefficient of thermal expansion of the orifice plate material <0 m/m-K or >0.01 m/m-K, else =0.

Bit 10 =1 (400H)

If flowing or base density <0.000001 kg/m3 or >10000 kg/m3, else =0

Bit 11 =1 (800H)

If fluid dynamic viscosity <0 Pa*s or >10 Pa*s, else =0

Bit 12 =1 (1000H)

If isentropic exponent -1 and (<0.1 or >2000), else =0

Bit 13 =1 (2000H)

If Pipe Reynolds number <4000, else=0

Bit 14 =1 (4000H)

If beta ratio <0.05 or >0.75, else=0

Bit 24 =1 (1000000H)

Invalid protection key, else=0.

All other bits = 0

Unused.