Results 1 to 3 of 3

Overflow Error - Solving Temperature using Antoine Equation

Threaded View

ggilzow Overflow Error - Solving... 03-03-2011, 12:28 PM
ggilzow Re: Overflow Error - Solving... 03-03-2011, 04:14 PM
shg Re: Overflow Error - Solving... 03-03-2011, 12:58 PM
  1. #1
    Registered User
    Join Date
    03-03-2011
    Location
    Beaumont, TX
    MS-Off Ver
    Excel 2011 Mac
    Posts
    25

    Overflow Error - Solving Temperature using Antoine Equation

    I am trying to calculate the temperature for the hdrogentation column that has a pressure of 515 psia. When I enter this value I get "Overflow Error 6". I defined P as Long, but I still get the same error. I know the code will work if the pressure is changed to 55 psia. I believe the problem may be due to a very long mmHg value, because 515 psia = 26632 mmHg while 55 psi = 2844 mmHg. I have checked the Antoine coefficients and they are correct.

    Here is my code. Please help. Attached file also.

    Sub Mole()
    Dim X(10), A(10), B(10), C(10), K(10), Y(10)
    Dim P As Double
    
    
    'Input Data
    GoSub S1
    Trial = 0
    P1:
    Trial = Trial + 1
    Told = TNew
    T = Told
    'Calc FT and Deriv
    GoSub S2
    TNew = Told - FT / Deriv
    T = TNew
    'Calc FT
    GoSub S2
    
    If Abs(TNew - Told) <= 0.01 Then GoTo P2
    GoTo P1
    P2:
    Range("H28").Value = T
    End
    'Input Data
    S1:
    X(1) = Sheets("Mole").Range("F24")
    X(2) = Sheets("Mole").Range("F25")
    A(1) = Sheets("Mole").Range("B4")
    A(2) = Sheets("Mole").Range("B5")
    B(1) = Sheets("Mole").Range("C4")
    B(2) = Sheets("Mole").Range("C5")
    C(1) = Sheets("Mole").Range("D4")
    C(2) = Sheets("Mole").Range("D5")
    P = (Sheets("Mole").Range("G28")) * 51.7149
    
    TStart = 20
    Told = 20
    TNew = 20
    Return
    'Calc FT and Deriv
    S2:
    SumFT = 0
    SumFPT = 0
    For I = 1 To 2
    K(I) = 10 ^ (A(I) - B(I) / (T + C(I))) / (P)
    SumFT = SumFT + K(I) * X(I)
    SumFPT = SumFPT + B(I) / ((T + C(I)) ^ 2) * K(I) * X(I)
    Next I
    FT = 1 - SumFT
    Deriv = -Log(10) * SumFPT
    Return
    End Sub
    Attached Files Attached Files
    Last edited by ggilzow; 03-03-2011 at 04:18 PM. Reason: Adhere to Rule for Code Placement

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1