AGA Calculations Library and Source Code
SCADACore provides American Gas Association calculation libraries and full source code to developers needing to calculate gas flow.
Complete C/C++, C#, and Python AGA Calculation Source Code
SCADACore’s AGA Gas Flow Library / Source Code provides verified AGA gas flow calculations specified by the American Gas Association. All available AGA Calculations are combined into one easy-to-use DLL. The source code is also available for use in embedded systems, as well as to assist manufacturers in bringing their flow computers to the market with accurate flow calculations.
Source Code Functions with Full Double Precision
AGA3
struct AGA3Result
{
Flow;
SpecificGravity;
FlowingCompressibility_Zf;
BaseCompressibility_Zb;
Compressibility_FPV;
}
AGA3Result CalculateFlow(flowTemperature, pipeReferenceTemperature, orificeReferenceTemperature, baseTemperature, staticPressure, baseStaticPressure, differentialPressure, orificeSize, pipeSize, AgaConstants.MaterialType orificeMaterial, AgaConstants.MaterialType pipeMaterial, tapIsUpstream, GasComps gasCompositions)
AGA3Result CalculateFlow(flowTemperature, pipeReferenceTemperature, orificeReferenceTemperature, baseTemperature, staticPressure, baseStaticPressure, differentialPressure, orificeSize, pipeSize, AgaConstants.MaterialType orificeMaterial, AgaConstants.MaterialType pipeMaterial, tapIsUpstream, flowCompressibility, baseCompressibility, specificGravity)
AGA3Result CalculateFlowWithViscosity(flowTemperature, pipeReferenceTemperature, orificeReferenceTemperature, baseTemperature, staticPressure, baseStaticPressure, differentialPressure, orificeSize, pipeSize, AgaConstants.MaterialType orificeMaterial, AgaConstants.MaterialType pipeMaterial, tapIsUpstream, flowCompressibility, baseCompressibility, specificGravity, viscosity)
AGA3Result CalculateFlow(flowTemperatureInKelvin, pipeReferenceTemperatureInKelvin, orificeReferenceTemperatureInKelvin, baseTemperatureInKelvin, staticPressureKPA, baseStaticPressureKPA, differentialPressureKPA, orificeSizeMM, pipeSizeMM, orificeExpansionCoefficient, pipeExpansionCoefficient, tapIsUpstream, FlowZCalc, BaseZCalc, SpecificGravity)
AGA3Result CalculateFlowWithViscosity(flowTemperatureInKelvin, pipeReferenceTemperatureInKelvin, orificeReferenceTemperatureInKelvin,
baseTemperatureInKelvin, staticPressureKPA, baseStaticPressureKPA, differentialPressureKPA, orificeSizeMM, pipeSizeMM, orificeExpansionCoefficient, pipeExpansionCoefficient, tapIsUpstream, FlowZCalc, BaseZCalc, SpecificGravity, viscosity)
AGA7
struct AGA7Result
{
Flow;
SpecificGravity;
FlowingCompressibility_Zf;
BaseCompressibility_Zb;
Compressibility_FPV;
}
AGA7Result CalculateFlow(flowVolume, flowTemperature, baseTemperature, staticPressure, basePressure, meterFactor, GasComps gasCompositions)
AGA7Result CalculateFlow(flowVolume, flowTemperature, baseTemperature, staticPressure, basePressure,meterFactor, flowCompressibility, baseCompressibility, specificGravity)
AGA7Result CalculateAGA7(flowVolumeInM3, flowTemperatureInKelvin, baseTemperatureInKelvin, staticPressureKPA, basePressureKPA, meterFactor, FlowZCalc, BaseZCalc, SpecificGravity)
AGA8
struct AGA8Result
{
FlowCompressiblity;
SpecificGravity;
}
AGA8Result CalculateZ(GasComps gasCompositions, temperatureInKelvin, pressurePSI)
molarMass(gasComps)
DDetail(Pressure, TempInKevin)
Bracket(TemperatureInKelvin, Pressure)
PDetail(Rho, temp)
ZDetail(density, temperatureInKelvin)
BMix(tempInKelvin)
Temp(temperatureInKelvin)
AGA11
struct AGA11Result
{
Rho;
SpecificGravity;
FlowingCompressibility_Zf;
BaseCompressibility_Zb;
Compressibility_FPV;
VolumetricFlowRate_Qb;
VolumetricFlowRate_Qf;
}
AGA11Result CalculateFlow(flowTemperature, baseTemperature, staticPressure, baseStaticPressure, moleWeight, GasComps gasCompositions)
AGA11Result CalculateFlow(flowTemperature, baseTemperature, staticPressure, baseStaticPressure, moleWeight, flowCompressibility, baseCompressibility, specificGravity)
AGA11Result CalculateFlow(flowTemperatureInKelvin, staticAbsolutePressureKPA, moleWeight, FlowZCalc, BaseZCalc, SpecificGravity)
VCone
struct VConeResult
{
Flow;
SpecificGravity;
FlowingCompressibility_Zf;
BaseCompressibility_Zb;
Compressibility_FPV;
}
VConeResult CalculateFlowFromVConeSize(flowTemperature, pipeReferenceTemperature, vConeReferenceTemperature, baseTemperature, staticPressure, baseStaticPressure, differentialPressure, VConeSize, pipeSize, AgaConstants.MaterialType vConeMaterial, AgaConstants.MaterialType pipeMaterial, tapIsUpstream, flowCoefficient, GasComps gasCompositions)
VConeResult CalculateFlowFromVConeSize(flowTemperature, pipeReferenceTemperature, vConeReferenceTemperature, baseTemperature, staticPressure, baseStaticPressure, differentialPressure, vConeSize, pipeSize, AgaConstants.MaterialType vConeMaterial, AgaConstants.MaterialType pipeMaterial, tapIsUpstream, flowCompressibility, baseCompressibility, specificGravity, flowCoefficient)
VConeResult CalculateFlowFromVConeBeta(flowTemperature, pipeReferenceTemperature, vConeReferenceTemperature, baseTemperature, staticPressure, baseStaticPressure, differentialPressure, vConeBeta, pipeSize, AgaConstants.MaterialType vConeMaterial, AgaConstants.MaterialType pipeMaterial, tapIsUpstream, flowCompressibility, baseCompressibility, specificGravity, flowCoefficient)
VConeResult CalculateVConeFlowFromBeta(flowTemperatureInKelvin, pipeReferenceTemperatureInKelvin, baseTemperatureInKelvin, staticPressureKPA, baseStaticPressureKPA, differentialPressureKPA, vConeBeta, pipeSizeMM, pipeExpansionCoefficient, tapIsUpstream, FlowZCalc, BaseZCalc, SpecificGravity, flowCoefficient)
VConeResult CalculateVConeFlowConeSize(flowTemperatureInKelvin, pipeReferenceTemperatureInKelvin, vConeReferenceTemperatureInKelvin, baseTemperatureInKelvin, staticPressureKPA, baseStaticPressureKPA, differentialPressureKPA, VConeSizeMM, pipeSizeMM, vConeExpansionCoefficient, pipeExpansionCoefficient, tapIsUpstream, FlowZCalc, BaseZCalc, SpecificGravity, flowCoefficient)
Venturi
struct VenturiflowResult
{
Flow;
Mass;
SpecificGravity;
FlowingCompressibility_Zf;
BaseCompressibility_Zb;
Compressibility_FPV;
}
VenturiflowResult CalculateVentriFlow(pipeDiameter_mm, venturiDiameter_mm, staticPressure_kPa, basePressure_kPa, atmosphericPressure_kPa, differentialPressure_kPa, specificGravity, flowZCalc, refTemperature_C, flowTemperature_C)
Code Usage Samples
Redistributable License
- License will allow a company to build applications that are accessible by both customers and internal employees.
- License can be used as a part of an existing application to add real-time gas flow calculations.
- License does not have limits on the number of developers.
- License can not be used to offer a free gas flow calculator similar to the SCADACore’s AGA Gas Flow Calculators, SCADACore’s AGA Gas Flow Calculators For Windows, or SCADACore’s Mobile Gas Flow Calculators