Specifications
2-58 Example 1: The Macro Language
2-58
Set flow = strm.MassFlow
If flow.IsKnown Then
flowValue = flow.GetValue(“lb/hr”)
flowValue = flowValue / 3600
Else
GoTo NoFlow
End If
Check to see if the selected
stream has a defined mass
flow rate. If the flow rate is
known, convert the flow
rate in to “lb/s”.
Set rho = strm.MassDensity
If rho.IsKnown Then
rhoValue = rho.GetValue(“lb/ft3”)
Else
GoTo NoRho
End If
Checks to see if the
stream’s mass density has
been calculated.
flowValue = flowValue / rhoValue
Calculates volumetric flow
rate.
On Error GoTo NoCv
Cv = strm.MolarHeatCapacityValue / strm.CpCvValue
Proceeds to an error trap if
the Cv value of the stream
has not been calculated.
On Error GoTo NoZ
Z = strm.CompressibilityValue
Proceeds to an error trap if
the compressibility of the
stream has not been
calculated.
On Error GoTo NoTemp
T = strm.TemperatureValue + 273.15
Proceeds to an error trap if
the absolute temperature of
the stream cannot be
calculated.
On Error GoTo NoMolWt
MolWt = strm.MolecularWeightValue / 1000.0
Proceeds to an error trap if
the molecular weight of the
stream cannot be
calculated.
soundVel = Sqr(Z*R*T/MolWt*(1.0+Z*R/Cv))
soundVel = soundVel / 0.3048
soundVelTxt = Format(soundVel, “###,###,###.###”)
Calculates the Speed of
Sound of the stream and
converts it from m/s to ft/s.
Dim DispText() As String
ReDim DispText(nPipes + 2)
DispText(0) = “Pipe Size (in) Mach
Number “
DispText(1) = “------------------------------------
---------------------------”
Declares an array of String
types. The “+2” leaves
room for a two line header.
The two header lines are
assigned.
Please note there are
eighteen spaces between
“(in)” and “Mach” and four
spaces after “Number”.
There are approximately
seventy dashes in the line
DispText(1) = “---...”
Code Explanation