Page 214 - Separation process engineering
P. 214
= 0, the intersection is at yint = z = 0.1), and the term yeqatxint is the value of y in equilibrium with xint.
These numbers are calculated by the VBA program.
Figure 4.B1. Spreadsheet results for binary distillation.
Note: Since this spreadsheet uses a VBA program, changing a value of the input (e.g., z) does not change
the spreadsheet. You must also run the VBA program by doing the following steps from the spreadsheet
tool bar in Excel 2007: View→Macros→View Macros and then click on Run (if you want to see the
VBA program, click on Edit).
Note that the result is quite sensitive to the equilibrium expression used.
The VBA program for this spreadsheet is shown in Table 4-B1. The first statement in the program,
“Option Explicit,” asks VBA to check that every variable is declared in the dimension statements, “Dim.”
This is useful in debugging the program. The program actually starts with the “Sub McCabeThiele()”
statement. In this statement, the programmer chooses the title (McCabeThiele) and carefully avoids
including any spaces. Note that lines beginning with an ′ are comments and are ignored by the program.
The statement “Sheets(″Sheet2″). Select” tells VBA where to find the spreadsheet, and the “Range(″A8″,
″G108″). Clear” statement removes old results. The “Dim ...As Integer” and “Dim...As Single” statements
declare all variables used in the program. Data are input with statements such as “xd = Cells(1, 2).Value”
that tells VBA that xd has the value in cell (1,2) of the spreadsheet. For this example, that value is 0.7.
Note that a large part of the VBA program is reading data from the spreadsheet and then recording results
on the spreadsheet. The last line of the VBA program must be the “End Sub” statement.
Table 4-B1. VBA program for binary distillation stepping off stages from bottom
Option Explicit
Sub McCabeThiele()
' Steps off stages from the bottom up. Assumes that the feed
stage is specified.
' By varying feedstage in the spreadsheet can find an optimum
feed stage.
Sheets("Sheet2").Select

