Pengukuran Flow Gas (AGA3 & AGA8)
AGA atau American Gas Association adalah sebuah asosiasi yang berkecimpung untuk standard, metode, dan kalkulasi dalam pengukuran Gas. berikut adalah algoritma yang dapat digunakan untuk melakukan perhitungan flow gas yang melewati Orifice.
AGA8 detail, 1992
Given a gas molar analysis, AGA8 detail determines the compressibility of the gas at base conditions and at flowing conditions.
The algorithm for the calculation involves two iterative routines and works as follows:
 Paramdl:
 Arrange calculation parameters to match entered species. Calculation allows for 21 standard components. Paramdl packs the ones that are used into sets of working arrays.
 NOTE: The order of the components appears to be important, as it affects the results returned. Each gas species has an integer ID. These IDs must be processed in ascending numerical order for the result to be correct.
 Chardl:
 Characterises the gas by calculating parameters b1..b18, and various other parameters, in a pair of for loops.
 Normalise component mole fractions (ensure the total = 1.0000)
 for i=1 to (number of entered components)
 Calculate gas mix mole weight = running total of mole fraction[i]*mole weight[i]
 Calculate running total of mole fraction[i]*rki[i]^{2.5}
 Calculate running total of mole fraction[i]*ei[i]^{2.5}
 Calculate running total of mole fraction[i]*wi[i]
 Calculate running total of mole fraction[i]*qi[i]
 Calculate running total of hi[i]*(mole fraction[i])^{2}
 for j = i to (number of entered components)
 This loop calculates interactions between one gas species and another.
 xij = xi[i]*xi[j] (if i <> j, we double this number)
 eij = beij[i][j] * sqrt(ei[i]*ei[j]) : energy interaction param
 s3 = xij*sqrt(rki[i]^{3}*rki[j]^{3})
 calculate b1..b18 as running totals of various polynomials on s3, eij, etc.
 At end of loops, scale b parameters: bi = bi * a[i]
 calculate gas base density;
 calculate base compressibility.
 temp(Tflowing):
 calculate temperature dependent parameters fn[13]..fn[58]
 ddetail(Pflowing, Tflowing):
 Call braket(t, p) to determine a lower and upper limit on the gas density; begin an iterative loop to converge on the density, as follows:
 Loop:

 Sort pressure and density points in order of decreasing pressure.
 Calculate the amount of density change, delx, at pressure point y2
 If we have converged, return x2 + delx , else…
 Save current x2 and y2 as x1 and y1;
 calculate x2 as x2 + delx
 calculate y2 as pdetail(x2,t)p
 for at most 150 iterations.
 braket(t,p):
 Braket iterates to find a molar density on either side of the “correct answer” and returns these. This narrows the range over which ddetail needs to converge.
 pdetail(d,t):
 calculates compressibility with zdetail(d,t) and returns the pressure.
 zdetail(d,t):
 calls temp(t) if the temperature has changed, then returns a polynomial equation based on density, bmix and the parameters fn[13..58].
