Você está na página 1de 5

AGA Flow Calc DLL Functions

With Gas Compositions Available (AGA 3 and AGA 8 Calculation)


If you have Gas compositions Available then you would use this function which takes in the gas
compositions as the last parameter.
Material Type Enumeration
This is the enum that is needed to specify the Pipe and Orifice Material. Support
materials are StainlessSteel, Monel, and CarbonSteel.
public enum MaterialType
{
StainlessSteel = 0,
Monel = 1,
CarbonSteel = 2,
}

Gas Compositions Object


Gas compositions will have to be specified in the GasComps object.
They are specified in the following way:
GasComps MUST add up to 1 or it will throw an exception: (within +/- .5%)
AGAFlowCalculation.GasComps gascomps = new AGAFlowCalculation.GasComps();
gascomps.Add(.9, AGAFlowCalculation.AgaConstants.GasCompositions.Nitrogen_N2);
gascomps.Add(.1, AGAFlowCalculation.AgaConstants.GasCompositions.CarbonDioxide_CO2);
Available Gas Compositions are as follows:
public enum GasCompositions
{
Methane_C1 = 0,
Nitrogen_N2 = 1,
CarbonDioxide_CO2 = 2,
Ethane_C2 = 3,
Propane_C3 = 4,
Water_H2O = 5,
HydrogenSulfide_H2S = 6,
Hydrogen_H2 = 7,
CarbonMonoxide_CO = 8,
Oxygen_O2 = 9,
iButane_iC4 = 10,
nButane_nC4 = 11,
iPentane_iC5 = 12,
nPentane_nC5 = 13,
nHexane_C6 = 14,
nHeptane_C7 = 15,
nOctane_C8 = 16,
nNonane_C9 = 17,
nDecane_C10 = 18,
Helium_He = 19,
Argon_Ar = 20,
}

public AGA3Result CalculateFlow(double flowTemperatureInCelcius, double


pipeReferenceTemperatureInCelcius, double orificeReferenceTemperatureInCelcius, double
baseTemperatureInCelcius, double staticPressureKPA, double baseStaticPressureKPA, double
differentialPressureKPA, double orificeSizeMM, double pipeSizeMM,
AgaConstants.MaterialType orificeMaterial, AgaConstants.MaterialType pipeMaterial, bool
tapIsUpstream, GasComps gasCompositions);

flowTemperatureInCelcius The flowing temperature in degrees Celsius


pipeReferenceTemperatureInCelcius Specifies the reference temperature of the pipe in
millimeters.
orificeReferenceTemperatureInCelcius Specifies the reference temperature of the orifice
in millimeters.
baseTemperatureInCelcius Specifies the temperature basis for stated volumetric flow
rates.
staticPressureKPA The static pressure value in KPA
baseStaticPressureKPA Specifies the pressure basis for stated volumetric flow rates
differentialPressureKPA Specifies the differential Pressure Across the Orifice Plate
orificeSizeMM Specifies the diameter of the orifice at the specified
orificeReferenceTemperatureCelsuis, in Millimeters
pipeSizeMM Specifies the inside diameter of the pipe at the specified reference
temperature pipeReferenceTemperatureCelsuis, in Millimeters.
AgaConstants.MaterialType orificeMaterial The orifice material specified with the
MaterialType enumeration
AgaConstants.MaterialType pipeMaterial The pipe material specified with the Material
Type enumeration
tapIsUpstream If the tap is upstream then set to TRUE if it is a downstream tap then
set to False.
gasCompositions Passing in the Gas Compositions Object as a Parameter

Without Gas Compositions Available (AGA 3 Calculation)


Requires manual input of flow Compressibility, base Compressibility, and specific Gravity
flowTemperatureInCelcius The flowing temperature in degrees Celsius
pipeReferenceTemperatureInCelcius Specifies the reference temperature of the pipe in
millimeters.
orificeReferenceTemperatureInCelcius Specifies the reference temperature of the orifice
in millimeters.
baseTemperatureInCelcius Specifies the temperature basis for stated volumetric flow
rates.
staticPressureKPA The static pressure value in KPA
baseStaticPressureKPA Specifies the pressure basis for stated volumetric flow rates
differentialPressureKPA Specifies the differential Pressure Across the Orifice Plate
orificeSizeMM Specifies the diameter of the orifice at the specified
orificeReferenceTemperatureCelsuis, in Millimeters
pipeSizeMM Specifies the inside diameter of the pipe at the specified reference
temperature pipeReferenceTemperatureCelsuis, in Millimeters.
AgaConstants.MaterialType orificeMaterial The orifice material specified with the
MaterialType enumeration
AgaConstants.MaterialType pipeMaterial The pipe material specified with the Material
Type enumeration
tapIsUpstream If the tap is upstream then set to TRUE if it is a downstream tap then
set to False.
flowCompressibility - Specifies the calculated compressibility at the specified measured
conditions
baseCompressibility - Specifies the calculated compressibility at the specified base
conditions
specificGravity - Specifies the average specific gravity of the gas (ideal or real value
compared to dry air).

