The Dranchuk-Abou-Kassem equation is implicit; solving for Z requires an iterative solution method. Several several methods exist in Excel, and the spreadsheet demonstrates two of these methods.
- A circular reference. Make sure File>Options>Formulas>Enable iterative calculation is checked)
- Goal Seek. Here we
- guess a value for Z
- use this to calculate ρr
- use ρr calculate Z
- use Goal Seek to minimize the difference between the guess and calculated values of Z by varying the guess value of Z
If you want Goal Seek to automatically recalculate the compressibility factor whenever the reduced temperature or pressure are changed, add this VBA to Sheet1 in the spreadsheet.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim bSuccess As Boolean
On Error Resume Next
bSuccess = Range("diff").GoalSeek(0, Range("guessz"))
On Error GoTo 0
If Not bSuccess Then
MsgBox "Goal Seek Failed for Compressibility Factor"
End If
End Sub
You may also want to check out this Excel spreadsheet which uses the Beggs and Brill correlation to calculate the compressibility factor of natural gas.
Download Excel spreadsheet to calculate the compressibility factor with the Dranchuk-Abou-Kassem correlation
0 comments:
Post a Comment