[ Go to CENG301 Homepage | CENG301 Notes Table of Contents]
The first element balance program: el1, is an
interactive version in which all data is input in reply to prompts.
It requires that all flows be given in molar units. Typing
el1 will set the program into motion as shown in
analyzing Problem 4.2 in the text with a basis chosen of 100
mols of feed gas:
wsname% el1 ____________________________________________________ el1 asks for the number of mols of each compound IN and OUT of a System and then its Formula. A Table then gives the molar flows for all compounds and a second Table gives the element Flows. ____________________________________________________ Give the number of mols IN and OUT then the FORMULA for COMPOUND 1 or stop to STOP. .8 0 CH4 <-- Flow in, Flow out, Formula Give the number of mols IN and OUT then the FORMULA for COMPOUND 2 or stop to STOP. 7.6 0 CO2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 3 or stop to STOP. 35.2 0 CO Give the number of mols IN and OUT then the FORMULA for COMPOUND 4 or stop to STOP. 51.9 0 H2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 5 or stop to STOP. 4 4 N2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 6 or stop to STOP. 0.5 0 O2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 7 or stop to STOP. stop Compound Mols in Mols out CH4 0.8000 0.0000 CO2 7.6000 0.0000 CO 35.2000 0.0000 H2 51.9000 0.0000 N2 4.0000 4.0000 O2 0.5000 0.0000 Total 100.0000 4.0000 Element Atoms IN Atoms OUT Atoms Lost C 43.6000 0.0000 43.6000 H 107.0000 0.0000 107.0000 O 51.4000 0.0000 51.4000 N 8.0000 8.0000 0.0000
We did not include water in this list given to the program and put in
zeroes for all the terms we did not know. Now let's copy the flows
shown in the display to an editor where we can add symbols for all
unknowns:
COMPOUND MOLS IN MOLS OUT CH4 0.8000 CH4 CO2 7.6000 .438D CO 35.2000 .002D D=CH4+.44D+H2+4 H2 51.9000 H2 N2 4.0000 4.0000 O2 0.5000 0.0000 H2O 0.0000 W Total 100.0000 4 + CH4 + .44D + H2 + W Element Atoms IN Atoms OUT Atoms Lost C 43.6000 CH4+.44D 43.6 - CH4 - .44D H 107.0000 4CH4+2H2+2W 107 - 4CH4-2H2-2W O 51.4000 .878D+W 51.4 - .878D - W N 8.0000 8.0000 0.000
The Atoms lost should be zero for all elements. Only nitrogen
satifies this condition in our first execution of
el1. We have three simultaneous equations to
satisify to make the other balances zero. The relation shown for the
total amount of dry gas give a fourth relation among the four
unknowns. Here are the four equations:
CH4 + .440D = 43.6 <-- C balance 4CH4 + 2H2 + 2W = 107 <-- H balance .878D + W = 51.4 <-- O balance -CH4 + .560D - H2 = 4.0 <-- Dry gas relation
Here is a MATLAB session to solve these:
>> a=[ 1 0.44 0 0 4 0 2 2 0 0.878 0 1 -1 0.56 -1 0] a = 1.0000 0.4400 0 0 4.0000 0 2.0000 2.0000 0 0.8780 0 1.0000 -1.0000 0.5600 -1.0000 0 >> b=[43.6 107 51.4 4]; >> (a\b')' ans = 21.8322 49.4723 1.8723 7.9633
or: CH4=21.8322, D=49.4723, H2=1.8723, and
W=7.9633. We can test these values in the el1
program to find:
wsname% el1 ____________________________________________________ el1 asks for the number of mols of each compound IN and OUT of a System and then its Formula. A Table then gives the molar flows for all compounds and a second Table gives the element Flows. ____________________________________________________ Give the number of mols IN and OUT then the FORMULA for COMPOUND 1 or stop to STOP. 0.8 21.8322 CH4 Give the number of mols IN and OUT then the FORMULA for COMPOUND 2 or stop to STOP. 7.6 21.6689 CO2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 3 or stop to STOP. 35.2 .0989 CO Give the number of mols IN and OUT then the FORMULA for COMPOUND 4 or stop to STOP. 51.9 1.8723 H2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 5 or stop to STOP. 0 7.9633 H2O Give the number of mols IN and OUT then the FORMULA for COMPOUND 6 or stop to STOP. 4 4 N2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 7 or stop to STOP. 0.5 0 O2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 8 or stop to STOP. stop Compound Mols in Mols out CH4 0.8000 21.8322 CO2 7.6000 21.6689 CO 35.2000 0.0989 H2 51.9000 1.8723 H2O 0.0000 7.9633 N2 4.0000 4.0000 O2 0.5000 0.0000 Total 100.0000 57.4356 Element Atoms IN Atoms OUT Atoms Lost C 43.6000 43.6000 0.0000 H 107.0000 107.0000 0.0000 O 51.4000 51.4000 0.0000 N 8.0000 8.0000 0.0000
There are two difficulties with the first element balance program.
One difficulty is the requirement that you type in all data each time
the program is executed. This may be fine for small problems, but it
can be very cumbersome in analyzing programs with many feeds and
products or that require many executions to find a satisfactory
solution. A second difficulty is that all flows must be entered in
molar units. We will eliminate the second of these in the program
el2, and then at least alleviate the first problem
in el3 by allowng the user to store all data in a
file where it can be edited.
The program el2 helps the user in problems that
involve flows given in both mass and molar units. We will demonstrate
the program by using it on Problem 4.15 in the text with a
basis of 100 lb of the fuel oil:
wsname% el2 _____________________________________________________ el2 asks for the number of mols of each compound IN and OUT of a System and then its Formula. When you finish giving molar flows, you can then give Mass flows; again IN, then OUT and finally Formula. A Table then gives the molar and mass flows for all compounds as well as their molecular weights. Finally a Table of element Flows is given. _____________________________________________________ Give the number of mols IN and OUT then the FORMULA for COMPOUND 1 or stop to give Mass flows. 0 0 N2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 2 or stop to give Mass flows. 0 0 O2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 3 or stop to give Mass flows. 0 0 SO2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 4 or stop to give Mass flows. 0 0 CO2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 5 or stop to give Mass flows. 0 0 H2O Give the number of mols IN and OUT then the FORMULA for COMPOUND 6 or stop to give Mass flows. stop Give the mass IN and OUT then the FORMULA for COMPOUND 6 or stop to STOP. 84 0 C Give the mass IN and OUT then the FORMULA for COMPOUND 7 or stop to STOP. 11.4 0 H Give the mass IN and OUT then the FORMULA for COMPOUND 8 or stop to STOP. 1.4 0 N Give the mass IN and OUT then the FORMULA for COMPOUND 9 or stop to STOP. 3.2 0 S Give the mass IN and OUT then the FORMULA for COMPOUND 10 or stop to STOP. stop Compound Mol Wt Mols in Mols out Mass in Mass out N2 28.0134 0.0000 0.0000 0.0000 0.0000 O2 31.9988 0.0000 0.0000 0.0000 0.0000 SO2 64.0588 0.0000 0.0000 0.0000 0.0000 CO2 44.0098 0.0000 0.0000 0.0000 0.0000 H2O 18.0152 0.0000 0.0000 0.0000 0.0000 C 12.0110 6.9936 0.0000 84.0000 0.0000 H 1.0079 11.3106 0.0000 11.4000 0.0000 N 14.0067 0.1000 0.0000 1.4000 0.0000 S 32.0600 0.0998 0.0000 3.2000 0.0000 TOTAL 18.5040 0.0000 100.0000 0.0000 Element Atoms IN Atoms OUT Atoms Lost C 6.9936 0.0000 6.9936 H 11.3106 0.0000 11.3106 N 0.1000 0.0000 0.1000 S 0.0998 0.0000 0.0998 O 0.0000 0.0000 0.0000
Again 0's were put in where we had unknowns so that we can edit the
result to show our element balances. Before doing so, we can see that
6.9936 + 0.25 11.3106 + 0.0998 mols of O2 will be needed
in the theoretical air. Thus 47.2431 mols of air would be required
for the answer to part a). For part b) our edited table looks
like:
Compound Mol Wt Mols in Mols out N2 28.0134 0.79A N2 O2 31.9988 0.21A O2 SO2 64.0588 0.0000 SO2 CO2 44.0098 0.0000 CO2 H2O 18.0152 0.0000 W C 12.0110 6.9936 0.0000 H 1.0079 11.3106 0.0000 N 14.0067 0.1000 0.0000 S 32.0600 0.0998 0.0000 TOTAL 18.5040 0.0000 Element Atoms IN Atoms OUT Atoms Lost C 6.9936 CO2 6.9936 - CO2 H 11.3106 2W 11.3106 - 2W N 0.1 + 1.58A 2N2 0.1 + 1.58A - 2N2 S 0.0998 SO2 0.0998 - SO2 O .42A 2O2+2SO2+W+2CO2 .42A - 2O2+2SO2+W+2CO2
From the SO2 composition in the dry gas:
64.06*SO2 = .004(64.06S*O2 + 28.01*N2 + 32.00*O2 + 44.01*CO2)
Thus, using three element balances:
SO2=.0998, W=5.6553, and CO2=6.9936.
from the remaining two element balances and the SO2
composition relation, we have the three equations in three
unknowns:
28.01*N2 + 32.0*O2 = 1284.1 <-- SO2 composition 2.00*N2 - 1.58*A = 0.1 <-- N balance - 2.0*O2 + 0.42*A = 19.84 <-- O balance
Solving (with MATLAB):
>> a=[28.01 32 0 2 0 -1.58 0 -2.002 .42] a = 28.0100 32.0000 0 2.0000 0 -1.5800 0 -2.0020 0.4200 >> (a\[1284.1 .1 19.84]')' ans = 43.8713 1.7270 55.4701
gave: N2=43.8713, O2=1.7270 and A=55.4701. With
these in our flow table we see:
wsname% el2 _____________________________________________________ el2 asks for the number of mols of each compound IN and OUT of a System and then its Formula. When you finish giving molar flows, you can then give Mass flows; again IN, then OUT and finally Formula. A Table then gives the molar and mass flows for all compounds as well as their molecular weights. Finally a Table of element Flows is given. _____________________________________________________ Give the number of mols IN and OUT then the FORMULA for COMPOUND 1 or stop to give Mass flows. 43.8214 43.8713 N2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 2 or stop to give Mass flows. 11.6487 1.727 O2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 3 or stop to give Mass flows. 0 .0998 SO2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 4 or stop to give Mass flows. 0 6.9936 CO2 Give the number of mols IN and OUT then the FORMULA for COMPOUND 5 or stop to give Mass flows. 0 5.6553 H2O Give the number of mols IN and OUT then the FORMULA for COMPOUND 6 or stop to give Mass flows. stop Give the mass IN and OUT then the FORMULA for COMPOUND 6 or stop to STOP. 84 0 C Give the mass IN and OUT then the FORMULA for COMPOUND 7 or stop to STOP. 11.4 0 H Give the mass IN and OUT then the FORMULA for COMPOUND 8 or stop to STOP. 1.4 0 N Give the mass IN and OUT then the FORMULA for COMPOUND 9 or stop to STOP. 3.2 0 S Give the mass IN and OUT then the FORMULA for COMPOUND 10 or stop to STOP. stop Compound Mol Wt Mols in Mols out Mass in Mass out N2 28.0134 43.8214 43.8713 1227.5864 1228.9842 O2 31.9988 11.6487 1.7270 372.7444 55.2619 SO2 64.0588 0.0000 0.0998 0.0000 6.3931 CO2 44.0098 0.0000 6.9936 0.0000 307.7869 H2O 18.0152 0.0000 5.6553 0.0000 101.8814 C 12.0110 6.9936 0.0000 84.0000 0.0000 H 1.0079 11.3106 0.0000 11.4000 0.0000 N 14.0067 0.1000 0.0000 1.4000 0.0000 S 32.0600 0.0998 0.0000 3.2000 0.0000 TOTAL 73.9741 58.3470 1700.3307 1700.3076 Element Atoms IN Atoms OUT Atoms Lost N 87.7428 87.7426 0.0002 O 23.2974 23.2961 0.0013 S 0.0998 0.0998 0.0000 C 6.9936 6.9936 0.0000 H 11.3106 11.3106 0.0000
The % excess air was then: 100(55.4701-47.2431)/47.2431= 17.41.
The program el3 allows the same operations as in
el2, but with input data stored in a file. Here is a
session to illustrate its use. First we establish a new file for the
input data:
wsname% el3 _____________________________________________________ el3 performs just like el2, but it uses a file to store all data. If you need to set up a new file, the program will give you a template to use. The data stored in the file includes: the number of mols of each compound IN and OUT of a System and its Formula. When you finish with molar flows, you can then give Mass flows; again IN, then OUT and finally Formula. A Table then gives the molar and mass flows for all compounds as well as their molecular weights. Finally a Table of element Flows is given. _____________________________________________________ Give the name of your file or NEW to set up a new file. new Give the name to be used for your file: tst4.6 Give the number of compounds that you want to give molar flows for: 3 Give the number of compounds that you want to give mass flows for: 2 Now you should edit your file: tst4.6 to put into it the compound Formula and flow rates. When you have completed that and SAVED the file, hit a RETURN.
Now the file tst4.6 has in it:
The number of compounds with molar flows is = 3 For Compound Number: 1 The Formula is = The Molar Flow Rate IN is = The Molar Flow Rate OUT is = ******************************* For Compound Number: 2 The Formula is = The Molar Flow Rate IN is = The Molar Flow Rate OUT is = ******************************* For Compound Number: 3 The Formula is = The Molar Flow Rate IN is = The Molar Flow Rate OUT is = ******************************* The number of compounds with mass flows is = 2 For Compound Number: 4 The Formula is = The Mass Flow Rate IN is = The Mass Flow Rate OUT is = ******************************* For Compound Number: 5 The Formula is = The Mass Flow Rate IN is = The Mass Flow Rate OUT is = *******************************
We edit the numbers in tst4.6 to make the file look like:
The number of compounds with molar flows is = 3 For Compound Number: 1 The Formula is = Na2CO3 The Molar Flow Rate IN is = 1 The Molar Flow Rate OUT is = 0.25 ******************************* For Compound Number: 2 The Formula is = H2O The Molar Flow Rate IN is = 10 The Molar Flow Rate OUT is = 8 ******************************* For Compound Number: 3 The Formula is = CO2 The Molar Flow Rate IN is = 5 The Molar Flow Rate OUT is = 6 ******************************* The number of compounds with mass flows is = 2 For Compound Number: 4 The Formula is = C The Mass Flow Rate IN is = 15 The Mass Flow Rate OUT is = 18 ******************************* For Compound Number: 5 The Formula is = NaOH The Mass Flow Rate IN is = 45 The Mass Flow Rate OUT is = 38 *******************************
Then we continue the execution of el3 by
saving the data file and then hitting the RETURN
key in response to:
When you have completed that and SAVED the file, hit a RETURN.
For our simulation we find:
Compound Mol Wt Mols in Mols out Mass in Mass out Na2CO3 105.9887 1.0000 0.2500 105.9887 26.4972 H2O 18.0152 10.0000 8.0000 180.1520 144.1216 CO2 44.0098 5.0000 6.0000 220.0490 264.0588 C 12.0110 1.2489 1.4986 15.0000 18.0000 NaOH 39.9971 1.1251 0.9501 45.0000 38.0000 TOTAL 18.3739 16.6987 566.1898 490.6776 Element Atoms IN Atoms OUT Atoms Lost Na 3.1251 1.4501 1.6750 C 7.2489 7.7486 -0.4998 O 24.1251 21.7001 2.4250 H 21.1251 16.9501 4.1750
In order to eliminate the imbalances in the elements, we need to revise the input file, but that simply requires editing the file to change the parts that need revision. This is much simpler and faster than answering all the questions in the interactive programs el1 and el2.