Page 246 - Separation process engineering
P. 246

If xA < 0 Or xB < 0 Or xC < 0 Then
                          Cells(i + 13, 3) = "Feed stage too high"
                          Exit For
                         End If
                          i = i + 1
                         ' Test for too many stages, which may mean reflux rate is too low.
                         If i > 100 Then
                          Cells(i + 12, 2).Value = "Too many stages"
                          Exit For

                         End If
                          yA = (LbaroverVbar * xA) - (LbaroverVbar - 1) * xAbot
                          yB = (LbaroverVbar * xB) - (LbaroverVbar - 1) * xBbot
                          yC = (LbaroverVbar * xC) - (LbaroverVbar - 1) * xCbot
                         ' Test for calculations being done.
                         Loop While xC < xCbot
                         ' Fractional recovery of A based on stage-by-stage calculation
                         with stage
                         ' calculation using fractional stage, which is an approximate
                         calculation. With very
                         ' few stages this can be inaccurate. In this case adjust L/D so
                         that frac is close
                         ' either 0 or 1.0.

                          frac = (xCbot - xCold) / (xC - xCold)
                          xCcalc = xCbot
                         ' Assume that frac calculate for C is also valid for A and B.
                          xAcalc = (xA - xAold) * frac + xAold
                          xBcalc = (xB - xBold) * frac + xBold
                         ' Calculate new frac recovery of A in distillate from estimated
                         bottoms calculation.
                         ' Calculation is damped to prevent excessive oscillation.
                          fracAdistcalc = 1 - (xAcalc * B) / (F * zA)
                          difference = fracAdist - fracAdistcalc
                          fracAdist = fracAdist + df * (fracAdistcalc - fracAdist)
                         ' Test if have convergence of fractional recovery of A.
                         If Abs(difference) < epsilon Then Exit For
                         Next j
                          Cells(i + 14, 1).Value = "Calc frac recovery A in distillate"
                          Cells(i + 14, 5).Value = fracAdistcalc

                          Cells(i + 14, 6).Value = "j"
                          Cells(i + 14, 7).Value = j
                         ' Calculate and record on spreadsheet mass balance results and
                         error in mass balance.
                          Cells(i + 15, 1).Value = "Mass bal: frac, A, B, C at bot, % error
                         B"
                          Cells(i + 16, 1).Value = frac
                          Cells(i + 16, 2).Value = xAcalc
                          Cells(i + 16, 4).Value = xBcalc
   241   242   243   244   245   246   247   248   249   250   251