# Excel Recycle and Iteration Calculation

August 17, 2017 | Author: Samson Mase | Category: Microsoft Excel, Chemical Reactor, Chemistry, Mathematics, Computing And Information Technology

#### Short Description

Using microsoft excel to do chemical engineering stream recycling...

#### Description

1

Microsoft Excel for Chemical Engineers Course “Fundamentals of Chemical Engineering”

Material balance with Chemical Reaction General mole balance Equation:

𝑛

𝑁𝑖 𝑜𝑢𝑡 = 𝑁𝑖 𝑖𝑛 + � 𝜎𝑖𝑗 × 𝑟𝑗 𝑗=1

Where;

𝑁𝑖 : 𝑀𝑜𝑙𝑎𝑟 𝑓𝑙𝑜𝑤 𝑟𝑎𝑡𝑒 𝑜𝑓 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡

𝜎𝑖𝑗 : 𝑆𝑡𝑜𝑖𝑐ℎ𝑜𝑚𝑒𝑡𝑟𝑖𝑐 𝑎𝑚𝑜𝑢𝑛𝑡 𝑜𝑓 𝑐𝑜𝑚𝑝𝑜𝑛𝑒𝑛𝑡 𝑖 𝑖𝑛 𝑟𝑒𝑎𝑐𝑡𝑖𝑜𝑛 𝑗

𝑟𝑗 : 𝑀𝑜𝑙𝑎𝑟 𝑟𝑎𝑡𝑒 𝑜𝑓 𝑟𝑒𝑎𝑐𝑡𝑖𝑜𝑛 𝑗, calculated according to the following equation:

𝑟𝑗 = [(𝑁𝑖𝑛 × 𝐶𝑜𝑛𝑣𝑒𝑟𝑠𝑖𝑜𝑛 × 𝑆𝑒𝑙𝑒𝑐𝑡𝑖𝑣𝑖𝑡𝑦)/(−𝜎)]𝑙𝑖𝑚𝑖𝑡𝑖𝑛𝑔 𝑟𝑒𝑎𝑐𝑡𝑎𝑛𝑡

Reaction with Recycle

The following flow diagram represents a part of methanol production process; it’s produced by the reaction of synthesis gas (CO and H2) according to the following reaction:

𝐶𝑂 + 2𝐻2 ↔ 𝐶𝐻3 𝑂𝐻

Fresh feed of 1000 Kgmol/hr containing 33% CO, 66.5% H2 and 0.5% CH4 (all in mole %) is introduced to the reactor, this reaction is catalytic and only 40% conversion of CO is achieved. The product is then fed to a separator where methanol is separated from the unreacted components, it was reported that the bottom product contains 3% of CO, 2% of H2, 4% of CH4 and 96% of methanol reactor effluent. With this low conversion, it’s clear that nearly half the reactants only reacted and the other half was introduced to the separator, separated from the product. Practically in such processes the unreacted reactants are recycled and mixed with the fresh feed to make use of them, also in such systems where there are some inerts in the feed (like Methane) some of the recycle stream is purged before mixing with the fresh feed to prevent accumulation of inerts in the system.

2

Microsoft Excel for Chemical Engineers Course “Fundamentals of Chemical Engineering”

First, the degrees of freedom table must be constructed, it’ll be as follows: Mixer

Reactor

Flash

Splitter

Process

Overall

11

9

12

12

28

12

4

4

4

4

16

4

No. of Givens

3

1

0

0

4

3

0

0

4

4

8

0

DOF

4

4

4

4

0

5

No. of Variables No. of Equations

It’s clear that the system is solvable as the degrees of freedom of process is zero, so either a matrix is constructed and a system of equations is solved (28 equations, i.e. square matrix 28×28) and it’ll be so time consuming, or the easier method unit-to-unit calculations. But note that the solution will not be straight forward as there is no unit that has zero degrees of freedom, so tearing technique can be applied. It should be clear first that a number of variables will be assumed and recalculated again, the assumed variables will be determined based on the degrees of freedom table, as the assumed variables must solve a unit and introduce new information to the next unit and so on till the recycle stream is calculated and the assumed variables are recalculated again.

So let’s assume the flow rates of the components in stream 2 (feed to the reactor), then the sequence of solution will be as follows:

