Check out this video. I have programmed a function in excel to do computation for calculating Z-Factor using the Hall-Yarborough method. This method requires minimal input from the user. The user needs to only type in the Tpr and Ppr.
*************************************CODE********* **************************************
Function Z_Factor(Tr* Pr)
''Programmed and developed by: Muhammad Hashim
''University of Regina
''Hall Yarborough Z-factor
''
Application.ScreenUpdating = False
Dim func As Double
T = 1 / Tr
Y = 0.001
For i = 1 To 20000
func = (-0.06125 * Pr) * T * Exp(-1.2 * (1 - T) ^ 2) + ((Y + Y ^ 2 + Y ^ 3 - Y ^ 4) / (1 - Y) ^ 3) - (14.76 * T - 9.76 * T ^ 2 + 4.58 * T ^ 3) * Y ^ 2 + (90.7 * T - 242.2 * T ^ 2 + 42.4 * T ^ 3) * Y ^ (2.18 + 2.82 * T)
If (func > 0.001 Or func < -0.001) Then
Y = Y + 0.001
Else
Z_Factor = (0.06125 * Pr * T * Exp(-1.2 * (1 - T) ^ 2)) / Y
End If
Next i
End Function
*****************************************END CODE*****************************************



Reply With Quote

Bookmarks