public AGA3Result CalculateFlow(double flowTemperatureInCelcius, double


pipeReferenceTemperatureInCelcius, double orificeReferenceTemperatureInCelcius, double
baseTemperatureInCelcius, double staticPressureKPA, double baseStaticPressureKPA, double
differentialPressureKPA, double orificeSizeMM, double pipeSizeMM,
AgaConstants.MaterialType orificeMaterial, AgaConstants.MaterialType pipeMaterial, bool
tapIsUpstream, double flowCompressibility, double baseCompressibility, double
specificGravity);

Result Object
AGA result will return 5 values
public struct AGA3Result
{
public double BaseCompressibility_Zb;
public double Compressibility_FPV;
public double Flow;
public double FlowingCompressibility_Zf;
public double SpecificGravity;
}
BaseCompressibility_Zb - Specifies the calculated compressibility at the specified base
conditions. If using AGA 3 Calculation only then it will return the same value as the one
inputed.

Compressibility_FPV Super compressibility correction factor


Flow The Flow in thousands of cubic meters (E3M3)
FlowingCompressibility_Zf - Specifies the calculated compressibility at the specified
measured conditions. If using AGA 3 Calculation only then it will return the same value
as the one inputed.

SpecificGravity - Specifies the average specific gravity of the gas (ideal or real value
compared to dry air). . If using AGA 3 Calculation only then it will return the same
value as the one inputed.

Example of an AGA 3 and AGA 8 Calculation


1. Create Gas Compositions Object
AGAFlowCalculation.GasComps gascomps = new AGAFlowCalculation.GasComps();
gascomps.Add(.0184, AGAFlowCalculation.AgaConstants.GasCompositions.Nitrogen_N2);
gascomps.Add(0, AGAFlowCalculation.AgaConstants.GasCompositions.CarbonDioxide_CO2);
gascomps.Add(.0260, AGAFlowCalculation.AgaConstants.GasCompositions.HydrogenSulfide_H2S);
gascomps.Add(.7068, AGAFlowCalculation.AgaConstants.GasCompositions.Methane_C1);
gascomps.Add(.1414, AGAFlowCalculation.AgaConstants.GasCompositions.Ethane_C2);
gascomps.Add(.0674, AGAFlowCalculation.AgaConstants.GasCompositions.Propane_C3);
gascomps.Add(.0081, AGAFlowCalculation.AgaConstants.GasCompositions.iButane_iC4);
gascomps.Add(.0190, AGAFlowCalculation.AgaConstants.GasCompositions.nButane_nC4);
gascomps.Add(.0038, AGAFlowCalculation.AgaConstants.GasCompositions.iPentane_iC5);
gascomps.Add(.0043, AGAFlowCalculation.AgaConstants.GasCompositions.nPentane_nC5);
gascomps.Add(.0026, AGAFlowCalculation.AgaConstants.GasCompositions.nHexane_C6);
gascomps.Add(.0022, AGAFlowCalculation.AgaConstants.GasCompositions.nHeptane_C7);
2.
double
double
double
double
double
double
double
double
double

Specify the Flowing Conditions


flowTemperatureInCelcius = 57;
pipeReferenceTemperatureInCelcius = 20;
orificeReferenceTemperatureInCelcius = 20;
baseTemperatureInCelcius = 15;
staticPressureKPA = 2818.09;
baseStaticPressureKPA = 101.325;
differentialPressureKPA = 10.2000;
orificeSizeMM = 9.525;
pipeSizeMM = 52.370;

3. Specify the Materials of the Orifice and Pipe


AgaConstants.MaterialType orificeMaterial = AgaConstants.MaterialType.StainlessSteel;
AgaConstants.MaterialType pipeMaterial = AgaConstants.MaterialType.CarbonSteel;
4. Specify the tap is upstream (true)
bool tapIsUpstream = true;
5. Create AGA3 object and Execute CalculateFlow
AGAFlowCalculation.Aga3 aga3calc = new AGAFlowCalculation.Aga3();
AGA3Result result = aga3calc.CalculateFlow(flowTemperatureInCelcius,
pipeReferenceTemperatureInCelcius, orificeReferenceTemperatureInCelcius,
baseTemperatureInCelcius, staticPressureKPA, baseStaticPressureKPA,
differentialPressureKPA, orificeSizeMM, pipeSizeMM, orificeMaterial, pipeMaterial,
tapIsUpstream, gascomps);

6. Resulting AGA calculations are returned in the AGA3Result object


Assert.AreEqual(2.7478, result.Flow, (2.7478 * .001));
Assert.AreEqual(.7792, result.SpecificGravity, (.7792 * .001));
Assert.AreEqual(.9959, result.BaseCompressibility_Zb, (2.7478 * .001));
Assert.AreEqual(.9280, result.FlowingCompressibility_Zf, (2.7478 * .002));

Você também pode gostar