Note: We'll assume the purge stream (6) to be 10% of the Flash top product stream (4). This assumption can be refined later after solution based on the allowable amount of the inert (methane) in the process streams. Now, stream 2 can be totally assumed (flow rates of all four components) then four information are added to the reactor and then can be solved, then stream 3 is specified which will allow the solution of the separator, which in turn will add four information (stream 7) to the mixer and as a result the mixer can be solved and stream 2 can be recalculated. Then the calculated values are compared with the assumed ones, if the difference is in the range of allowable error then it’s Ok, else the calculated values are used as the assumed ones till the values of the assumed and the calculated flow rates are equal (or the difference between them is nearly zero).

3

Microsoft Excel for Chemical Engineers Course “Fundamentals of Chemical Engineering”

To achieve this, a table must be constructed (like that constructed in the previous example) but the only difference is that there will be two columns for the same stream “2” (assumed one) one will be for the assumed value and the other for the calculated one. And the aim is to equalize the terms in both columns. Note that the cells of the assumed flow rates will not contain formulas; it’ll contain the assumed values, while the cells of the calculated flow rates will contain the formulas. The formulae will be inserted in the same way as the previous example; the table will be as follows:

These formulae will result in the following flow rates:

It’s now clear that the flow rates of column “2 assumed” are not equal to those of column “2 calc” so if we can change the flow rates of column “2 assumed” (as they contain values not formulas) so that they are equal to column “2 calc” then these flow rates are the final ones and all the other cells will be automatically calculated. To achieve this we can insert another column in which the square the difference between the assumed and the calculated values is calculated, and the sum of the squares will be calculated below, then the table will be in the form shown:

4

Microsoft Excel for Chemical Engineers Course “Fundamentals of Chemical Engineering”

Then we’ll finally have the following table:

Now we can say that setting the cell “J6” to the value of zero means that the difference between the assumed and the calculated values is zero, or they are equal. The final step is to use the solver to change the assumed values in order to set the cell “J6” to the value of zero.

If you clicked on the Options button, you might edit the solver convergence in the options to reach a high convergence:

5

Microsoft Excel for Chemical Engineers Course “Fundamentals of Chemical Engineering”

Finally, the solver solution will yield the following results:

Now compare the values of the cells in column “2 assum” and column “2 calc”. It’s clear that assumed and calculated values are the same. All flow rates now are available in the table. Note: How to make the square (Diff) Total Cell (J6) turn automatically green upon finding a solution as in the figure above? This is called condition formatting. You can tell the Excel to put a certain formatting (Font color, Background color…ETC) based on the cell value. Normally, we had this cell is a red color (to show that we have not reached a solution. Next we select the cell and under the Home Tab; Choose: Conditional Formatting > Highlight Cells Rules > Between

The following window will appear.

6

Microsoft Excel for Chemical Engineers Course “Fundamentals of Chemical Engineering”

Choose the cell to have a “Green Fill with Dark Green Text” when its value is between (-0.0001 and 0.0001)  i.e. when the value is almost zero. Click OK! Excel Automatic Iterations: We can allow Excel to do us the iterations automatically instead of having to use the solver. This will be better in case we do any changes to the data, Excel will then automatically do the iterations without having to Rerun the solver. To do this, you must let Excel understand that stream 2 (that we initially assumed) is actually calculated by adding streams 1 and 7. Go to 2 (assumed) and change the formula of cell C2 to be B2+H2, Excel will then warn you that you have a “Circular Reference” meaning that stream 7 in dependent on stream 2 and now you want to make 2 dependent on 7 (this is a closed loop). Ignore the warning for now because that’s what we want. Do this by clicking cancel in the error message (Cancelling means that you want a circular reference to happen).

Now drag and drop the formula to cells C3, C4, and C5. It will look like the image below.

To allow Excel to do the iterations Click the Excel Logo button (Top left of the window) and choose Excel Options.

7

Microsoft Excel for Chemical Engineers Course “Fundamentals of Chemical Engineering”

In the formulas window, click on the check box “Enable Iterative Calculations”. You can increase the “maximum iterations” to allow more iterations to reach the solution (let’s make it 200). You can also reduce the “maximum change” to reach a larger convergence. Make it 0.00001.

Finally, click “Ok” to save. Excel will now do the iterations automatically (there is no need now for the 2 (Calc) and Square (Diff) columns, and we don’t need to use the solver. Try to change the feed flow rate to 1500 and see how excel does the iterations automatically.

Note: When doing a flowsheet with several recycle operations (Several iteration problems) it is not advisable to make the Excel do the iteration automatically because it will try to make them all simultaneously and might fail to adjust them all together. It is better to do each by yourself and keep moving between them till they are adjusted.