Chardl is generally the largest consumer of horsepower. The number of iterations required to perform the characterisation increases with the square of the number of components in the analysis. Generally the loops in braket and ddetail converge in less than 10 iterations.
The AGA8 Detail algorithm is data intensive and defines approximately 2000 values held in 13 arrays.
AGA8 Detail: Enter a flowing temperature and pressure, and a gas analysis, then press Calculate. The calculation may take a few seconds to complete.
AGA 3 1990 Algorithm
The algorithm for the calculation is as follows. There is one iterative loop to solve for Reynolds number and coefficient of discharge. The standard defines many constants.
Constants of the form A and S are simply fixed numbers and do not change based on the system of units used.
Constants of the form N_{x} are unit conversion constants and are determined based on the system of units in use for the calculation.
For further details on the calculation, refer to part 4 of the specification AGA3 1990 / GPA 818592.
 Set unit conversion constants for the unit system chosen
 Calculate flowing density: D_{flow} = P_{f} * Mr_{air} * G_{i} / (Z_{f} * R * (T_{f} + N_{5}))
 Calculate base density: D_{base} = P_{b} * Mr_{air} * G_{i} / (Z_{b} * R * (T_{b} + N_{5}))
 Calculate size of orifice at flowing conditions: d’ = d * [1 + alpha1 * (T_{f} – T_{d}m)]
 Calculate size of meter run at flowing conditions: D’ = D * [1 + alpha2 * (T_{f} – T_{D}m)]
 Calculate beta = d’ / D’
 Calculate velocity of approach factor: E_{v} = 1 / sqrt( 1 – beta ^{4})
 Calculate factors required for coefficient of discharge / Reynolds number iteration loop.
 Upstream tap position L1 = N4/D
 Downstream tap position L2 = N4/D
 Upstream tap correction factor T_{u} = [ S_{2} + S_{3} e^{( 8.5 L1) }+ S_{4} e^{ (6.0 L1) }] * beta ^{1.1}
 Dimensionless downstream dam height M_{2} = (2 L_{2} ) / (1 – beta)
 Downstream tap correction factor T_{d} = S_{6} [ M_{2} + S_{7} M_{2}^{1.3} ] beta ^{1.1}
 Small pipe correction factor: if D <= (A_{4} N_{4}) then T_{s} = A_{3} (1 – beta) (A_{4} – D/N_{4}) else T_{s} = 0
 C_{d0} = A_{0} + A_{1} beta ^{2} + A_{2} B ^{8} + T_{u} + T_{d} + T_{s}
 C_{d1} = A_{5} * beta ^{0.7} (250) ^{0.7}
 C_{d2} = A_{6} * beta ^{4} (250) ^{0.35}
 C_{d3} = S_{1} * beta ^{4} * beta ^{0.8} (4.75) ^{0.8} (250) ^{0.35}
 C_{d4} = (S_{5}T_{u} + S_{8}T_{d} ) beta ^{0.8} (4.75)^{ 0.8}
 Orifice differential pressure to flowing pressure ratio x = dP / (N_{3} * P_{f})
 Y_{p} = (0.41 + 0.35 beta ^{4}) / k
 Expansion factor Y = 1 – Y_{p }x
 Calculate F_{tmp} = E_{v} Y d ^{2}
 Calculate F_{Ic} = 4000 N_{Ic} D * mu / F_{tmp}
 Calculate F_{Ip} = sqrt ( 2 * D_{flow} * dP)
 Calculate F_{I} = F_{Ic} / F_{Ip}
 Limit F_{I} to 1000 maximum.
 Set up coefficient of discharge loop by setting C_{d}(FT) to C_{d0}
 Perform loop:
 X = Fl / Cd(FT)
 If X < Xc then
 F_{c} = C_{d0} + ( C_{d1} X^{0.35} + C_{d2} + C_{d3} X ^{0.8} ) X ^{0.35} + C_{d4} X ^{0.8}
 D_{c} = ( 0.7 C_{d1} X ^{0.35} + 0.35 C_{d2} + 1.15 C^{d3} X^{ 0.8} ) X ^{0.35 }+ 0.8 C_{d4} X^{ 0.8}
 else
 F_{c} = C_{d0} + C_{d1} X ^{0.7} + ( C_{d2} + C_{d3} X ^{0.8} ) ( A – B / X ) + C_{d4} X ^{0.8}
 D_{c} = 0.7 C_{d1} X ^{0.7} + ( C_{d2} + C_{d3} X ^{0.8} ) * B / X + 0.8 C_{d3} ( A – B / X) X ^{0.8} + 0.8 C_{d4} X^{ 0.8}
 Calculate the amount to vary C_{d}(FT) by: dC_{d} = [ C_{d} (FT) – F_{c}] / [ 1 + D_{c} / C_{d}(FT) ]
 Change C_{d}(FT) : C_{d}(FT) = C_{d}(FT) – dC_{d}
 Until the absolute value of dC_{d} is less than 0.000005.
 Reynolds number is Re = 4000 / X
 Calculate mass flow factor: F _{mass} = ( pi / 4) * N_{c} E_{v} d^{2}
 Calculate mass flow rate: q_{m} = F _{mass} C_{d}(FT) Y * sqrt (2 D_{flow} * dP )
 Calculate standard flow rate: q_{v} = q_{m} / D _{base}
http://www.squinch.org/gas/aga8.html
http://www.squinch.org/gas/aga3.html