Page 243 - Separation process engineering
P. 243

Table 5-A1. VBA program for ternary distillation with constant relative volatility starting at top of

                                                                            column

                         Option Explicit
                         Sub Ternary_top_down()
                         ' Ternary distillation with constant alpha. Frac recoveries of LK
                         and HK given.
                         ' There is a LNK present and its frac rec in distillate is
                         guessed.
                          Sheets("Sheet1").Select
                          Range("A13", "G120").Clear
                         ' Declare variables
                          Dim i, j, feedstage, N As Integer
                          Dim alphaAB, alphaBB, alphaCB, F, fracBdist, fracCbot, q, LoverD,

                         LoverV As Double
                          Dim LbaroverVbar, D, B, L, V, Lbar, Vbar, Eqsum, fracAdist As
                         Double
                          Dim xA, xB, xC, yA, yB, yC, zA, zB, zC, xAbot, xBbot, xCbot As
                         Double
                          Dim DxA, DxB, DxC, BxA, BxB, BxC, xAdist, xBdist, xCdist As
                         Double
                          Dim fracAdistcalc, difference, epsilon, df, watch As Double
                          Dim xAold, xBold, xCold, frac, xAcalc, xBcalc, xCcalc As Double
                         'Input data from spreadsheet
                          alphaAB = Cells(3, 2).Value
                          alphaBB = Cells(3, 4).Value
                          alphaCB = Cells(3, 6).Value
                          feedstage = Cells(3, 8).Value
                          F = Cells(5, 2).Value
   238   239   240   241   242   243   244   245   246   247   248