Professional Documents
Culture Documents
documents. This report or any of its part shall not be copied, disseminated, cited
in literature, presentations or discussions without prior approval from AGA.
Forward
1 Introduction
1.1 Scope
1.2 Background
1.3 Field of Application
1.4 Types of Properties
1.5 Types of Gases
1.6 Types of Conditions
2 Uncertainty
3 Calculations
3.1 Symbols
3.2 Overview of Calculation Method and Sequence
3.3 Compliance
3.4 Equations for Speed of Sound
3.5 Critical Flow Factor Determination
5 References
1. Introduction
1.1 Scope
This document contains information for precise computation of sound speed in
natural gas and other related hydrocarbon gases. Procedures are included for
computation of several related gas properties, including heat capacity, enthalpy,
entropy and the critical flow coefficient, C*.
The methods in this document are extensions to Compressibility Factors for
Natural Gas and Other Hydrocarbon Gases, AGA Transmission Measurement
Committee Report No. 8, 2nd Edition, 2nd Printing (1994). This document contains
excerpts from Report No. 8, but intentionally does not reproduce the full report.
Similarly, the methods for computing the critical flow coefficient, C*, are based on
the information in appendix E of ASME/ANSI MFC-7M-1987. Users are referred
to this source for background and pertinent references.
Procedures for computing other natural gas properties such as volumetric
heating value and relative density fall outside of the scope of this report and are
not included.
1.2 Background
This is the first AGA document on speed of sound. It is based on a large
database of high accuracy basic physical property research data obtained
through research sponsored by the Gas Research Institute in cooperation with
the American Gas Association, the American Petroleum Institute and Groupe
Europeen de Recherches Gazieres (GERG).
The methods presented in this AGA document utilize high accuracy calculation
procedures and related equations of state already implemented by AGA, API and
ISO.
For continuity and ease of application, the original AGA Report No. 8 solution
methods have been carried forward with little change. Computer code
development for Report No. 10 will be modest and incremental to most existing
AGA Report No. 8 implementations.
Temperature, °C
-130 -60 -8 62 120 200
20000 140
Region 4 1.0%
10000 70
Region 3 0.5%
Pressure, MPa
Pressure, psia
2500 0.3% 17
Region 2
1750 0.1% 12
Region 1
Figure 1 Targeted Uncertainty for Natural Gas Speed of Sound Using the AGA Report No.
10 Method
2.0 Uncertainty
The uncertainty of calculated speed of sound depends on natural gas
temperature, pressure and composition. The uncertainties of speed of sound
methods were evaluated by comparing calculated values to experimentally
measured speed of sound from NIST Monograph 178 [7].
Calculations were compared with experimental measured values for 17
gravimetrically prepared natural gas mixtures, listed in Table 2, over the range
250 K and 350 K (-10° F and 165° F) and pressures up to 17 MPa (2500 psia).
Some of the gas mixtures included in the uncertainty analysis are outside of the
range of Table 1.
The measurements conducted demonstrate that the uncertainty in the speed of
sound is within 0.1% for Gulf Coast, Amarillo and Ekofisk gases for pressures up
to 12 MPa (1750 psia) and temperatures between 250 K and 350 K (-10° F and
165° F).
Wcalc − Wexp
Wdiff = x100
Wexp
(2.1)
1 N
BIAS = ∑Wdiff ,i
N i =1
(2.2)
[
(Wdiff ,i )2 ]
1
1 N
AAD = ∑
N i =1
2
(2.3)
1
1 N 2
∑ (Wdiff ,i − BIAS )
2
Std .Dev. =
N − 1 i =1
(2.4)
Where:
Wdiff = relative percentage difference between calculated and experimental speed of sound
Wdiff,i = Wdiff for ith data point
Wcalc = calculated speed of sound
Wexp = experimental speed of sound
AAD = average absolute deviation
BIAS = bias
Std.Dev. = Standard deviation
3.0 Calculations
3.1 Symbols
10
3.3 Compliance
To be compliant with this AGA Report, a computational solution by this or any
other method must demonstrate agreement within 50 parts per million of the
sound speeds given in Section 7.2, Table 6a (English units) or Table 6b (Metric
units).
Other tables of computed values are given in Section 7 for computational checks
but a compliance level is not specified.
11
0.5
c p RT ∂Z
W = Z + ρ
c v M r ∂ρ T
(3.1)
The isentropic exponent may be expressed in terms of its relationship to the
speed of sound:
Mr
κ =W 2
ZRT
(3.2)
The quantities Cv and Cp are the constant volume and constant pressure heat
capacities of the gas.
ρ
T ∂ 2Z 2 ∂Z
cv = c Po − R1 + T ∫ 2 + dρ
0 ρ ∂T ρ ρ ∂T ρ
(3.3)
2
∂P
T ∂T ρ
c p = cv + 2
ρ ∂P
∂ρ T
(3.4a)
or, expressed in terms of compressibility,
12
C op Cp
Note that the ideal gas specific heat ratio, , real gas specific heat ratio,
,
C vo Cv
and the isentropic exponent, κ, are related but separate quantities. In certain gas
industry applications, the ratio of ideal gas specific heats is assumed to be
synonymous with the isentropic exponent.
The pure fluid constant pressure ideal gas heat capacity is computed as:
2 2 2 2
D /T F /T H /T J /T
C = B + C
o
+ E + G + I
sinh ( D / T )
P
cosh( F / T ) sinh( H / T ) cosh( J / T )
(3.5)
0
ρ ∂T
(3.7)
13
+ ∂ρ − RX i ln ( X i )
P
S = S o − R ln( ) − R ∫
ZP o
0
ρ ρ ∂T
(3.9)
14
(cal/mol) (cal/mol-K) (cal/mol- (K) (cal/mol-K) (K) (cal/mol- (K) (cal/mol- (K) (cal/mol-K)
K) K) K)
Methane -29776.4 7.95454 43.9417 1037.09 1.56373 813.205 -24.9027 1019.98 -10.1601 1070.14 -20.0615
Nitrogen -3495.34 6.95587 0.272892 662.738 -0.291318 -680.562 1.78980 1740.06 0 100 4.49823
Carbon 20.7307 6.96237 2.68645 500.371 -2.56429 -530.443 3.91921 500.198 2.13290 2197.22 5.81381
Dioxide
Ethane -37524.4 7.98139 24.3668 752.320 3.53990 272.846 8.44724 1020.13 -13.2732 869.510 -22.4010
Propane -56072.1 8.14319 37.0629 735.402 9.38159 247.190 13.4556 1454.78 -11.7342 984.518 -24.0426
Water -13773.1 7.97183 6.27078 2572.63 2.05010 1156.72 0 100 0 100 -3.24989
Hydrogen -10085.4 7.94680 -0.0838 433.801 2.85539 843.792 6.31595 1481.43 -2.88457 1102.23 -0.51551
Sulfide
Hydrogen -5565.6 6.66789 2.33458 2584.98 0.749019 559.656 0 100 0 100 -7.94821
Carbon -2753.49 6.95854 2.02441 1541.22 0.096774 3674.81 0 100 0 100 6.23387
Monoxide
Oxygen -3497.45 6.96302 2.40013 2522.05 2.21752 1154.15 0 100 0 100 9.19749
Isobutane -72387 17.8143 58.2062 1787.39 40.7621 808.645 0 100 0 100 -44.1341
Normal -72674.8 18.6383 57.4178 1792.73 38.6599 814.151 0 100 0 100 -46.1938
Butane
Isopentane -91505.5 21.3861 74.3410 1701.58 47.0587 775.899 0 100 0 100 -60.2474
Normal -83845.2 22.5012 69.5789 1719.58 46.2164 802.174 0 100 0 100 -62.2197
Pentane
Normal -94982.5 26.6225 80.3819 1718.49 55.6598 802.069 0 100 0 100 -77.5366
Hexane
Normal -103353 30.4029 90.6941 1669.32 63.2028 786.001 0 100 0 100 -92.0164
Heptane
Normal -109674 34.0847 100.253 1611.55 69.7675 768.847 0 100 0 100 -106.149
Octane
Normal -122599 38.5014 111.446 1646.48 80.5015 781.588 0 100 0 100 -122.444
Nonane
Normal -133564 42.7143 122.173 1654.85 90.2255 785.564 0 100 0 100 -138.006
Decane
15
( ) ( )
18 58
DB
Z = 1+
K 3
− D ∑
n =13
Cn
* −un
T + ∑
n =13
Cn*T −u n bn − cn kn D k n D bn exp − cn D k n
(3.10)
where
n =1 i =1 j =1
(3.11)
The first partial derivative of Z with respect to T is:
∂Z D ∂B 18
= 3 + D ∑ u n Cn T n
* − (u +1)
∂
dT K ∂
dT n =13
( ) ( )
58
− ∑ u n C n*T −(un +1) bn − c n k n D k n D bn exp − c n D kn
n =13
(3.12)
where
∂B
= − ∑ un anT n ∑∑ xi x j Eij n (K i K j )2 Bnij
18 N N
− (u +1) u 3
*
∂T d n =1 i =1 j =1
(3.13)
The second partial derivative of Z with respect to T is:
∂ 2Z D ∂ 2B 18
2 = 3 2 − D ∑ u n (u n + 1)C n*T −(un + 2 )
∂T d K ∂T d n =13
( ) ( )
58
+ ∑ u n (u n + 1)C n*T −(un +2 ) bn − c n k n D k n D bn exp − c n D kn
n =13
(3.14)
where
∂ 2B
2 = ∑ un (un + 1)anT − (u n + 2 ) ∑∑ xi x j Eiju n (K i K j )2 Bnij
18 N N 3
*
∂ T d n =1 i =1 j =1
(3.15)
16
∂Z B 58
( ) ( )
18
= K 3 3 − ∑ C n*T −un + ∑ C n*T −un − c n k n2 D (kn −1) D bn exp − c n D kn
∂ρ T K n =13 n=13
( ) ( )
58
+ ∑ C n*T −un bn − cn k n D kn bn D (bn −1) exp − cn D kn
n =13
( ) ( ) ( )
58
− ∑ C n*T −un bn − c n k n D kn D bn cn k n D (kn −1) exp − c n D kn
n =13
(3.17)
17
18
1500
1450
1400
sound speed (ft/s)
1250
1200
1150
30 50 70 90 110 130
temperature (degrees F)
450
440
430
sound speed (m/s)
420
Gulf Coast
Amarillo
410 Ekofisk
High N2
High CO2
400
390
380
370
360
0.0 10.0 20.0 30.0 40.0 50.0
temperature (degrees C)
19
1400
1350
sound speed (ft/s)
1300
Gulf Coast
Amarillo
Ekofisk
High N2
High CO2
1250
1200
1150
0 200 400 600 800 1000 1200
absolute pressure (psia)
430
420
410
400
sound speed (m/s)
Gulf Coast
Amarillo
390 Ekofisk
High N2
High CO2
380
370
360
350
0 1 2 3 4 5 6 7 8 9
absolute pressure (MPa)
0.78
0.77
0.76
0.75
Gulf Coast
0.74
Amarillo
C*
Ekofisk
High N2
0.73
High CO2
0.72
0.71
0.7
0.69
30 50 70 90 110 130
temperature (degrees F)
Figure 4a Critical Flow Coefficent, C*, at 1000 psia as a Function of Stagnation Temperature
0.780
0.770
0.760
0.750
Gulf Coast
0.740
Amarillo
C*
Ekofisk
High N2
0.730
High CO2
0.720
0.710
0.700
0.690
0.0 10.0 20.0 30.0 40.0 50.0 60.0
temperature (degrees C)
1.5
1.45
isentropic exponent
1.4
Gulf Coast
Amarillo
Ekofisk
High N2
High CO2
1.35
1.3
1.25
0.00 200.00 400.00 600.00 800.00 1000.00 1200.00
absolute pressure (psia)
1.50
1.45
isentropic exponent
1.40
Gulf Coast
Amarillo
Ekofisk
High N2
High CO2
1.35
1.30
1.25
0.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00
absolute pressure (MPa)
5 References
[1] K.E. Starling and J.L. Savidge, Compressibility Factors of Natural Gas and Other
Related Hydrocarbon Gases, A.G.A. Transmission Measurement Committee Report No.
8, Second Edition, Second Printing, July, 1994.
[2] R. L. McFall, Sonic Nozzle Flow Calculations for Natural Gas Using A
Generalized Equation of State, M.S. Thesis, The University Of Oklahoma Graduate
College, 1984.
[3] F.A. Aly and L.L. Lee, Self-Consistent Equations for Calculating the Ideal Gas
Heat Capacity, Enthalpy and Entropy, Fluid Phase Equilibria, 6 (1981) 169-179.
[4] L.M. Ryan, Sonic Nozzle Mass Flow Calculations, Kaybob South No. 3 Meter
Prover, Internal Document, Nova Corporation, August 1994.
[5] The American Society of Mechanical Engineers, ASME/ANSI MFC-7M-1987,
1987.
[6] J.L. Savidge, S.W. Beyerlein, and E.W. Lemmon, Technical Reference
Document for the 2nd Edition of AGA Report No. 8, GRI-93/0181 (1993).
[7] B.A. Younglove, N.V. Frederick and R.D. McCarty, Speed of Sound Data and
Related Models for Mixtures of Natural Gas Constituents, NIST Monograph 178 (1993).
[8] B. A. Younglove and McLinden, M.O., An International Standard Equation of
State for the Thermodynamic Properties of Refrigerant 123, J. Phys. Chem. Ref. Data,
23(5), 731 (1994).
[9] B.E. Gammon. and D.R. Douslin, The Velocity of Sound and Heat Capacity in
Methane from Near-Critical to Subcritical Conditions, and Equation of State
Implications, Bartlesville Energy Research Center ERDA, Bartlesville, OK; J. Chem.
Phys, 64(1), 203 (1976).
[10] B.N. Taylor, Guide for the Use of the International System of Units (SI), NIST
Special Publication No. 811, (Supersedes 1991 Edition), National Institute of Standards
and Technology (NIST) (1995).
[11] Canadian Standards Association, Canadian Standards Association Metric
Practice Guide, 2000: Z234.1-00.
23
original AGA 8
algorithm
initialize tables of new function for
new or modified constants Cp (ideal gas)
AGA8 algorithm
new algorithm
AGA8 function new function for
paramdl H (ideal gas)
process endpoint
new function
modified AGA8 AGA8 function AGA8 function
Cp, H, S
function bvir temp zdetail
(real gas)
new AGA8
AGA8 function AGA8 function AGA8 function AGA8 function new functions for
function
pdetail braket ddetail pdetail Cv, k, c, W
dZdT
new AGA8
AGA8 function AGA8 function
function
zdetail zdetail
end d2ZdT2
AGA8 function
relative density
new AGA8
function
dZdD
24
The calculation sequence for the critical flow function C* is an extension of the
algorithms for sound speed, enthalpy and entropy.
begin
compute enthalpy,
entropy and sound
speed at plenum
compute enthalpy
and sound speed
at throat
compute
temperature and
pressure, given
new enthalpy and
constant entropy
find a pressure
which satisfies a
given entropy and
temperature
find a temperature
which satisfies a
given enthalpy and
pressure
convergence
tolerance met?
no
yes
convergence
tolerance met?
no
yes
convergence
no tolerance met?
yes
end
25
Output
Molar Density : 3.79174963 moles/dm3
Molar Mass : 16.0430000 kg/kg-mol
Compressibility Factor : 0.865613011
∂Z ∂T : 0.001370797803
: -1.08884683127e-005
∂ 2 Z ∂T 2
∂Z ∂ρ : -0.02602812374
∂B ∂T : 0.000396764069
∂ 2 B ∂T 2 : -3.34719916156e-006
Cp (ideal gas) : 2.21437395 kJ/kg-K
Cp (real gas) : 2.86910318 kJ/kg-K
Cv (real gas) : 1.78350108 kJ/kg-K
Isentropic exponent : 1.42527799
Sound Speed : 432.944437 m/s
Specific Enthalpy : 528.977205 kJ/kg
Specific Entropy : 9.09475139 kJ/kg-K
C* : 0.732987437
26
Output
Molar Density : 1.87396178 moles/dm3
Molar Mass : 17.5955109 kg/kg-mol
Compressibility Factor : 0.90666330
∂Z ∂T : 0.00084934112
: -7.3766250161e-6
∂ 2 Z ∂T 2
∂Z ∂ρ : -0.0442939010
∂B ∂T : 0.00047962844
∂ 2 B ∂T 2 : -4.2808097391e-006
Cp (ideal gas) : 2.06018714 kJ/kg-K
Cp (real gas) : 2.40008811 kJ/kg-K
Cv (real gas) : 1.64511520 kJ/kg-K
Isentropic exponent : 1.32535394
Sound Speed : 400.972536 m/s
Specific Enthalpy : 499.296977 kJ/kg
Specific Entropy : 8.82412494 kJ/kg-K
C* : 0.704302274
27
Output
Molar Density : 2.62533592 moles/dm3
Molar Mass : 19.4780144 kg/kg-mol
Compressibility Factor : 0.877763047
∂Z ∂T : 0.00110251388
: -8.7236464045e-006
∂ 2 Z ∂T 2
∂Z ∂ρ : -0.0375423163
∂B ∂T : 0.0004594320
∂ 2 B ∂T 2 : -3.776948019e-006
Cp (ideal gas) : 2.08298699 kJ/kg-K
Cp (real gas) : 2.55641833 kJ/kg-K
Cv (real gas) : 1.73699984 kJ/kg-K
Isentropic exponent : 1.30648621
Sound Speed : 391.528389 m/s
Specific Enthalpy : 508.00420 kJ/kg
Specific Entropy : 8.23840377 kJ/kg-K
C* : 0.710708883
28
29
Table 6a
30
Table 6b
31
Table 7a
32
Table 7b
33
Table 8a
34
Table 8b
35
Table 9a
36
Table 9b
37
Table 10a
38
Table 10b
39
Table 11a
40
Table 11b
41
Table 12a
42
Table 12b
43
44
Detail Class
The Detail class contains all the data and methods required to compute gas
compressibility and density related parameters.
Those familiar with AGA Report No. 8 will note strong resemblance between this code
and the original FORTRAN ‘Detail Characterization Method’. Several important design
features were carried over to the C++ version, including the density search procedure.
Extending the original functionality, the Detail class contains the new functions for
solving the partial derivatives of Z and the second virial coefficient, B.
Therm Class
The Therm class contains data and functions for calculating heat capacity, enthalpy,
entropy and the speed of sound.
In typical calculations involving the speed of sound, the user provides the process
pressure, temperature and gas composition. For other calculations, such as those for
critical flow nozzles, the Therm class supports a method of estimating pressure and
temperature from enthalpy and entropy.
In the course of its execution, the Therm class calls the Detail class to perform density-
related work.
Function SOS()
Function, SOS() is responsible for basic execution and memory management. It creates
an object of each required class, launches calculations supported by the classes, and
then removes the objects from memory.
Function Crit()
Function Crit() provides the same basic services of SOS(), but also estimates the critical
flow function, C*, an important parameter for critical flow calculations.
45
The interface consists of one non-modal dialog box and basic file operations, tested
under the following Windows operating systems:
Windows 95, 98, NT 4.0 (SP6), Windows XP.
46
47
49
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/*************************************************************************
* File: aga10.h
* Description: function prototypes and defines for aga10.cpp
* Version: ver 1.7 2002.11.17
* Author: W.B. Peterson
* Revisions:
* Copyright (c) 2002 American Gas Association
**************************************************************************/
#ifndef _AGA10_H
#define _AGA10_H
/* other includes */
#include <strstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
/* status codes */
#define NORMAL 9000
#define AGA10_INITIALIZED 9001
#define MEMORY_ALLOCATION_ERROR 9002
#define GENERAL_CALCULATION_FAILURE 9003
#define MAX_NUM_OF_ITERATIONS_EXCEEDED 9004
#define NEGATIVE_DENSITY_DERIVATIVE 9005
#define MAX_DENSITY_IN_BRAKET_EXCEEDED 9006
/* number of components */
#define NUMBEROFCOMPONENTS 21
50
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
#define MAX_NUM_OF_ITERATIONS 100
51
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
double dH ; /* real gas specific enthalpy (J/kg) */
double dS ; /* real gas specific entropy (J/kg-mol.K)*/
double dCpi ; /* ideal gas constant pressure heat capacity (J/kg-mol.K)*/
double dCp ; /* real gas constant pressure heat capacity (J/kg-mol.K)*/
double dCv ; /* real gas constant volume heat capacity (J/kg-mol.K)*/
double dk ; /* ratio of specific heats */
double dKappa ; /* isentropic exponent, denoted with Greek letter kappa */
double dSOS ; /* speed of sound (m/s) */
double dCstar ; /* critical flow factor C* */
} AGA10STRUCT ;
/* FUNCTION PROTOTYPES */
#endif
52
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/*************************************************************************
* File: aga10.cpp
* Description: Manages overall process of calculating speed of sound
* or C*; creates and uses objects based on Detail and Therm classes
* Contains the following functions:
* AGA10_Init(), AGA10_UnInit(), SOS(), Crit(), Cperf(), CRi()
* Version: ver 1.7 2002.11.17
* Author: W.B. Peterson
* Revisions:
* Copyright (c) 2002 American Gas Association
**************************************************************************/
#include "aga10.h"
#include "therm.h"
#include "detail.h"
/**************************************************************************
* Function : AGA10_Init()
* Arguments : void
* Returns : int
* Purpose : Initializes library; creates required objects
* Revisions :
**************************************************************************/
53
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
if (NULL == (ptTherm = new Therm))
{
return MEMORY_ALLOCATION_ERROR ;
}
return AGA10_INITIALIZED ;
} // AGA10_Init
/**************************************************************************
* Function : AGA10_UnInit()
* Arguments : void
* Returns : int
* Purpose : Un-initializes library; deletes objects
* Revisions :
**************************************************************************/
/**************************************************************************
* Function : SOS()
* Arguments : Pointers to external AGA10 data struct
* Returns : double
* Purpose : calculates speed of sound and other parameters
* Revisions :
**************************************************************************/
54
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
AGA10_Init() ;
}
// the basic sound speed calculation doesn't calculate C*; initialize to zero
ptAGA10->dCstar = 0.0 ;
/**************************************************************************
* Function : Crit()
* Arguments : Pointers to external AGA10 data struct, Detail and Therm
* objects and a double precision float (gas velocity in plenum)
* Returns : double
* Purpose : calculates C*
* Revisions :
**************************************************************************/
55
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
}
// Via simple repetition, search for a pressure, temperature and sound speed
// at a nozzle throat which provide constant enthalpy, given the entropy known
// at the plenum. Abort if loop executes more than 100 times without convergence.
for (i = 1; i < MAX_NUM_OF_ITERATIONS; i++)
{
// calculate P and T to satisfy H and S
ptTherm->HS_Mode(ptAGA10, ptDetail, H - DH, S, true) ;
// recalculate DH
DH = (ptAGA10->dSOS * ptAGA10->dSOS - dPlenumVelocity * dPlenumVelocity) / 2.0 ;
56
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
// C* is the real gas critical flow constant (not to be confused with Cperf or CRi)
ptAGA10->dCstar = (ptAGA10->dRhof * ptAGA10->dSOS) / sqrt(R * P * Z) ;
/**************************************************************************
* Function : Cperf()
* Arguments : pointer to external AGA10 data struct
* Returns : double
* Purpose : calculates isentropic perfect gas critical flow function
* Revisions :
**************************************************************************/
k = ptAGA10->dKappa ;
root = 2.0 / (k + 1.0) ;
exponent = (k + 1.0) / (k - 1.0) ;
57
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : CRi()
* Arguments : pointer to external AGA10 data struct
* Returns : double
* Purpose : calculates isentropic real gas critical flow function CRi
* Revisions :
**************************************************************************/
58
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/*************************************************************************
* File : detail.h
* Description: Header file for the 'Detail' class
* See 'detail.cpp' for the implementation.
* Version : ver 1.7 2002.11.17
* Author : W.B. Peterson
* Revisions:
* Copyright (c) 2002 American Gas Association
**************************************************************************/
#ifndef _DETAIL_H
#define _DETAIL_H
#include "aga10.h"
class Detail
{
private:
// member data
int iNCC ; // number of components
int aiCID[21] ; // component IDs
// five history variables are used to improve efficiency during repeated calculations
double dOldMixID ; // mixture ID from previous calc
double dOldPb ; // Pb from previous calc
double dOldTb ; // Tb from previous calc
double dOldPf ; // Pf from previous calc
double dOldTf ; // Tf from previous calc
59
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
double dSi[21] ; // dipole parameter
double dWi[21] ; // association parameter
60
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
double dPRhoL ; // low pressure used in braket function
double dPRhoH ; // high pressure used in braket function
protected:
public:
Detail(void) ; // default constructor
~Detail() ; // default destructor
#endif
61
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/*************************************************************************
* File : detail.cpp
* Description: This file contains functions implementing
* AGA Report No.8 1994 - Detail Method, plus new features
* required for AGA Report No. 10
* Contains the functions:
* Detail(), ~Detail(), compositionchange(), Run(), table(),
* paramdl(), chardl(), braket(), bvir(), temp(), ddetail(),
* pdetail(), zdetail(), relativedensity(), dZdT(), d2ZdT2(),
* dZdD()
* Version : ver 1.7 2002.11.17
* Author : W.B. Peterson
* Revisions:
* Copyright (c) 2002 American Gas Association
**************************************************************************/
#include "aga10.h"
#include "detail.h"
#include <math.h>
/**************************************************************************
* Function : Detail::Detail()
* Arguments : void
* Returns :
* Purpose : default constructor; includes initialization of
* history-sensitive variables & data tables 4 and 6
* Revisions :
**************************************************************************/
Detail::Detail(void)
{
// initialize history-sensitive variables
dOldMixID = 0.0 ; // mixture ID from previous calc
dOldPb = 0.0 ; // base pressure from previous calc
dOldTb = 0.0 ; // base temperature from previous calc
dOldPf = 0.0 ; // flowing pressure from previous calc
dOldTf = 0.0 ; // flowing temperature from previous calc
62
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
// function table() populates tables of static constants
table() ;
} // Detail::Detail()
/**************************************************************************
* Function : Detail::~Detail()
* Arguments :
* Returns :
* Purpose : default destructor
* Revisions :
**************************************************************************/
Detail::~Detail()
{
} // Detail::~Detail()
/**************************************************************************
* Function : Detail::compositionchange()
* Arguments : AGA10STRUCT *
* Returns : void
* Purpose : Compares new composition to old by creating a semi-unique
* numerical ID. It is possible but very unlikely that 2
* sequential & different compositions will produce the same ID
* Revisions :
**************************************************************************/
63
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
}
else
{
return false;
}
} // Detail::compositionchange()
/**************************************************************************
* Function : Detail::Run()
* Arguments : AGA10STRUCT *
* Returns : void
* Purpose : public method to coordinate and run the full calc sequence
* Revisions :
**************************************************************************/
iNCC = iNCC +1 ;
// calculate composition dependent quantities; ported from original
// FORTRAN functions paramdl() and chardl()
64
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
paramdl() ;
chardl(ptAGA10) ;
}
65
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
{
// if temperature has changed, we must follow through
temp() ;
// force ForceUpdate flag to true
ptAGA10->bForceUpdate = true ;
}
66
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : Detail::table()
* Arguments : void
* Returns : void
* Purpose : builds tables of constants
* Revisions :
**************************************************************************/
void Detail::table(void)
{
int j, k ;
67
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
adAn[13] = 0.157672400 ;
adAn[14] = -0.436386400 ;
adAn[15] = -0.044081590 ;
adAn[16] = -0.003433888 ;
adAn[17] = 0.032059050 ;
adAn[18] = 0.024873550 ;
adAn[19] = 0.073322790 ;
adAn[20] = -0.001600573 ;
adAn[21] = 0.642470600 ;
adAn[22] = -0.416260100 ;
adAn[23] = -0.066899570 ;
adAn[24] = 0.279179500 ;
adAn[25] = -0.696605100 ;
adAn[26] = -0.002860589 ;
adAn[27] = -0.008098836 ;
adAn[28] = 3.150547000 ;
adAn[29] = 0.007224479 ;
adAn[30] = -0.705752900 ;
adAn[31] = 0.534979200 ;
adAn[32] = -0.079314910 ;
adAn[33] = -1.418465000 ;
adAn[34] = -5.99905E-17 ;
adAn[35] = 0.105840200 ;
adAn[36] = 0.034317290 ;
adAn[37] = -0.007022847 ;
adAn[38] = 0.024955870 ;
adAn[39] = 0.042968180 ;
adAn[40] = 0.746545300 ;
adAn[41] = -0.291961300 ;
adAn[42] = 7.294616000 ;
adAn[43] = -9.936757000 ;
adAn[44] = -0.005399808 ;
adAn[45] = -0.243256700 ;
adAn[46] = 0.049870160 ;
adAn[47] = 0.003733797 ;
adAn[48] = 1.874951000 ;
adAn[49] = 0.002168144 ;
adAn[50] = -0.658716400 ;
adAn[51] = 0.000205518 ;
adAn[52] = 0.009776195 ;
68
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
adAn[53] = -0.020487080 ;
adAn[54] = 0.015573220 ;
adAn[55] = 0.006862415 ;
adAn[56] = -0.001226752 ;
adAn[57] = 0.002850908 ;
69
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
adUn[33] = 9.0 ;
adUn[34] = -13.0;
adUn[35] = 21.0;
adUn[36] = 8.0 ;
adUn[37] = -0.5 ;
adUn[38] = 0.0 ;
adUn[39] = 2.0 ;
adUn[40] = 7.0 ;
adUn[41] = 9.0 ;
adUn[42] = 22.0;
adUn[43] = 23.0;
adUn[44] = 1.0 ;
adUn[45] = 9.0 ;
adUn[46] = 3.0 ;
adUn[47] = 8.0 ;
adUn[48] = 23.0;
adUn[49] = 1.5 ;
adUn[50] = 5.0 ;
adUn[51] = -0.5 ;
adUn[52] = 4.0 ;
adUn[53] = 7.0 ;
adUn[54] = 3.0 ;
adUn[55] = 0.0 ;
adUn[56] = 1.0 ;
adUn[57] = 0.0 ;
70
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
71
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
adTable6Eij[2][13] = 0.859764 ;
adTable6Eij[2][14] = 0.855134 ;
adTable6Eij[2][15] = 0.831229 ;
adTable6Eij[2][16] = 0.808310 ;
adTable6Eij[2][17] = 0.786323 ;
adTable6Eij[2][18] = 0.765171 ;
adTable6Eij[3][4] = 1.022560 ;
adTable6Eij[3][5] = 0.693168 ;
adTable6Eij[3][6] = 0.946871 ;
adTable6Eij[3][7] = 1.164460 ;
adTable6Eij[3][11] = 1.013060 ;
adTable6Eij[3][13] = 1.005320 ;
adTable6Eij[4][7] = 1.034787 ;
adTable6Eij[4][11] = 1.004900 ;
adTable6Eij[6][14] = 1.008692 ;
adTable6Eij[6][15] = 1.010126 ;
adTable6Eij[6][16] = 1.011501 ;
adTable6Eij[6][17] = 1.012821 ;
adTable6Eij[6][18] = 1.014089 ;
adTable6Eij[7][8] = 1.100000 ;
adTable6Eij[7][10] = 1.300000 ;
adTable6Eij[7][11] = 1.300000 ;
adTable6Uij[0][1] = 0.886106 ;
adTable6Uij[0][2] = 0.963827 ;
adTable6Uij[0][4] = 0.990877 ;
adTable6Uij[0][6] = 0.736833 ;
adTable6Uij[0][7] = 1.156390 ;
adTable6Uij[0][11] = 0.992291 ;
adTable6Uij[0][13] = 1.003670 ;
adTable6Uij[0][14] = 1.302576 ;
adTable6Uij[0][15] = 1.191904 ;
adTable6Uij[0][16] = 1.205769 ;
adTable6Uij[0][17] = 1.219634 ;
adTable6Uij[0][18] = 1.233498 ;
adTable6Uij[1][2] = 0.835058 ;
adTable6Uij[1][3] = 0.816431 ;
adTable6Uij[1][4] = 0.915502 ;
adTable6Uij[1][6] = 0.993476 ;
adTable6Uij[1][7] = 0.408838 ;
adTable6Uij[1][11] = 0.993556 ;
72
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
adTable6Uij[2][3] = 0.969870 ;
adTable6Uij[2][6] = 1.045290 ;
adTable6Uij[2][8] = 0.900000 ;
adTable6Uij[2][14] = 1.066638 ;
adTable6Uij[2][15] = 1.077634 ;
adTable6Uij[2][16] = 1.088178 ;
adTable6Uij[2][17] = 1.098291 ;
adTable6Uij[2][18] = 1.108021 ;
adTable6Uij[3][4] = 1.065173 ;
adTable6Uij[3][6] = 0.971926 ;
adTable6Uij[3][7] = 1.616660 ;
adTable6Uij[3][10] = 1.250000 ;
adTable6Uij[3][11] = 1.250000 ;
adTable6Uij[3][12] = 1.250000 ;
adTable6Uij[3][13] = 1.250000 ;
adTable6Uij[6][14] = 1.028973 ;
adTable6Uij[6][15] = 1.033754 ;
adTable6Uij[6][16] = 1.038338 ;
adTable6Uij[6][17] = 1.042735 ;
adTable6Uij[6][18] = 1.046966 ;
adTable6Kij[0][1] = 1.003630 ;
adTable6Kij[0][2] = 0.995933 ;
adTable6Kij[0][4] = 1.007619 ;
adTable6Kij[0][6] = 1.000080 ;
adTable6Kij[0][7] = 1.023260 ;
adTable6Kij[0][11] = 0.997596 ;
adTable6Kij[0][13] = 1.002529 ;
adTable6Kij[0][14] = 0.982962 ;
adTable6Kij[0][15] = 0.983565 ;
adTable6Kij[0][16] = 0.982707 ;
adTable6Kij[0][17] = 0.981849 ;
adTable6Kij[0][18] = 0.980991 ;
adTable6Kij[1][2] = 0.982361 ;
adTable6Kij[1][3] = 1.007960 ;
adTable6Kij[1][6] = 0.942596 ;
adTable6Kij[1][7] = 1.032270 ;
adTable6Kij[2][3] = 1.008510 ;
adTable6Kij[2][6] = 1.007790 ;
adTable6Kij[2][14] = 0.910183 ;
adTable6Kij[2][15] = 0.895362 ;
73
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
adTable6Kij[2][16] = 0.881152 ;
adTable6Kij[2][17] = 0.867520 ;
adTable6Kij[2][18] = 0.854406 ;
adTable6Kij[3][4] = 0.986893 ;
adTable6Kij[3][6] = 0.999969 ;
adTable6Kij[3][7] = 1.020340 ;
adTable6Kij[6][14] = 0.968130 ;
adTable6Kij[6][15] = 0.962870 ;
adTable6Kij[6][16] = 0.957828 ;
adTable6Kij[6][17] = 0.952441 ;
adTable6Kij[6][18] = 0.948338 ;
adTable6Gij[0][2] = 0.807653 ;
adTable6Gij[0][7] = 1.957310 ;
adTable6Gij[1][2] = 0.982746 ;
adTable6Gij[2][3] = 0.370296 ;
adTable6Gij[2][5] = 1.673090 ;
} // Detail::table()
/**************************************************************************
* Function : Detail::paramdl()
* Arguments : void
* Returns : void
* Purpose : sets up characterization & binary interaction parameters
* Revisions :
**************************************************************************/
void Detail::paramdl(void)
{
int j, k ;
74
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
adTable5Fi[7] = 1.0000 ;
75
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
adTable5Si[5] = 1.5822 ;
adTable5Si[6] = 0.3900 ;
adTable5Wi[5] = 1.0000 ;
76
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : Detail::chardl()
* Arguments : AGA10STRUCT *
* Returns : void
* Purpose : computes composition-dependent quantities
* Revisions :
**************************************************************************/
77
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
k2p5 = 0.0 ;
u5p0 = 0.0 ;
u2p5 = 0.0 ;
dW = 0.0 ;
q1p0 = 0.0 ;
dF = 0.0 ;
if (dUij[i][j] != 1.0)
u5p0 += Xij * (pow(dUij[i][j],5.0) - 1.0) * pow((pow(dEi[i],5.0)
* pow(dEi[j],5.0)),0.5) ;
if (dGij[i][j] != 1.0)
dW += Xij * (dGij[i][j] - 1.0) * ((dGi[i] + dGi[j]) / 2.0) ;
78
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
e0p5 = sqrt(Eij) ;
e2p0 = Eij * Eij ;
e3p0 = Eij * e2p0 ;
e3p5 = e3p0 * e0p5 ;
e4p5 = Eij * e3p5 ;
e6p0 = e3p0 * e3p0 ;
e11p0= e4p5 * e4p5 * e2p0 ;
e7p5 = e4p5 * Eij * e2p0 ;
e9p5 = e7p5 * e2p0 ;
e12p0= e11p0 * Eij ;
e12p5= e12p0 * e0p5 ;
adBcoef[0] = adBcoef[0] + s3 ;
adBcoef[1] = adBcoef[1] + s3 * e0p5 ;
adBcoef[2] = adBcoef[2] + s3 * Eij ;
adBcoef[3] = adBcoef[3] + s3 * e3p5 ;
adBcoef[4] = adBcoef[4] + s3 * Gij / e0p5 ;
adBcoef[5] = adBcoef[5] + s3 * Gij * e4p5 ;
adBcoef[6] = adBcoef[6] + s3 * dQi[i] * dQi[j] * e0p5 ;
adBcoef[7] = adBcoef[7] + s3 * dSi[i] * dSi[j] * e7p5 ;
adBcoef[8] = adBcoef[8] + s3 * dSi[i] * dSi[j] * e9p5 ;
adBcoef[9] = adBcoef[9] + s3 * dWi[i] * dWi[j] * e6p0 ;
adBcoef[10] = adBcoef[10]+ s3 * dWi[i] * dWi[j] * e12p0 ;
adBcoef[11] = adBcoef[11]+ s3 * dWi[i] * dWi[j] * e12p5 ;
adBcoef[12] = adBcoef[12] + s3 * dFi[i] * dFi[j] / e6p0 ;
adBcoef[13] = adBcoef[13] + s3 * e2p0 ;
adBcoef[14] = adBcoef[14] + s3 * e3p0 ;
adBcoef[15] = adBcoef[15] + s3 * dQi[i] * dQi[j] * e2p0 ;
adBcoef[16] = adBcoef[16] + s3 * e2p0 ;
adBcoef[17] = adBcoef[17] + s3 * e11p0 ;
}
}
79
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : Detail::bvir()
* Arguments : void
* Returns : void
* Purpose : computes 2nd virial coefficient & partial derivs thereof
* Revisions :
**************************************************************************/
void Detail::bvir(void)
{
// variables local to function
double t0p5, t2p0, t3p0, t3p5, t4p5, t6p0, t11p0 ;
double t7p5, t9p5, t12p0, t12p5 ;
double t1p5, t4p0 ;
double Bx[18] ;
int i ;
// pre-calculate powers of T
t0p5 = sqrt(dT) ;
t2p0 = dT * dT ;
t3p0 = dT * t2p0 ;
t3p5 = t3p0 * t0p5 ;
t4p5 = dT * t3p5 ;
t6p0 = t3p0 * t3p0 ;
80
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
t11p0 = t4p5 * t4p5 * t2p0 ;
t7p5 = t6p0 * dT * t0p5 ;
t9p5 = t7p5 * t2p0 ;
t12p0 = t9p5 * t0p5 * t2p0 ;
t12p5 = t12p0 * t0p5 ;
t1p5 = dT * t0p5 ;
t4p0 = t2p0 * t2p0 ;
// coefficients for B
Bx[0] = adBcoef[0] ;
Bx[1] = adBcoef[1] / t0p5 ;
Bx[2] = adBcoef[2] / dT ;
Bx[3] = adBcoef[3] / t3p5 ;
Bx[4] = adBcoef[4] * t0p5 ;
Bx[5] = adBcoef[5] / t4p5 ;
Bx[6] = adBcoef[6] / t0p5 ;
Bx[7] = adBcoef[7] / t7p5 ;
Bx[8] = adBcoef[8] / t9p5 ;
Bx[9] = adBcoef[9] / t6p0 ;
Bx[10] = adBcoef[10] / t12p0 ;
Bx[11] = adBcoef[11] / t12p5 ;
Bx[12] = adBcoef[12] * t6p0 ;
Bx[13] = adBcoef[13] / t2p0 ;
Bx[14] = adBcoef[14] / t3p0 ;
Bx[15] = adBcoef[15] / t2p0 ;
Bx[16] = adBcoef[16] / t2p0 ;
Bx[17] = adBcoef[17] / t11p0 ;
81
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
} // Detail::bvir()
82
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : Detail::temp()
* Arguments : void
* Returns : void
* Purpose : computes temperature-dependent quantities
* Revisions :
**************************************************************************/
void Detail::temp(void)
{
// Note: this function was ported from the AGA Report No.8 FORTRAN listing,
// retaining as much of the original content as possible
83
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
84
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
adFn[51] = adAn[51] * dQp2 * tr0p5 ;
adFn[52] = adAn[52] / tr4p0 ;
adFn[53] = adAn[53] * dW / tr7p0 ;
adFn[54] = adAn[54] / tr3p0 ;
adFn[55] = adAn[55] * dW ;
adFn[56] = adAn[56] / tr ;
adFn[57] = adAn[57] * dQp2 ;
} // Detail::temp()
/**************************************************************************
* Function : Detail::ddetail()
* Arguments : AGA10STRUCT *
* Returns : void
* Purpose : calculates density
* Revisions :
**************************************************************************/
// Note: this function was ported from the AGA Report No.8 FORTRAN listing,
// retaining as much of the original content as possible
85
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
// check value of "lStatus" returned from subroutine braket
if (ptAGA10->lStatus == MAX_NUM_OF_ITERATIONS_EXCEEDED ||
ptAGA10->lStatus == NEGATIVE_DENSITY_DERIVATIVE)
{
return ;
}
86
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
x3 = x1 ;
y1 = y2 ;
y2 = y3 ;
y3 = y1 ;
}
87
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
// use inverse linear interpolation
xnumer = (x2-x1)*y2 ;
xdenom = y1-y2 ;
}
88
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
if (boundn > 0.0)
{
// procedure stepping out of bounds, use bisection
delx = delbis ;
delprv = delbis ;
}
89
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : Detail::braket()
* Arguments : AGA10STRUCT *
* Returns : void
* Purpose : brackets density solution
* Revisions :
**************************************************************************/
// Note: this function was ported from the AGA Report No.8 FORTRAN listing,
// retaining as much of the original content as possible
// initialize
imax = 200 ;
rho1 = 0.0 ;
p1 = 0.0 ;
rhomax = 1.0 / dKp3 ;
if (dT > 1.2593 * dU) rhomax = 20.0 * rhomax ;
videal = RGASKJ * dT / dP ;
90
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
if (rho2 > rhomax && ptAGA10->lStatus != MAX_DENSITY_IN_BRAKET_EXCEEDED)
{
// density in braket exceeds maximum allowable density
ptAGA10->lStatus = MAX_DENSITY_IN_BRAKET_EXCEEDED ;
del = 0.01 * (rhomax - rho1) + (dP / (RGASKJ * dT)) / 20.0 ;
rho2 = rho1 + del ;
continue ;
}
91
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
return;
}
}
// maximum number of iterations exceeded if we fall through the bottom
ptAGA10->lStatus = MAX_NUM_OF_ITERATIONS_EXCEEDED ;
dRho = rho2 ;
return ;
} // Detail::braket()
/**************************************************************************
* Function : Detail::pdetail()
* Arguments : double
* Returns : void
* Purpose : calculates pressure, given D and T. Calls zdetail()
* Revisions :
**************************************************************************/
92
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : Detail::zdetail()
* Arguments : double
* Returns : void
* Purpose : calculates compressibility
* Revisions :
**************************************************************************/
double Detail::zdetail(double d)
{
// variables local to function
double D1, D2, D3, D4, D5, D6, D7, D8, D9, exp1, exp2, exp3, exp4 ;
exp1 = exp(-D1) ;
exp2 = exp(-D2) ;
exp3 = exp(-D3) ;
exp4 = exp(-D4) ;
// the following expression for Z was adopted from FORTRAN example in AGA8
dZ = 1.0 + dB * d
+ adFn[12] * D1 * (exp3 - 1.0 - 3.0 * D3 * exp3)
+ (adFn[13] + adFn[14] + adFn[15]) * D1 * (exp2 - 1.0 - 2.0 * D2 * exp2)
+ (adFn[16] + adFn[17]) * D1 * (exp4 - 1.0 - 4.0 * D4 * exp4)
+ (adFn[18] + adFn[19]) * D2 * 2.0
+ (adFn[20] + adFn[21] + adFn[22]) * D2 * (2.0 - 2.0 * D2) * exp2
+ (adFn[23] + adFn[24] + adFn[25]) * D2 * (2.0 - 4.0 * D4) * exp4
+ adFn[26] * D2 * (2.0 - 4.0 * D4) * exp4
+ adFn[27] * D3 * 3.0
+ (adFn[28] + adFn[29]) * D3 * (3.0 - D1) * exp1
93
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
+ (adFn[30] + adFn[31]) * D3 * (3.0 - 2.0 * D2) * exp2
+ (adFn[32] + adFn[33]) * D3 * (3.0 - 3.0 * D3) * exp3
+ (adFn[34] + adFn[35] + adFn[36]) * D3 * (3.0 - 4.0 * D4) * exp4
+ (adFn[37] + adFn[38]) * D4 * 4.0
+ (adFn[39] + adFn[40] + adFn[41]) * D4 * (4.0 - 2.0 * D2) * exp2
+ (adFn[42] + adFn[43]) * D4 * (4.0 - 4.0 * D4) * exp4
+ adFn[44] * D5 * 5.0
+ (adFn[45] + adFn[46]) * D5 * (5.0 - 2.0 * D2) * exp2
+ (adFn[47] + adFn[48]) * D5 * (5.0 - 4.0 * D4) * exp4
+ adFn[49] * D6 * 6.0
+ adFn[50] * D6 * (6.0 - 2.0 * D2) * exp2
+ adFn[51] * D7 * 7.0
+ adFn[52] * D7 * (7.0 - 2.0 * D2) * exp2
+ adFn[53] * D8 * (8.0 - D1) * exp1
+ (adFn[54] + adFn[55]) * D8 * (8.0 - 2.0 * D2) * exp2
+ (adFn[56] + adFn[57]) * D9 * (9.0 - 2.0 * D2) * exp2 ;
return dZ ;
} // Detail::zdetail()
/**************************************************************************
* Function : Detail::dZdT()
* Arguments : double
* Returns : double
* Purpose : calculates the first partial derivative of Z wrt T
* Revisions :
**************************************************************************/
double Detail::dZdT(double d)
{
// variables local to function
double tmp ;
int i ;
double D1, D2, D3, D4, D5, D6, D7, D8, D9, exp1, exp2, exp3, exp4 ;
94
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
D3 = D2 * D1 ;
D4 = D3 * D1 ;
D5 = D4 * D1 ;
D6 = D5 * D1 ;
D7 = D6 * D1 ;
D8 = D7 * D1 ;
D9 = D8 * D1 ;
exp1 = exp(-D1) ;
exp2 = exp(-D2) ;
exp3 = exp(-D3) ;
exp4 = exp(-D4) ;
95
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
return ddZdT ;
} // Detail::dDdT()
96
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : Detail::d2ZdT2()
* Arguments : double
* Returns : double
* Purpose : calculates the second partial derivative of Z wrt T
* Revisions :
**************************************************************************/
double Detail::d2ZdT2(double d)
{
// variables local to function
double tmp ;
int i ;
double D1, D2, D3, D4, D5, D6, D7, D8, D9, exp1, exp2, exp3, exp4 ;
97
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
}
}
98
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
return dd2ZdT2 ;
} // Detail::d2ZdT2()
/**************************************************************************
* Function : Detail::dZdD()
* Arguments : double
* Returns : double
* Purpose : calculates the first partial derivative of Z wrt D
* Revisions :
**************************************************************************/
// For efficiency and continuity with AGA 8 code example, each term
// is evaluated individually rather than through looping through tables.
// Temporary storage is used to hold portions of complex equations and
// to facilitate debugging. Additional speed optimization is possible.
double Detail::dZdD(double d)
{
double temp, temp1, temp2, temp3;
int i ;
double D1, D2, D3, D4, D5, D6, D7, D8, D9, exp1, exp2, exp3, exp4 ;
99
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
// create terms uC*T^-(un+1) from coefficients we've already computed (An[n])
for (i=12; i < 58; i++)
{
fx[i] = adFn[i] ;
}
// n = 17..18
temp1 = -16.0 * D4 * exp4 ;
temp2 = (1.0 - 4.0 * D4) * exp4 ;
temp3 = -temp2 * 4.0 * D4 ;
temp = temp1 + temp2 + temp3 ;
ddZdD += -fx[16] + fx[16] * temp ;
ddZdD += -fx[17] + fx[17] * temp ;
// n = 19..20
temp = 4.0 * D1 ;
ddZdD += fx[18] * temp ;
ddZdD += fx[19] * temp ;
100
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
// n = 21..23
temp1 = -4.0 * D3 * exp2 ;
temp2 = (2.0 - 2.0 * D2) * 2.0 * D1 * exp2 ;
temp3 = -temp2 * D2;
temp = temp1 + temp2 + temp3 ;
ddZdD += fx[20] * temp ;
ddZdD += fx[21] * temp ;
ddZdD += fx[22] * temp ;
// n = 24..27
temp1 = -16.0 * D5 * exp4 ;
temp2 = (2.0 - 4.0 * D4) * 2.0 * D1 * exp4 ;
temp3 = -temp2 * 2.0 * D4 ;
temp = temp1 + temp2 + temp3 ;
ddZdD += fx[23] * temp ;
ddZdD += fx[24] * temp ;
ddZdD += fx[25] * temp ;
ddZdD += fx[26] * temp ;
// n = 28
temp = 9.0 * D2 ;
ddZdD += fx[27] * temp ;
// n = 29..30
temp = -D3 * exp1 + (3.0 - D1) * 3.0 * D2 * exp1 ;
temp -= (3.0 - D1) * D3 * exp1 ;
ddZdD += fx[28] * temp ;
ddZdD += fx[29] * temp ;
// n = 31..32
temp1 = -4.0 * D4 * exp2 ;
temp2 = (3.0 - 2.0 * D2) * 3.0 * D2 * exp2 ;
temp3 = -(3.0 - 2.0 * D2) * 2.0 * D4 * exp2 ;
temp = temp1 + temp2 + temp3 ;
ddZdD += fx[30] * temp ;
ddZdD += fx[31] * temp ;
// n = 33..34
temp1 = -9.0 * D5 * exp3 ;
101
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
temp2 = (3.0 - 3.0 * D3) * 3.0 * D2 * exp3 ;
temp3 = -(3.0 - 3.0 * D3) * 3.0 * D5 * exp3 ;
temp = temp1 + temp2 + temp3 ;
ddZdD += fx[32] * temp ;
ddZdD += fx[33] * temp ;
// n = 35..37
temp1 = -16.0 * D6 * exp4 ;
temp2 = (3.0 - 4.0 * D4) * 3.0 * D2 * exp4 ;
temp3 = -(3.0 - 4.0 * D4) * D6 * 4.0 * exp4 ;
temp = temp1 + temp2 + temp3 ;
ddZdD += fx[34] * temp ;
ddZdD += fx[35] * temp ;
ddZdD += fx[36] * temp ;
// n = 38..39
temp = 16.0 * D3 ;
ddZdD += fx[37] * temp ;
ddZdD += fx[38] * temp ;
// n = 40..42
temp1 = -4.0 * D5 * exp2 ;
temp2 = (4.0 - 2.0 * D2) * 4.0 * D3 * exp2 ;
temp3 = -(4.0 - 2.0 * D2) * 2.0 * D5 * exp2 ;
temp = temp1 + temp2 + temp3 ;
ddZdD += fx[39] * temp ;
ddZdD += fx[40] * temp ;
ddZdD += fx[41] * temp ;
// n = 43..44
temp = -16.0 * D7 * exp4 + (4.0 - 4.0 * D4) * 4.0 * D3 * exp4 ;
temp -= (4.0 - 4.0 * D4) * D7 * 4.0 * exp4 ;
ddZdD += fx[42] * temp ;
ddZdD += fx[43] * temp ;
// n = 45
temp = 25.0 * D4 ;
ddZdD += fx[44] * temp ;
// n = 46..47
102
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
temp = -4.0 * D6 * exp2 + (5.0 - 2.0 * D2) * 5.0 * D4 * exp2 ;
temp -= (5.0 - 2.0 * D2) * D6 * 2.0 * exp2 ;
ddZdD += fx[45] * temp ;
ddZdD += fx[46] * temp ;
// n = 48..49
temp = -16.0 * D8 * exp4 + (5.0 - 4.0 * D4) * 5.0 * D4 * exp4 ;
temp -= (5.0 - 4.0 * D4) * D8 * 4.0 * exp4 ;
ddZdD += fx[47] * temp ;
ddZdD += fx[48] * temp ;
// n = 50
temp = 36.0 * D5 ;
ddZdD += fx[49] * temp ;
// n = 51
temp = -4.0 * D7 * exp2 + (6.0 - 2.0 * D2) * 6.0 * D5 * exp2 ;
temp -= (6.0 - 2.0 * D2) * D7 * 2.0 * exp2 ;
ddZdD += fx[50] * temp ;
// n = 52
temp = 49.0 * D6 ;
ddZdD += fx[51] * temp ;
// n = 53
temp = -4.0 * D8 * exp2 + (7.0 - 2.0 * D2) * 7.0 * D6 * exp2 ;
temp -= (7.0 - 2.0 * D2) * D8 * 2.0 * exp2 ;
ddZdD += fx[52] * temp ;
// n = 54
temp = -1.0 * D8 * exp1 + (8.0 - D1) * 8.0 * D7 * exp1 ;
temp -= (8.0 - D1) * D8 * exp1 ;
ddZdD += fx[53] * temp ;
// n = 55..56
temp = -4.0 * D1 * D8 * exp2 + (8.0 - 2.0 * D2) * 8.0 * D7 * exp2 ;
temp -= (8.0 - 2.0 * D2) * D8 * 2.0 * D1 * exp2 ;
ddZdD += fx[54] * temp ;
ddZdD += fx[55] * temp ;
103
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
// n = 57..58
temp = -4.0 * D2 * D8 * exp2 + (9.0 - 2.0 * D2) * 9.0 * D8 * exp2 ;
temp -= (9.0 - 2.0 * D2) * D2 * D8 * 2.0 * exp2 ;
ddZdD += fx[56] * temp ;
ddZdD += fx[57] * temp ;
ddZdD *= dKp3 ;
return ddZdD ;
} // Detail::dZdD()
104
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : Detail::relativedensity()
* Arguments : AGA10STRUCT *
* Returns : void
* Purpose : calculates relative density via methods listed in AGA 8
* Revisions :
**************************************************************************/
105
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/*************************************************************************
* File : therm.h
* Description : Header file for class 'Therm'
* See therm.cpp for implementation of this class
* Version : ver 1.7 2002.11.17
* Author : W.B. Peterson
* Revisions:
* Copyright (c) 2002 American Gas Association
**************************************************************************/
#ifndef _THERM_H
#define _THERM_H
#include "aga10.h"
#include "detail.h"
class Therm
{
private:
// member data
double dT ; // current temperature, in Kelvins
double dP ; // current pressure, in Pascals
double dD ; // molar density, in moles/dm3
double dRho ; // mass density, in kg/m3
double dPdD ; // partial deriv of P wrt D
double dPdT ; // partial deriv of P wrt T
double dSi ; // ideal gas specific entropy, kJ/kg.K
double dTold ; // temperature previously used
double dMrxold ; // mixture molar mass previously used
// private methods
double CpiMolar(AGA10STRUCT *) ;
protected:
public:
Therm(void) ; // default constructor
~Therm() ; // default destructor
106
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
void Run(AGA10STRUCT *, Detail *) ; // runs an object based on this class
double Ho(AGA10STRUCT *) ; // ideal gas enthalpy
double So(AGA10STRUCT *) ; // ideal gas entropy
void CprCvrHS(AGA10STRUCT *, Detail *) ; // specific heat capacities + k_ideal + H + S
double H(AGA10STRUCT *, Detail *) ; // real gas specific enthalpy
double S(AGA10STRUCT *, Detail *) ; // real gas specific entropy
void HS_Mode(AGA10STRUCT *, Detail *, double, double, bool) ; // estimates P & T, given H & S
} ;
107
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
//equation constants for ideal gas heat capacity, enthalpy and entropy
const double ThermConstants[NUMBEROFCOMPONENTS[11] =
{{-29776.4, 7.95454, 43.9417, 1037.09, 1.56373, 813.205, -24.9027, 1019.98,-10.1601, 1070.14,-20.0615},
{-3495.34, 6.95587, 0.272892, 662.738,-0.291318,-680.562, 1.78980, 1740.06, 0.0, 100.0, 4.49823},
{ 20.7307, 6.96237, 2.68645, 500.371,-2.56429,-530.443, 3.91921, 500.198, 2.13290, 2197.22, 5.81381},
{-37524.4, 7.98139, 24.3668, 752.320, 3.53990, 272.846, 8.44724, 1020.13,-13.2732, 869.510,-22.4010},
{-56072.1, 8.14319, 37.0629, 735.402, 9.38159, 247.190, 13.4556, 1454.78,-11.7342, 984.518,-24.0426},
{-13773.1, 7.97183, 6.27078, 2572.63, 2.05010, 1156.72, 0.0, 100.0, 0.0, 100.0, -3.24989},
{-10085.4, 7.94680,-0.08380, 433.801, 2.85539, 843.792, 6.31595, 1481.43,-2.88457, 1102.23,-0.51551},
{-5565.60, 6.66789, 2.33458, 2584.98, .749019, 559.656, 0.0, 100.0, 0.0, 100.0, -7.94821},
{-2753.49, 6.95854, 2.02441, 1541.22, .096774, 3674.81, 0.0, 100.0, 0.0, 100.0, 6.23387},
{-3497.45, 6.96302, 2.40013, 2522.05, 2.21752, 1154.15, 0.0, 100.0, 0.0, 100.0, 9.19749},
{-72387.0, 17.8143, 58.2062, 1787.39, 40.7621, 808.645, 0.0, 100.0, 0.0, 100.0, -44.1341},
{-72674.8, 18.6383, 57.4178, 1792.73, 38.6599, 814.151, 0.0, 100.0, 0.0, 100.0, -46.1938},
{-91505.5, 21.3861, 74.3410, 1701.58, 47.0587, 775.899, 0.0, 100.0, 0.0, 100.0, -60.2474},
{-83845.2, 22.5012, 69.5789, 1719.58, 46.2164, 802.174, 0.0, 100.0, 0.0, 100.0, -62.2197},
{-94982.5, 26.6225, 80.3819, 1718.49, 55.6598, 802.069, 0.0, 100.0, 0.0, 100.0, -77.5366},
{-103353., 30.4029, 90.6941, 1669.32, 63.2028, 786.001, 0.0, 100.0, 0.0, 100.0, -92.0164},
{-109674., 34.0847, 100.253, 1611.55, 69.7675, 768.847, 0.0, 100.0, 0.0, 100.0, -106.149},
{-122599., 38.5014, 111.446, 1646.48, 80.5015, 781.588, 0.0, 100.0, 0.0, 100.0, -122.444},
{-133564., 42.7143, 122.173, 1654.85, 90.2255, 785.564, 0.0, 100.0, 0.0, 100.0, -138.006},
{ 0.0, 4.9680, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0 },
{ 0.0, 4.9680, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0 }};
#endif
108
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/*************************************************************************
* File: therm.cpp
* Description: Contains thermodynamic functions for the meter object.
* heat capacity, enthalpy, entropy, sound speed
* Contains the functions:
* Therm(), ~Therm(), Run(), coth(), CpiMolar(), Ho(), So(),
* CprCvrHS(), HS_Mode(), H(), S()
* Version: ver 1.7 2002.11.17
* Author: W.B. Peterson
* Revisions:
* Copyright (c) 2002 American Gas Association
**************************************************************************/
#include "aga10.h"
#include "detail.h"
#include "therm.h"
#include <math.h>
/**************************************************************************
* Function : Therm::Therm()
* Arguments : void
* Returns :
* Purpose : default constructor
* Revisions :
**************************************************************************/
Therm::Therm(void)
{
// initialize 3 history-sensitive variables
dSi = 0.0 ;
dTold = 0.0 ;
dMrxold = 0.0 ;
} // Therm::Therm()
109
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : Therm::~Therm()
* Arguments :
* Returns : default destructor
* Purpose : void
* Revisions :
**************************************************************************/
Therm::~Therm()
{
} // Therm::~Therm()
/**************************************************************************
* Function : coth()
* Arguments : double
* Returns : double
* Purpose : calculate hyperbolic cotangent; used in Ho calculations
* Revisions :
* Notes : Not a Therm object class member, just a utility for this
* file. The C++ language has no intrinsic support for
* hyperbolic cotangent
**************************************************************************/
110
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : Therm::Run()
* Arguments : AGA10STRUCT *, Detail *
* Returns : void
* Purpose : overall execution control; top level math for SOS and k
* Revisions :
**************************************************************************/
// first run basic set of functions within AGA 8 (1994) Detail Method
ptD->Run(ptAGA10) ;
// speed of sound
ptAGA10->dSOS = sqrt(c) ;
111
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
return ;
} // Therm::Run()
/**************************************************************************
* Function : Therm::CpiMolar()
* Arguments : AGA10STRUCT *
* Returns : double
* Purpose : Calculate constant pressure ideal gas molar heat capacity
* in (J/mol-K), applying eqns from Aly, Lee, McFall
* Notes : For continuity, the original constants and eqn's have been
* retained. Conversion from thermochemical calories(th) to
* Joules is applied after the primary calculations are complete.
* Revisions :
**************************************************************************/
112
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
FT = ThermConstants[i][coefF] / T ;
HT = ThermConstants[i][coefH] / T ;
JT = ThermConstants[i][coefJ] / T ;
Cpx += ThermConstants[i][coefB] ;
Cpx += ThermConstants[i][coefC] * Dx * Dx ;
Cpx += ThermConstants[i][coefE] * Fx * Fx ;
Cpx += ThermConstants[i][coefG] * Hx * Hx ;
Cpx += ThermConstants[i][coefI] * Jx * Jx ;
}
// convert from cal(th)/mol-K to J/mol-K
Cp *= CalTH ;
return Cp ;
} // Therm::CpiMolar()
113
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : Therm::Ho()
* Arguments : AGA10STRUCT *
* Returns : double
* Purpose : Calculate ideal gas specific enthalpy (J/kg)
* Notes : For continuity, the original constants and eqn's have been
* retained. Conversion from thermochemical calories(th) to
* Joules is applied after the primary calculations are complete.
* Revisions :
**************************************************************************/
Hx = 0.0 ;
cothDT = coth(DT) ;
tanhFT = tanh(FT) ;
cothHT = coth(HT) ;
tanhJT = tanh(JT) ;
114
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
Hx += ThermConstants[i][coefA] ;
Hx += ThermConstants[i][coefB] * T ;
Hx += ThermConstants[i][coefC] * ThermConstants[i][coefD] * cothDT;
Hx -= ThermConstants[i][coefE] * ThermConstants[i][coefF] * tanhFT;
Hx += ThermConstants[i][coefG] * ThermConstants[i][coefH] * cothHT;
Hx -= ThermConstants[i][coefI] * ThermConstants[i][coefJ] * tanhJT;
// return in J/kg
return H * 1.e3;
} // Therm::Ho()
115
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : Therm::So()
* Arguments : AGA10STRUCT *
* Returns : double
* Purpose : ideal gas specific entropy (J/kg-K)
* Notes : For continuity, the original constants and eqn's have been
* retained. Conversion from thermochemical calories(th) to
* Joules is applied after the primary calculations are complete.
* Revisions :
**************************************************************************/
Sx = 0.0 ;
cothDT = coth(DT) ;
tanhFT = tanh(FT) ;
cothHT = coth(HT) ;
116
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
tanhJT = tanh(JT) ;
sinhDT = sinh(DT) ;
coshFT = cosh(FT) ;
sinhHT = sinh(HT) ;
coshJT = cosh(JT) ;
Sx += ThermConstants[i][coefK] ;
Sx += ThermConstants[i][coefB] * log(T) ;
Sx += ThermConstants[i][coefC] * (DT * cothDT - log(sinhDT)) ;
Sx -= ThermConstants[i][coefE] * (FT * tanhFT - log(coshFT)) ;
Sx += ThermConstants[i][coefG] * (HT * cothHT - log(sinhHT)) ;
Sx -= ThermConstants[i][coefI] * (JT * tanhJT - log(coshJT)) ;
// return in J/kg-K
return S * 1.e3;
} // Therm::So()
117
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : Therm::CprCvrHS()
* Arguments : AGA10STRUCT *, Detail *
* Returns : void
* Purpose : reasonably efficient group calculation of Cp, Cv, H and S
* Revisions :
**************************************************************************/
118
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
{
// set calculation point at + abscissa
x = ptAGA10->dDf * (1.0 + GK_root[i]) / 2.0 ;
// get Z at D
ptD->zdetail(x) ;
ptD->dZdT(x) ;
ptD->d2ZdT2(x) ;
// complete Cv molar
Cvr = Cp - RGAS * (1.0 + ptAGA10->dTf * Cvinc * 0.5 * ptAGA10->dDf) ;
119
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
dPdT = RGAS * ptAGA10->dDf * a ;
return ;
} // Therm::CprCvrHS()
120
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : Therm::HS_Mode()
* Arguments : AGA10STRUCT *, Detail *, double, double, bool
* Returns : void
* Purpose : Calculates a pressure & temperature from known enthalpy & entropy,
* with or without prior estimates.This function has a role in the
* calculation of C*.
* Solution based on a doubly-nested trial & error algorithm and Newton's
* method.
*
* For illustrative purpose, two approaches are supported by this example.
* If you are starting without advance knowledge of P & T, set the input parm
* bGuess to false, thus specifying a conservative search approach.
* If, however, you have a basis for guessing P & T (plenum conditions of a
* critical flow nozzle, for example) set P & T via AGA10STRUCT and set
* bGuess = true. The initial guess allows the search function to be more
* aggressive and, typically, faster.
*
* Revisions :
**************************************************************************/
// calling function specifies whether search parameters are supplied thru ptAGA10 or unknown
if (bGuess)
{
t1 = ptAGA10->dTf ;
px = ptAGA10->dPf ;
pmax = px * 2.0 ;
pmin = px * 0.1 ;
121
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
tmax = t1 * 1.5 ;
tmin = t1 * 0.67 ;
}
else // use arbitrary, generic limits
{
t1 = 273.15 ;
px = 1013250.0 ; // 10 atmospheres
pmax = P_MAX ;
pmin = 10000.0 ; // 10 kPa
tmax = T_MAX ;
tmin = T_MIN ;
}
///////////////////////////////////////////
// begin double trial-and-error, searching for T & P
// run the calculation with initial guesses
ptD->Run(ptAGA10) ;
122
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
delta2 = fabs(s1 - s2) / s0 ;
// close enough?
if (delta2 < tolerance) break ;
// revise our estimate to p2
p0 = p2 ;
p2 = (p1 * s2 - p2 * s1) / (s2 - s1) ;
// check for negative pressure and clamp to pmin for safety
if (p2 <= pmin)
{
p2 = pmin ;
}
// check if we've created an unrealistic pressure
if (p2 >= pmax ) p2 = pmax ;
// swap values
p1 = p0 ;
s1 = s2 ;
}
// check for failure to converge
if (j >= MAX_NUM_OF_ITERATIONS) ptAGA10->lStatus = MAX_NUM_OF_ITERATIONS_EXCEEDED ;
// close enough?
if (delta1 < tolerance && i > 0) break ;
123
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
ptAGA10->dTf = t2 ;
ptD->Run(ptAGA10) ;
h2 = this->H(ptAGA10, ptD) - h0 ;
}
t1 = t0 ;
h1 = h2 ;
}
// check for failure to converge
if (i >= MAX_NUM_OF_ITERATIONS) ptAGA10->lStatus = MAX_NUM_OF_ITERATIONS_EXCEEDED ;
} // Therm::HS_Mode()
/**************************************************************************
* Function : Therm::H()
* Arguments : AGA10STRUCT *, Detail *
* Returns : double
* Purpose : real gas specific enthalpy
* Revisions :
**************************************************************************/
// initialize integral
Hinc = 0.0 ;
124
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
ptD->d2ZdT2(x) ;
ptD->zdetail(ptAGA10->dDf) ;
ptD->dZdT(ptAGA10->dDf) ;
ptD->d2ZdT2(ptAGA10->dDf) ;
return(ptAGA10->dH) ;
} // Therm::H()
125
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : Therm::S()
* Arguments : AGA10STRUCT *, Detail *
* Returns : double
* Purpose : real gas specific entropy
* Revisions :
**************************************************************************/
// initialize integral
Sinc = 0.0 ;
126
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
// find ideal gas entropy, but only if temperature or composition have changed
if (ptAGA10->dTf != dTold || ptAGA10->dMrx != dMrxold)
{
dSi = So(ptAGA10) ;
dTold = ptAGA10->dTf ;
dMrxold = ptAGA10->dMrx ;
}
return(ptAGA10->dS) ;
} // Therm::S()
127
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/*************************************************************************
*
* File : entry.cpp
* Purpose : This file contains the startup code for aga10.dll
* and is only required for Windows DLL creation.
* Project : AGA10 DLL
* Version : ver 1.7 2002.11.17
* Author : W.B. Peterson
* Revisions:
* Copyright (c) 2002 American Gas Association
*
**************************************************************************/
#include <windows.h>
128
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
// File : script1.rc
// Description : resource script for aga10 dll
// Version : 1.7 2002.11.17
// Author : W.B. Peterson
// Revisions :
// Copyright (c) 2002 American Gas Association
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,7,0,0
PRODUCTVERSION 1,7,0,0
FILEFLAGSMASK 0x3fL
129
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
#ifdef _DEBUG
FILEFLAGS 0x21L
#else
FILEFLAGS 0x20L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "Post-Ballot Version\0"
VALUE "CompanyName", "American Gas Association\0"
VALUE "FileDescription", "aga10\0"
VALUE "FileVersion", "1, 7, 0, 0\0"
VALUE "InternalName", "aga10\0"
VALUE "LegalCopyright", "Copyright © 2002 American Gas Association\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "aga10.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "AGA10.DLL\0"
VALUE "ProductVersion", "1, 6, 0, 0\0"
VALUE "SpecialBuild", "2002.11.17 Build\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
130
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
131
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
File Group #2 - Example Windows Application
132
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/*************************************************************************
* File : aga10win.h
* Description : function prototypes and defines for aga10win.cpp
* Version : 1.7 2002.11.17
* Author : W.B. Peterson
* Revisions :
* Copyright (c) 2002 American Gas Association
**************************************************************************/
#ifndef _AGA10WIN_H
#define _AGA10WIN_H
#include <windows.h>
#include <commdlg.h>
133
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
#define IDC_TB 43
#define IDC_PF 44
#define IDC_TF 45
#define IDC_MRX 46
#define IDC_ZB 47
#define IDC_ZF 48
#define IDC_FPV 49
#define IDC_DB 50
#define IDC_DF 51
#define IDC_RHOB 52
#define IDC_RHOF 53
#define IDC_RD_IDEAL 54
#define IDC_RD_REAL 55
#define IDC_HO 56
#define IDC_H 57
#define IDC_S 58
#define IDC_CPI 59
#define IDC_CP 60
#define IDC_CV 61
#define IDC_K 62
#define IDC_KAPPA 63
#define IDC_SOS 64
#define IDC_CSTAR 65
#define IDC_PB_U 66
#define IDC_TB_U 67
#define IDC_PF_U 68
#define IDC_TF_U 69
#define IDC_SOS_U 70
#define IDC_RHOB_U 71
#define IDC_RHOF_U 72
#define IDC_ENTHALPY_U 73
#define IDC_ENTROPY_U 74
#define IDC_TOTAL 75
#define IDC_CLEAR 76
#define IDC_NORMALIZE 77
#define KILOPASCAL 78
#define MEGAPASCAL 79
#define PSI 80
#define KELVIN 81
#define CELSIUS 82
134
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
#define RANKINE 83
#define FAHRENHEIT 84
#define KGPERCUBICMETRE 85
#define LBMPERCUBICFOOT 86
#define METREPERSECOND 87
#define FOOTPERSECOND 88
#define KJPERKG 89
#define BTUPERLBM 90
#define KJPERKGK 91
#define BTUPERLBMF 92
#define CM_FILEOPEN 93
#define CM_FILESAVE 94
#define CM_FILESAVEAS 95
#define CM_HELPABOUT 96
#define IDR_MENU1 97
#define IDC_STATIC (-1)
/* buffer sizes */
#define FIELD40 40
#define FIELD30 30
/* function prototypes */
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
void PressureDlgHelp(HWND) ;
void TemperatureDlgHelp(HWND) ;
void DensityDlgHelp(HWND) ;
void SOSDlgHelp(HWND) ;
void EnthalpyDlgHelp(HWND) ;
void EntropyDlgHelp(HWND) ;
void FileInitialize (HWND) ;
BOOL FileOpenDlg (HWND, PSTR, PSTR) ;
BOOL FileSaveDlg (HWND, PSTR, PSTR) ;
#endif
135
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/*************************************************************************
* File : aga10win.cpp
* Description : Simple Win32 program demonstrating use of aga10.dll
* Supports Windows dialog box and file operations
* Version : 1.7 2002.11.17
* Author : W.B. Peterson
* Revisions :
* Copyright (c) 2002 American Gas Association
**************************************************************************/
#include "aga10win.h"
#include "aga10.h"
136
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
void ReadInputs(HWND, AGA10STRUCT *) ;
void WriteInputs(HWND, AGA10STRUCT *) ;
void WriteOutputs(HWND, AGA10STRUCT *) ;
void SetDefaults(AGA10STRUCT *) ;
/**************************************************************************
* Function : WinMain()
* Arguments : HINSTANCE, HINSTANCE, PSTR, int
* Returns : int
* Purpose : Every Windows application has a WinMain()
* Revisions :
**************************************************************************/
137
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : WndProc()
* Arguments : HWND, UINT, WPARAM, LPARAM
* Returns : LRESULT
* Purpose : One and only window process for this app
* Revisions :
**************************************************************************/
LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
int i = 0 ;
double temp ;
switch (iMsg)
{
case WM_CREATE :
/* get application instance */
hInst = ((LPCREATESTRUCT) lParam)->hInstance ;
138
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
SetDefaults(A10) ;
return FALSE ;
case WM_COMMAND :
/* refresh the input data, triggered by focus change */
if (lParam && HIWORD (wParam) == EN_KILLFOCUS)
{
ReadInputs(hwnd, A10) ;
WriteInputs(hwnd, A10) ;
lstrcpy(szBuffer, "Press Calculate") ;
SetDlgItemText (hwnd, IDC_LSTATUS, szBuffer) ;
return FALSE ;
}
139
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
lstrcpy(szBuffer, "Error. Pf out of range.") ;
SetDlgItemText (hwnd, IDC_LSTATUS, szBuffer) ;
return FALSE ;
}
case IDC_CLEAR :
/* zero out the composition and then display it */
for (i = 0 ; i < NUMBEROFCOMPONENTS ; i++) A10->adMixture[i] = 0.0 ;
WriteInputs(hwnd, A10) ;
return FALSE ;
case IDC_NORMALIZE :
// normalize the composition to equal 1.0000
ReadInputs(hwnd, A10) ;
temp = 0.0 ;
// find the current sum of fractions
for (i = 0 ; i < NUMBEROFCOMPONENTS ; i++) temp += A10->adMixture[i] ;
// adjust each non-zero entry by the required proportion
for (i = 0 ; i < NUMBEROFCOMPONENTS ; i++)
140
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
if (A10->adMixture[i] > 0.0) A10->adMixture[i] /= temp ;
// write the adjusted values to the screen
WriteInputs(hwnd, A10) ;
return FALSE ;
case IDCANCEL :
/* start tear-down process */
SendMessage(hwnd, WM_CLOSE, 0,0L) ;
return FALSE ;
case IDRETRY :
// reset the defaults
SetDefaults(A10) ;
case CM_FILEOPEN :
// standard Windows file operations
GetFileTitle (szFileName, szTitleName, sizeof (szTitleName)) ;
if (FileOpenDlg (hwnd, szFileName, szTitleName))
{
if (!FileRead (hwnd, szFileName, A10))
{
MessageBox(hwnd,"Could not read file.", szTitleName,
MB_OK | MB_ICONSTOP) ;
}
}
else return FALSE ;
141
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
return FALSE ;
case CM_FILESAVE :
// standard Windows file operations
GetFileTitle (szFileName, szTitleName, sizeof (szTitleName)) ;
if (szFileName[0])
{
if (FileWrite(hwnd, szFileName, A10))
{
return TRUE ;
}
else
{
MessageBox(hwnd,"Could not write file.", szTitleName,
MB_OK | MB_ICONSTOP) ;
}
return FALSE ;
}
// fall through
case CM_FILESAVEAS :
// standard Windows file operations
GetFileTitle (szFileName, szTitleName, sizeof (szTitleName)) ;
if (FileSaveDlg (hwnd, szFileName, szTitleName))
{
if (FileWrite (hwnd, szFileName, A10))
{
return 1 ;
}
else
{
MessageBox(hwnd,"Could not write file.", szTitleName,
MB_OK | MB_ICONSTOP) ;
}
}
return FALSE ;
case CM_HELPABOUT :
MessageBox (hwnd,
142
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
"AGA10win.exe and AGA10.dll (c) American Gas Association, 2002",
szAppName, MB_OK | MB_ICONINFORMATION) ;
return FALSE ;
}
return FALSE ;
case WM_CLOSE :
/* un-initialize the calculation library */
AGA10_UnInit() ;
case WM_DESTROY :
/* final message exhange with Windows during shut-down */
PostQuitMessage (0) ;
return FALSE ;
}
return DefWindowProc (hwnd, iMsg, wParam, lParam) ;
}
143
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/*************************************************************************
* File : file.cpp
* Description : Supports file access to AGA10 functions
* Author : W.B. Peterson
* Version : 1.7 2002.11.17
* Revisions :
* Copyright (c) 2002 American Gas Association
**************************************************************************/
#include "aga10.h"
/**************************************************************************
* Function : FileInitialize()
* Arguments : HWND
* Returns : void
* Purpose : Prepares for Windows file access
* Revisions :
**************************************************************************/
144
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
ofn.nMaxFileTitle = _MAX_FNAME + _MAX_EXT ;
ofn.lpstrInitialDir = NULL ;
ofn.lpstrTitle = NULL ;
ofn.Flags = 0 ;
ofn.nFileOffset = 0 ;
ofn.nFileExtension = 0 ;
ofn.lpstrDefExt = szExt ;
ofn.lCustData = 0L ;
ofn.lpfnHook = NULL ;
ofn.lpTemplateName = NULL ;
}
/**************************************************************************
* Function : FileOpenDlg()
* Arguments : HWND, PSTR, PSTR
* Returns : BOOL
* Purpose : Access common controls for file-open operation
* Revisions :
**************************************************************************/
/**************************************************************************
* Function : FileSaveDlg()
* Arguments : HWND, PSTR, PSTR
* Returns : BOOL
* Purpose : Access common controls for file-save operation
* Revisions :
**************************************************************************/
145
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : FileRead()
* Arguments : HWND, PSTR, AGA10STRUCT
* Returns : bool
* Purpose : Reads contents of a .sos file into a AGA10STRUCT
* Revisions :
**************************************************************************/
146
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
fclose (file) ;
return false ;
}
}
/**************************************************************************
* Function : FileWrite()
* Arguments : HWND, PSTR, AGA10STRUCT
* Returns : bool
* Purpose : Writes contents of a AGA10STRUCT into a .vos file
* Revisions :
**************************************************************************/
147
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/*************************************************************************
* File : dlghlp.cpp
* Description : Helper functions for aga10win main dialog box
* Version : 1.7 2002.11.17
* Author : W.B. Peterson
* Revisions :
* Copyright (c) 2002 American Gas Association
**************************************************************************/
#include "aga10win.h"
#include "aga10.h"
/**************************************************************************
* Function : WriteInputs()
* Arguments : HWND
* Returns : void
* Purpose : Function for writing the input fields of the main window
* Notes : Uses non-portable, run-time library function _gcvt()
* for converting strings to double precision floats.
* Revisions :
**************************************************************************/
148
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
HWND hListBox;
int i ;
double Pbx, Tbx, Pfx, Tfx ;
case MEGAPASCAL :
Pbx = A10->dPb * 1.0e-6 ;
break ;
case PSI :
Pbx = A10->dPb / 6894.75729 ;
}
case MEGAPASCAL :
Pfx = A10->dPf * 1.0e-6 ;
break ;
case PSI :
Pfx = A10->dPf / 6894.75729 ;
}
149
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
case FAHRENHEIT :
Tbx = (A10->dTb * 1.8) - 459.67 ;
break ;
case KELVIN :
Tbx = A10->dTb ;
break ;
case RANKINE :
Tbx = A10->dTb * 1.8 ;
}
case FAHRENHEIT :
Tfx = (A10->dTf * 1.8) - 459.67 ;
break ;
case KELVIN :
Tfx = A10->dTf ;
break ;
case RANKINE :
Tfx = A10->dTf * 1.8 ;
}
// Pb
_gcvt (Pbx, 9, szBuffer);
SetDlgItemText (hDlg, IDC_PB, szBuffer) ;
// Tb
_gcvt (Tbx, 9, szBuffer);
SetDlgItemText (hDlg, IDC_TB, szBuffer) ;
// Pf
_gcvt (Pfx, 9, szBuffer);
150
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
SetDlgItemText (hDlg, IDC_PF, szBuffer) ;
// Tf
_gcvt (Tfx, 9, szBuffer);
SetDlgItemText (hDlg, IDC_TF, szBuffer) ;
// composition
_gcvt (A10->adMixture[XiC1] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XIC1, szBuffer) ;
_gcvt (A10->adMixture[XiN2] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XIN2, szBuffer) ;
_gcvt (A10->adMixture[XiCO2] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XICO2, szBuffer) ;
_gcvt (A10->adMixture[XiC2] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XIC2, szBuffer) ;
_gcvt (A10->adMixture[XiC3] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XIC3, szBuffer) ;
_gcvt (A10->adMixture[XiH2O] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XIH2O, szBuffer) ;
_gcvt (A10->adMixture[XiH2S] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XIH2S, szBuffer) ;
_gcvt (A10->adMixture[XiH2] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XIH2, szBuffer) ;
_gcvt (A10->adMixture[XiCO] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XICO, szBuffer) ;
_gcvt (A10->adMixture[XiO2] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XIO2, szBuffer) ;
_gcvt (A10->adMixture[XiIC4] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XIIC4, szBuffer) ;
_gcvt (A10->adMixture[XiNC4] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XINC4, szBuffer) ;
_gcvt (A10->adMixture[XiIC5] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XIIC5, szBuffer) ;
_gcvt (A10->adMixture[XiNC5] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XINC5, szBuffer) ;
_gcvt (A10->adMixture[XiNC6] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XINC6, szBuffer) ;
_gcvt (A10->adMixture[XiNC7] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XINC7, szBuffer) ;
_gcvt (A10->adMixture[XiNC8] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XINC8, szBuffer) ;
_gcvt (A10->adMixture[XiNC9] * 100.0, 9, szBuffer);
151
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
SetDlgItemText (hDlg, IDC_XINC9, szBuffer) ;
_gcvt (A10->adMixture[XiNC10] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XINC10, szBuffer) ;
_gcvt (A10->adMixture[XiHe] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XIHE, szBuffer) ;
_gcvt (A10->adMixture[XiAr] * 100.0, 9, szBuffer);
SetDlgItemText (hDlg, IDC_XIAR, szBuffer) ;
152
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
SendMessage(hListBox, CB_SELECTSTRING, -1,(LONG)(LPSTR)szBuffer) ;
/**************************************************************************
* Function : WriteInputs()
* Arguments : HWND
* Returns : void
* Purpose : Function for writing the input fields of the main window
* Notes : Uses non-portable, run-time library function _gcvt()
* for converting strings to double precision floats.
* Revisions :
**************************************************************************/
case LBMPERCUBICFOOT :
153
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
Rhofx = (A10->dRhof / 0.45359237) * pow(0.3048, 3.0) ;
}
case FOOTPERSECOND :
SOSx = A10->dSOS / 0.3048 ;
}
case BTUPERLBM :
Enthalpyx = A10->dH / ((5000./9.) * 4.1868) ;
}
case BTUPERLBMF :
Entropyx = A10->dS / (1.0e3 * 4.1868) ;
}
154
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
_gcvt (SOSx, 9, szBuffer);
SetDlgItemText (hDlg, IDC_SOS, szBuffer) ;
155
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
SetDlgItemText (hDlg, IDC_HO, szBuffer) ;
/**************************************************************************
* Function : ReadInputs()
* Arguments : HWND
* Returns : void
* Purpose : Function for reading the input fields of the main window
* Revisions :
**************************************************************************/
156
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
//Pb
GetDlgItemText(hDlg, IDC_PB, szBuffer, FIELD30) ;
hListBox = GetDlgItem(hDlg, IDC_PB_U) ;
iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ;
switch (iSelection)
{
case 0 :
lPb_unit = KILOPASCAL ;
A10->dPb = strtod(szBuffer, &stopstr) * 1.0e3 ;
break ;
case 1 :
lPb_unit = MEGAPASCAL ;
A10->dPb = strtod(szBuffer, &stopstr) * 1.0e6 ;
break ;
case 2 :
lPb_unit = PSI ;
A10->dPb = strtod(szBuffer, &stopstr) * 6894.75729 ;
}
//Pf
GetDlgItemText(hDlg, IDC_PF, szBuffer, FIELD30) ;
hListBox = GetDlgItem(hDlg, IDC_PF_U) ;
iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ;
switch (iSelection)
{
case 0 :
lPf_unit = KILOPASCAL ;
A10->dPf = strtod(szBuffer, &stopstr) * 1.0e3 ;
break ;
case 1 :
lPf_unit = MEGAPASCAL ;
A10->dPf = strtod(szBuffer, &stopstr) * 1.0e6 ;
157
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
break ;
case 2 :
lPf_unit = PSI ;
A10->dPf = strtod(szBuffer, &stopstr) * 6894.75729 ;
}
//Tb
GetDlgItemText(hDlg, IDC_TB, szBuffer, FIELD30) ;
hListBox = GetDlgItem(hDlg, IDC_TB_U) ;
iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ;
switch (iSelection)
{
case 0 :
lTb_unit = CELSIUS ;
A10->dTb = strtod(szBuffer, &stopstr) + 273.15;
break ;
case 1 :
lTb_unit = FAHRENHEIT ;
A10->dTb = (strtod(szBuffer, &stopstr) + 459.67) / 1.8 ;
break ;
case 2 :
lTb_unit = KELVIN ;
A10->dTb = strtod(szBuffer, &stopstr) ;
break ;
case 3 :
lTb_unit = RANKINE ;
A10->dTb = strtod(szBuffer, &stopstr) / 1.8;
}
//Tf
GetDlgItemText(hDlg, IDC_TF, szBuffer, FIELD30) ;
hListBox = GetDlgItem(hDlg, IDC_TF_U) ;
iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ;
switch (iSelection)
{
case 0 :
lTf_unit = CELSIUS ;
A10->dTf = strtod(szBuffer, &stopstr) + 273.15;
break ;
158
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
case 1 :
lTf_unit = FAHRENHEIT ;
A10->dTf = (strtod(szBuffer, &stopstr) + 459.67) / 1.8 ;
break ;
case 2 :
lTf_unit = KELVIN ;
A10->dTf = strtod(szBuffer, &stopstr) ;
break ;
case 3 :
lTf_unit = RANKINE ;
A10->dTf = strtod(szBuffer, &stopstr) / 1.8;
}
//Rhof
hListBox = GetDlgItem(hDlg, IDC_RHOF_U) ;
iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ;
switch (iSelection)
{
case 0 :
lRhof_unit = KGPERCUBICMETRE ;
break ;
case 1 :
lRhof_unit = LBMPERCUBICFOOT ;
}
//SOS
hListBox = GetDlgItem(hDlg, IDC_SOS_U) ;
iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ;
switch (iSelection)
{
case 0 :
lSOS_unit = METREPERSECOND ;
break ;
case 1 :
lSOS_unit = FOOTPERSECOND ;
}
//Enthalpy
hListBox = GetDlgItem(hDlg, IDC_ENTHALPY_U) ;
iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ;
159
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
switch (iSelection)
{
case 0 :
lEnthalpy_unit = KJPERKG ;
break ;
case 1 :
lEnthalpy_unit = BTUPERLBM ;
}
//Entropy
hListBox = GetDlgItem(hDlg, IDC_ENTROPY_U) ;
iSelection = SendMessage(hListBox, CB_GETCURSEL, 0,0) ;
switch (iSelection)
{
case 0 :
lEntropy_unit = KJPERKGK ;
break ;
case 1 :
lEntropy_unit = BTUPERLBMF ;
}
// composition
GetDlgItemText(hDlg,IDC_XIC1, szBuffer, FIELD30) ;
A10->adMixture[XiC1] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XIN2, szBuffer, FIELD30) ;
A10->adMixture[XiN2] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XICO2, szBuffer, FIELD30) ;
A10->adMixture[XiCO2] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XIC2, szBuffer, FIELD30) ;
A10->adMixture[XiC2] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XIC3, szBuffer, FIELD30) ;
A10->adMixture[XiC3] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XIH2O, szBuffer, FIELD30) ;
A10->adMixture[XiH2O] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XIH2S, szBuffer, FIELD30) ;
A10->adMixture[XiH2S] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XIH2, szBuffer, FIELD30) ;
A10->adMixture[XiH2] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XICO, szBuffer, FIELD30) ;
A10->adMixture[XiCO] = strtod(szBuffer, &stopstr) * 0.01 ;
160
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
GetDlgItemText(hDlg,IDC_XIO2, szBuffer, FIELD30) ;
A10->adMixture[XiO2] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XIIC4, szBuffer, FIELD30) ;
A10->adMixture[XiIC4] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XINC4, szBuffer, FIELD30) ;
A10->adMixture[XiNC4] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XIIC5, szBuffer, FIELD30) ;
A10->adMixture[XiIC5] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XINC5, szBuffer, FIELD30) ;
A10->adMixture[XiNC5] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XINC6, szBuffer, FIELD30) ;
A10->adMixture[XiNC6] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XINC7, szBuffer, FIELD30) ;
A10->adMixture[XiNC7] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XINC8, szBuffer, FIELD30) ;
A10->adMixture[XiNC8] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XINC9, szBuffer, FIELD30) ;
A10->adMixture[XiNC9] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XINC10, szBuffer, FIELD30) ;
A10->adMixture[XiNC10] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XIHE, szBuffer, FIELD30) ;
A10->adMixture[XiHe] = strtod(szBuffer, &stopstr) * 0.01 ;
GetDlgItemText(hDlg,IDC_XIAR, szBuffer, FIELD30) ;
A10->adMixture[XiAr] = strtod(szBuffer, &stopstr) * 0.01 ;
/**************************************************************************
* Function : PressureDlgHelp()
* Arguments : HWND
* Returns : void
* Purpose : Helper function for loading strings into pressure
* drop-list controls
* Revisions :
**************************************************************************/
161
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
/**************************************************************************
* Function : TemperatureDlgHelp()
* Arguments : HWND
* Returns : void
* Purpose : Helper function for loading strings into temperature
* drop-list controls
* Revisions :
**************************************************************************/
/**************************************************************************
* Function : DensityDlgHelp()
* Arguments : HWND
* Returns : void
* Purpose : Helper function for loading strings into density
* drop-list controls
162
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
* Revisions :
**************************************************************************/
/**************************************************************************
* Function : SOSDlgHelp()
* Arguments : HWND
* Returns : void
* Purpose : Helper function for loading strings into SOS
* drop-list controls
* Revisions :
**************************************************************************/
/**************************************************************************
* Function : EnthalpyDlgHelp()
* Arguments : HWND
* Returns : void
* Purpose : Helper function for loading strings into enthalpy
* drop-list controls
* Revisions :
**************************************************************************/
163
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
{
LoadString(hInst, KJPERKG, szBuffer, FIELD40) ;
SendMessage(hListBox, CB_INSERTSTRING, 0, (LONG)(LPSTR) szBuffer) ;
LoadString(hInst, BTUPERLBM, szBuffer, FIELD40) ;
SendMessage(hListBox, CB_INSERTSTRING, 1, (LONG)(LPSTR) szBuffer) ;
}
/**************************************************************************
* Function : EntropyDlgHelp()
* Arguments : HWND
* Returns : void
* Purpose : Helper function for loading strings into entropy
* drop-list controls
* Revisions :
**************************************************************************/
/**************************************************************************
* Function : SetDefaults()
* Arguments : void
* Returns : void
* Purpose : initializes AGA10STRUCT and units of measure
* Revisions :
**************************************************************************/
164
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
A10->adMixture[XiC1] = 0.906724; /* AMARILLO example composition...*/
A10->adMixture[XiN2] = 0.031284;
A10->adMixture[XiCO2] = 0.004676;
A10->adMixture[XiC2] = 0.045279;
A10->adMixture[XiC3] = 0.00828;
A10->adMixture[XiH2O] = 0.0;
A10->adMixture[XiH2S] = 0.0;
A10->adMixture[XiH2] = 0.0;
A10->adMixture[XiCO] = 0.0;
A10->adMixture[XiO2] = 0.0;
A10->adMixture[XiIC4] = 0.001037;
A10->adMixture[XiNC4] = 0.001563;
A10->adMixture[XiIC5] = 0.000321;
A10->adMixture[XiNC5] = 0.000443;
A10->adMixture[XiNC6] = 0.000393;
A10->adMixture[XiNC7] = 0.0;
A10->adMixture[XiNC8] = 0.0;
A10->adMixture[XiNC9] = 0.0;
A10->adMixture[XiNC10] = 0.0;
A10->adMixture[XiHe] = 0.0;
A10->adMixture[XiAr] = 0.0;
165
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
// File : resource.h
// Description : header file used for Windows resource file
// Version : 1.7 2002.11.17
// Author : W.B. Peterson
// Revisions :
// Copyright (c) 2002 American Gas Association
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by aga10win.rc
//
166
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
// File : aga10win.rc
// Description : resource script for aga10win’s interface
// Version : 1.7 2002.11.17
// Author : W.B. Peterson
// Revisions :
// Copyright (c) 2002 American Gas Association
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
#include "aga10win.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
167
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
AGA10WIN ICON DISCARDABLE "aga10win.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
168
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
EDITTEXT IDC_TB,34,215,60,14,ES_AUTOHSCROLL
COMBOBOX IDC_TB_U,98,216,60,44,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_PF,191,196,60,14,ES_AUTOHSCROLL
COMBOBOX IDC_PF_U,254,196,60,44,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_TF,191,215,60,14,ES_AUTOHSCROLL
COMBOBOX IDC_TF_U,255,215,60,44,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "Calculate",IDOK,137,282,50,20
PUSHBUTTON "Initialize",IDRETRY,61,282,50,20
PUSHBUTTON "Quit",IDCANCEL,213,282,50,20,WS_GROUP
GROUPBOX "Composition (Mole Percent)",IDC_STATIC,5,3,322,175
LTEXT "Helium",IDC_STATIC,21,18,28,8,NOT WS_GROUP
LTEXT "Hydrogen",IDC_STATIC,21,36,32,8,NOT WS_GROUP
LTEXT "Nitrogen",IDC_STATIC,21,55,28,8,NOT WS_GROUP
LTEXT "CO2",IDC_STATIC,22,71,15,8,NOT WS_GROUP
LTEXT "H2S",IDC_STATIC,22,89,15,8,NOT WS_GROUP
LTEXT "Methane",IDC_STATIC,22,108,29,8,NOT WS_GROUP
LTEXT "Ethane",IDC_STATIC,22,126,24,8,NOT WS_GROUP
LTEXT "Propane",IDC_STATIC,116,18,28,8,NOT WS_GROUP
LTEXT "i-Butane",IDC_STATIC,116,37,27,8,NOT WS_GROUP
LTEXT "n-Butane",IDC_STATIC,116,55,30,8,NOT WS_GROUP
LTEXT "i-Pentane",IDC_STATIC,116,72,31,8,NOT WS_GROUP
LTEXT "n-Pentane",IDC_STATIC,115,92,34,8,NOT WS_GROUP
LTEXT "n-Hexane",IDC_STATIC,115,110,32,8,NOT WS_GROUP
LTEXT "n-Heptane",IDC_STATIC,115,128,34,8,NOT WS_GROUP
LTEXT "n-Octane",IDC_STATIC,218,19,30,8,NOT WS_GROUP
LTEXT "n-Nonane",IDC_STATIC,218,37,32,8,NOT WS_GROUP
LTEXT "n-Decane",IDC_STATIC,218,55,32,8,NOT WS_GROUP
LTEXT "Argon",IDC_STATIC,219,73,27,8,NOT WS_GROUP
LTEXT "Water",IDC_STATIC,219,91,23,8,NOT WS_GROUP
LTEXT "CO",IDC_STATIC,219,109,11,8,NOT WS_GROUP
LTEXT "O2",IDC_STATIC,219,128,24,8,NOT WS_GROUP
LTEXT "TOTAL",IDC_STATIC,218,147,24,8,NOT WS_GROUP
LTEXT "Static",IDC_TOTAL,259,146,44,12,SS_SUNKEN | NOT
WS_GROUP
GROUPBOX "Gas Temperature and Absolute Pressure",IDC_STATIC,6,182,
322,56
LTEXT "Pb",IDC_STATIC,12,199,10,8
169
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
LTEXT "Tb",IDC_STATIC,11,217,10,8
LTEXT "Pf",IDC_STATIC,177,199,8,8
LTEXT "Tf",IDC_STATIC,176,217,8,8
GROUPBOX "Calculation Results",IDC_STATIC,334,3,234,306
LTEXT "Speed of Sound",IDC_STATIC,348,24,52,8
LTEXT "Zf",IDC_STATIC,348,173,8,8
LTEXT "Zb",IDC_STATIC,348,158,10,8
LTEXT "Fpv",IDC_STATIC,348,187,13,8
LTEXT "Cp (real gas)",IDC_STATIC,348,232,40,8
LTEXT "Cv (real gas)",IDC_STATIC,348,248,40,8
LTEXT "Cp/Cv",IDC_STATIC,348,264,22,8
LTEXT "Isentropic Exponent",IDC_STATIC,348,53,67,8
LTEXT "Mass Density",IDC_STATIC,348,113,43,8
LTEXT "Molar Density",IDC_STATIC,348,98,44,8
LTEXT "Specific Enthalpy",IDC_STATIC,348,68,56,8
LTEXT "Specific Entropy",IDC_STATIC,348,83,52,8
LTEXT "Enthalpy (ideal gas)",IDC_STATIC,348,280,62,8
LTEXT "Cp (ideal gas)",IDC_STATIC,348,216,44,8
LTEXT "Molar Mass",IDC_STATIC,348,201,37,8
LTEXT "0",IDC_SOS,422,24,50,8,NOT WS_GROUP
LTEXT "0",IDC_H,422,69,50,8,NOT WS_GROUP
LTEXT "0",IDC_S,422,83,50,8,NOT WS_GROUP
LTEXT "0",IDC_DF,422,99,60,8,NOT WS_GROUP
LTEXT "0",IDC_RHOF,422,113,55,8,NOT WS_GROUP
LTEXT "0",IDC_ZB,422,157,50,8,NOT WS_GROUP
LTEXT "0",IDC_ZF,422,171,50,8,NOT WS_GROUP
LTEXT "0",IDC_FPV,422,186,50,8,NOT WS_GROUP
LTEXT "0",IDC_MRX,422,201,50,8,NOT WS_GROUP
LTEXT "0",IDC_CPI,422,216,50,8,NOT WS_GROUP
LTEXT "0",IDC_HO,422,280,50,8,NOT WS_GROUP
LTEXT "0",IDC_CP,422,232,50,8,NOT WS_GROUP
LTEXT "0",IDC_CV,422,248,50,8,NOT WS_GROUP
LTEXT "0",IDC_K,422,264,50,8,NOT WS_GROUP
LTEXT "0",IDC_KAPPA,422,53,50,8,NOT WS_GROUP
LTEXT "moles/dm3",IDC_STATIC,483,98,32,8
LTEXT "kJ/kg-K",IDC_STATIC,483,216,26,8
LTEXT "kJ/kg",IDC_STATIC,483,280,20,8
LTEXT "RD (ideal gas)",IDC_STATIC,348,128,46,8
LTEXT "RD (real gas)",IDC_STATIC,348,143,42,8
LTEXT "0",IDC_RD_IDEAL,422,128,50,8,NOT WS_GROUP
170
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
LTEXT "0",IDC_RD_REAL,422,143,50,8,NOT WS_GROUP
LTEXT "Press Initialize Button to Begin",IDC_LSTATUS,106,259,
107,8
LTEXT "kJ/kg-K",IDC_STATIC,483,232,26,8
LTEXT "kJ/kg-K",IDC_STATIC,483,248,26,8
LTEXT "C*",IDC_STATIC,348,39,10,8
LTEXT "0",IDC_CSTAR,422,39,58,8
COMBOBOX IDC_SOS_U,482,21,80,43,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_RHOF_U,482,111,80,44,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_ENTHALPY_U,482,66,80,40,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_ENTROPY_U,482,82,80,37,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
GROUPBOX "Current Status",IDC_STATIC,5,247,322,27
PUSHBUTTON "Normalize",IDC_NORMALIZE,118,149,60,20
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""aga10win.h""\r\n"
"\0"
END
171
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
"AGA10WIN", DIALOG
BEGIN
LEFTMARGIN, 5
RIGHTMARGIN, 568
BOTTOMMARGIN, 309
END
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,7,0,0
PRODUCTVERSION 1,7,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x21L
#else
172
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
FILEFLAGS 0x20L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "Post Ballot Version\0"
VALUE "CompanyName", "American Gas Association\0"
VALUE "FileDescription", "aga10win\0"
VALUE "FileVersion", "1, 7, 0, 0\0"
VALUE "InternalName", "aga10win\0"
VALUE "LegalCopyright", "Copyright © 2002 American Gas Association\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "aga10win.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "aga10win\0"
VALUE "ProductVersion", "1, 7, 0, 0\0"
VALUE "SpecialBuild", "2002.11.17 Build\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
173
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
POPUP "&File"
BEGIN
MENUITEM "&Open...", CM_FILEOPEN
MENUITEM "&Save...", CM_FILESAVE
MENUITEM "Save &As...", CM_FILESAVEAS
MENUITEM "E&xit", IDCANCEL
END
POPUP "&Help"
BEGIN
MENUITEM "&About", CM_HELPABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
KILOPASCAL "kilopascals"
MEGAPASCAL "megapascals"
END
STRINGTABLE DISCARDABLE
BEGIN
PSI "PSI"
KELVIN "Kelvin"
CELSIUS "Celsius"
RANKINE "Rankine"
FAHRENHEIT "Fahrenheit"
KGPERCUBICMETRE "kg per cubic metre"
LBMPERCUBICFOOT "lbm per cubic foot"
METREPERSECOND "metres per second"
FOOTPERSECOND "feet per second"
KJPERKG "kJ per kg"
BTUPERLBM "Btu per lbm"
KJPERKGK "kJ per kg-K"
BTUPERLBMF "Btu per lbm-F"
174
This report is the property of AGA and is part of its process for developing new documents. This report or any of
its part shall not be copied, disseminated, cited in literature, presentations or discussions without prior approval
from AGA.
END
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
175