# Chapter 4 : Material Balances Involving Chemical Reactions¶

### Example 4.1 Page 116¶

In :
# solution
# Variables

# basis one day operation
# Cl2 is the limiting component
n1 = 4536./71               #[kmol] Cl2 charged

# 1mol MCA requires 1 mol Cl2, so
n2 = 5000/94.5              # [kmol] Cl2 used for MCA production

# Calculation
# 1 mol DCA requires 2 mol of Cl2
n3 = 263*2./129             #[kmol] Cl2 used for DCA production
n4 = n2+n3                  # total Cl2 used
a = n4*100/n1               # conversion %age
b = n2*100/n4               # yield % of MCA
s = n2/n3

# Result
print "Percentage conversion = ",a
print "  Percentage yield of MCA = ",b
print "  selectivity of MCA = ",s

Percentage conversion =  89.2001241751
Percentage yield of MCA =  92.8448972013
selectivity of MCA =  12.976039592


### Example 4.2 Page 117¶

In :
# solution
# Variables
m = 700.                        #[kg] ONT charged to reactor (basis)
m1 = 505*.99                    # [kg] OT produced

# Calculation
m2 = (4*137.*500)/(4.*107)      #[kg] ONT required
m3 = m*.98                      # [kg] ONT reacted
n1 = m1*100/m3                  # yield of OT
m4 = (9*56*m)/(4.*137)          # [kg] theoretical iron reqiurement
m5 = 800*.9                     #[kg] iron charged
E = (m5-m4)*100/m4              # excess iron

# Result
print "a  Yield of OT = ",n1
print "   b  Excess quantity of iron powder = ",E

a  Yield of OT =  72.8790087464
b  Excess quantity of iron powder =  11.8367346939


### Example 4.3 Page 118¶

In :
# solution

# Variables

print "a  "
m = 100.                        #kg chlorobenzene (basis)
m1 = 106.5*.655                 #kg HNO3
m2 = 108*.936                   # kg H2SO4

# Calculation and Result
m3 = 106.5*.345 +108*.064       #kg water
M = m1+m2+m3
print " Analysis of charge: "
print "Component           mass percent"
print "Chlorobenzene         ",m*100/M
print "HNO3                  ",m1*100/M
print "H2SO4                 ",m2*100/M
print "H2O                   ",m3*100/M
print "b  "
# (b)
# total charge mass is constant
m4 = 314.5*.02                  #[kg] unreacted CB in the product
m5 = 100-m4                     # [kg] CB that reacted
c = m5*100./100                 # conversion of CB
print "Percent conversion of Chloro benzene is ",c
print "c  "
# (c)
m6 = 63*c/112.5                 #[kg] HNO3 consumed
m7 = m1-m6                      # unreacted HNO3
m7 = 157.5*c/112.5              # [kg] total NCB produced
m8 = m7*.66                     #[kg] p-NCB
m9 = m7*.34                     #[kg] o-NCB
m10 = 18*c/112.5                #[kg] water produced
m11 = m10+m3                    # total water in product
m12 = m4+m8+m9+m7+m2+m11
print " Composition of product stream :"
print "Component           mass percent"
print "  CB                    ",m4*100/m12
print "  p-NCB                 ",m8*100/m12
print "  o-NCB                 ",m9*100/m12
print "  HNO3                  ",m7*100/m12
print "  H2SO4                 ",m2*100/m12
print "  H2O                   ",m11*100/m12

a
Analysis of charge:
Component           mass percent
Chlorobenzene          46.62004662
HNO3                   32.520979021
H2SO4                  47.1272727273
H2O                    20.3517482517
b
Percent conversion of Chloro benzene is  93.71
c
Composition of product stream :
Component           mass percent
CB                     1.46820564496
p-NCB                  20.2112955666
o-NCB                  10.4118795343
HNO3                   30.6231751009
H2SO4                  23.595862041
H2O                    13.6895821123


### Example 4.4 Page 119¶

In :
# solution
# Variables
n=100.                          #[kmol] outgoing gas from 2nd scrubber
n1=.852*n                       #[kmol] N2
n2=21*n1/79.                    #[kmol] O2
n3=n2-2.1                       # [kmol] reacted O2
# O2 balance
# O2 consumed in rxn (ii),(iii),(v) - O2 produced by rxn (iv) = 20.55 kmol
# let a,b,c be ethanol reacted (ii),(iii),(iv) and d be H2 reacted in (v)

# Calculation
# CO balance
a=2.3/2                         #kmol

#CO2 balance
b = .7/2

#CH4 balance
c=2.6/2

#O2 balance
d = 41.1-a-3*b+c

#H2 balance
e = 7.1 +c+d                    #kmol (total H2 produced)
f = e-(3*b + 3*a)               #kmol  (H2 produced in (i) = ethanol reacted in (i))
g = f+a+b+c                     # total ethanol reacted
h = 2*(n1+n2)                   # total ethanol entering
c1 = g*100/h

# Result
print "a   Conversion percent of ethanol = ",c1
y = f*100/g
print "b   Yield of acetaldehyde = ",y

a   Conversion percent of ethanol =  21.7435446009
b   Yield of acetaldehyde =  94.0298507463


### Example 4.5 Page 121¶

In :
# solution
# Variables
v = 1.                      #[l] water (basis)
# 1 mol (100mg) CaCO3 gives 1 mol (56) Cao
# use table 3.3 and eg 3.9

# Calculation
x = 56*390.6/100            #[mg/l] lime produced

# Result
print "Amount of lime required = ",x," mg/l."

Amount of lime required =  218.736  mg/l.


### Example 4.5 Page 121¶

In :
from numpy import array, linalg

# solution

# Variables
m=100.                  #[kmol] (basis) dry mixed gas
# x = kmol of water gas
# y =kmol of producer gas
# overall material balance :
# x+y = 100   (i)

#r2 =.43x+.25y # H2 formed by shift rxn
#r2=.51x+.25y # H2 entering with water and producer gas
#r = r1+r2 # taoal H2
#/n =.02x+.63y # N2 entering
#N2:H2=1:3
# ==> x-1.807y = 0(ii)
#solving (i) and (ii)
A = array([[1, 1],[1, -1.807]])
d = array([100,0])

# Calculation
x = linalg.solve(A,d)
s = .43*x+.25*x               # steam req.

# Result
print "x = ",x
print " and y = ",x
print "Amount of steam required = ",s," kmol"

x =  64.3747773424
and y =  35.6252226576
Amount of steam required =  36.5874599216  kmol


### Example 4.7 Page 123¶

In :
# solution
# Variables
m = 100.                        #[kg] Tallow

# Calculation
m1 = 3*403*m/890.               # [kg]
m2 = 92*m/890.

# Result
print "a   NaOH required = ",m1," kg   \nb   amount of glycerine liberated = ",m2," kg."

a   NaOH required =  135.842696629  kg
b   amount of glycerine liberated =  10.3370786517  kg.


### Example 4.8 Page 124¶

In :
# solution
# Variables
n = 100.                        #[kmol] SO3 free gas basis
n1 = 16.5                       #[kmol] SO2
n2 = 3.                         #[kmol] O2
n3 = 80.5                       #[kmol] N2

# Calculation
# S + O2 = SO2
# S + 3/2 O2 = SO3
n4 = (21/79.)*80.5               #[kmol] O2 supplied
n5 = n4-n1-n2                   #  [kmol] Unaccounted O2

# O2 used in 2nd eq is m5
n6 = (2./3)*n5                  #[kmol] SO3 produced
n7 = n1+n6                      # sulphur burnt
m7 = n7*32                      #[kg]
f1 = n6/n7                      # fraction of SO3 burnt

# O2 req. for complete combustion of S = n7
n8 = n4-n7                      #[kmol] excess O2
p1 = n8*100/n7                  # %age of excess air
n9 = n4+n3                      #[kmol/s] air supplied
F1 = n9*.3/n7                   # air supply rate
v = 22.414*(303.15/273.15)*(101.325/100)                #[m**3/kmol] sp. vol of air
V1 = F1*v                       #[m**3/s] flow rate of fresh air
n10 = n+n7                      #[kmol] total gas from burner
n11 = n10*.3/m7                 # [kmol/s] gas req. for .3 kg/s S
V2 = 220414*1073.15*n11/273.15  # flowrate of burner gases

# Result
print "a   The fraction of S burnt = ",f1
print "b   percentage of excess air over the amount req. for S oxidising to SO2 = ",p1
print "c   volume of dry air = ",V1," m**3/s   \nd   volume of burner gases = ",V2," m**3/s."

a   The fraction of S burnt =  0.0712504453153
b   percentage of excess air over the amount req. for S oxidising to SO2 =  20.4488778055
c   volume of dry air =  43.3707633304  m**3/s
d   volume of burner gases =  53815.0344364  m**3/s.


### Example 4.9 Page 125¶

In :
# solution
# Variables
m = 100.                        #[kg] soya fatty acid (basis)

# use table 4.6
M1 = m/.3597                    # M(avg) of soya fatty acid

# Calculation
#3 mol of fatty acid + 1 mol of glycerol = 1 mol triglyceride + 3 mol of water
M2 = M1*3+92.09-3*18.02         # Mavg of soyabean oil
q1 = M2*m/(M1*3)                # soyabean oil per 100kg fatty acid

# based on reactions occuring
q2 = .0967+.1822*2+.0241*3      # kmol H2 req. per 100 kg soya fatty acid
q3 = .5101                      # kmol H2 req. per 100 kg soyabean oil
q4 = 11.434                     # Nm**3/100kg soyabean oil
# x = linoleic acid converted to oleic acid
# y = oleic acid converted to stearic acid
q5 = 282.46*6.7/278.43
#q6 = 282.46*x/280.15 = 1.00717x [kg] oleic acid by linoleic acid
#q7 = 284.48*y/282.46 = 1.00715y [kg] stearic acid by oleic acid
#q8 = 100.097 + .00717x + .00715y  total fatty acid
#stearic balance : -.00105x + 1.00611y = 10.8142    (i)
#linoleic balance : 1.0019x + .00019y = 48.4975     (ii)
# solving (i) and (ii) we get
x = 48.5                        #kg
y = 10.8                        #kg
M3 = 100.52/.3596               # Mavg of fatty acid
H2req1 = .5334-.2864            # per 100kg fatty acid
H2req = 52.95                   #Nm**3/t
I2s = 129.5                     #kg I2 per 100 kg soyabean oil # for soyabean oil
I2h = 69.2                      #kg I2 per 100 kg of fat

# Result
print "a   theoretical H2 required = ",q4," Nm**3/100kg soyabean oil"
print "b   actual H2 required = ",H2req
print "c   Iodine value for soyabean oil = ",I2s
print "d   Iodine value of hardened fat = ",I2h

a   theoretical H2 required =  11.434  Nm**3/100kg soyabean oil
b   actual H2 required =  52.95
c   Iodine value for soyabean oil =  129.5
d   Iodine value of hardened fat =  69.2


### Example 4.10 Page 128¶

In :
# solution
# Variables

F1 = 4000.                      #kg/h methanol (basis)
F2 = F1/32                      #kmol/h
F3 = F2/.084                    #kmol/h gaseous mix flowrate
F4 = F2-F3                      #kmol/h flow of wet air
n1 = .011*29/18.                # kmol/kmol dry air
F5 = F4/(1+n1)                  # kmol/h dry air flowrate
O2 = F5*.21                     #kmol/h
N2 = F5-O2                      #kmol/h
Mreacted1 = F2*.99              #kmol/h
Munreacted1 = F2-Mreacted1      #kmol/h

# Calculation
# reaction (i)
Mreacted2 = Mreacted1*.9        #kmol/h
HCHOproduced1 = 111.375
O2consumed1 = 111.375/2
H2Oproduced1 = 111.375

# for rxn ii to iv
Mconsumed = Mreacted1*.1

#rxn (ii)
CH3OHreacted1 = Mconsumed*.71
O2consumed2 = 8.786*1.5
CO2produced = 8.786
H2Oproduced2 = 8.786*2

#rxn(iii)
CH3OHreacted2 = 12.375*.08
COproduced = .99
H2produced = 2*.99

#rxn(iv)
CH3OHreacted3 = 12.375*.05
CH4produced = .619
O2produced = .619/2

#rxn(v)
CH3OHreacted4 = 12.375-CH3OHreacted1-CH3OHreacted2-CH3OHreacted3
DMEproduced = 1.98/2
H2Oproduced3 = 1.98/2
O2 = 281.27-O2consumed1-O2consumed2+O2produced
H2O = 23.73+H2Oproduced1+H2Oproduced2+H2Oproduced3

# Result
print "Composition of exit gas stream :   CH3OH = ",Munreacted1
print "  HCHO = ",HCHOproduced1
print "  CO2 = ",CO2produced
print "  CO = ",COproduced
print "  H2 = ",H2produced
print "  CH4 = ",CH4produced
print "  CH32O = ",DMEproduced
print "  O2 = ",O2
print "  N2 = ",N2
print "  H2O = ",H2O

Composition of exit gas stream :   CH3OH =  1.25
HCHO =  111.375
CO2 =  8.786
CO =  0.99
H2 =  1.98
CH4 =  0.619
CH32O =  0.99
O2 =  212.713
N2 =  -1058.09347048
H2O =  153.667


### Example 4.11 Page 132¶

In :
# solution
# Variables
m = 100.                #kg pyrites (basis)

#(a)
print "a  ",
S1 = 42.                #kg
i1 = 58.                #kg  inerts

# Calculation
# 8 moll S = 3 mol O2 in Fe2O3
m1 = 3*32*42./8.*32     #kg O2 converted to Fe2O3
m2 = i1+m1              # mass of SO3 free cinder

#2.3 kg S is in 100kg cinder
m3 = 100-(2.3*80./32)
m4 = (100./m3)*m2
m5 = m4*.023            #kg  S in cinder
p1 = 1.8*100/42.

# Result
print "percentage of cinder remained in cinder = ",p1,".   \nb  ",

#(b)
m6 = 100.               #kmol SO3 free roaster gas (basis)
m7 = 7.12               #kmol O2 as SO2
m8 = 10.6               #O2
m9 = 100-m8-m7          #N2
m10 = (21/79.)*m9       # O2 entering roaster along N2
m11 = m7+m8+(3*7.12/8)  # accounted O2
m12 = m10-m11           # unaccounted O2
m13 = (8/15.)*m12        # SO3 formed
m14 = m13+m7            # S burnt
p2 = (m13/m14)*100.
print "percentage of S burnt to form SO3 = ",p2,"   \nc  ",

# (c)
# basis 100kg pyrite
m15 = 37.81/32          # SO2 formed
m16 = (m9+m10)*1.181/m7 # air supplied

# 4 kg pyrite is roasted
m17 = m16*4/100.        #kmol/s  total air supplied
v1 = m17*24.957
print "volumetric flow rate of air = ",v1," m**3/s   \nd  ",
# (d)
m18 = (100.455*m17)/(m9+m10)        # roaster gases
v2 = m18*66.386
print "volumetric flow rate of roaster gases = ",v2," m**3/s \nf ",
#(f)
m19 = 4.838*10**-2*.98 # SO3 absorbed in absorber
# SO3 + H2O = H2SO4
m20 = (m19*98*24*3600)/(.98*1000)   #[t/d]
print "Amount of 98 percent acid strength produced = ",m20," t/d."

a   percentage of cinder remained in cinder =  4.28571428571 .
b   percentage of S burnt to form SO3 =  9.9912948486
c   volumetric flow rate of air =  17.2460430576  m**3/s
d   volumetric flow rate of roaster gases =  44.246401399  m**3/s
f  Amount of 98 percent acid strength produced =  409.643136  t/d.


### Example 4.12 Page 136¶

In :
# solution

# Variables
# basis 100kg mixed charge = 75 kg pyrite + 25kg ZnS
# pyrites
m1 = 75*.92                 #[kg]  FeS2
G1 = 75-m1                  # gangue
# 4FeS2 + 11O2 = 2Fe2O3 + 8SO2
# 4FeS2 + 15O2 = 2Fe2O3 + 8SO3
#Zn ore
m2 = 25*.68                 # ZnS
I1 = 25-m2                  # inerts

# Calculation
# 2ZnS + 3 O2 = 2 ZnO + 2 SO2
I2 = I1+6                   # total inerts
# new basis : 100kg cinder
m3 = 3.5*.7                 # S as SO3
m4 = 3.5-m3                 # S as FeS2
m5 = 100-m3-m4              # S free cinder
m6 = (81.4/97.4)*17         # ZnO

# FeS2 reacted = x
# (FeS2 in cinder/S free cinder) = (69-x)/(28.2+.667x) = 1.969/91.906
# solving this we get
x = 67.43                   #kg
m7 = m6 + .667*x + 14       # S free cinder
m8 = 69-x                   # FeS2 in cinder
m9 = 6.125*m7/m5            # SO3
m10 = .667*x                # Fe2O3
m11 = m6+m10+m8+m9+I2

# Result
print "a   "
print "Total cinder produced = ",m11,"kg  \nComposition of cinder :  ZnO = ",m6,\
"kg  \nFe2O3 = ",m10,"kg  \nS as FeS2 = ",m8,"kg  \nS as SO3 = ",m9,"kg  \ninerts = ",I2,"kg   \nb  "
S1 = (64./120)*69 + (32./97.4)*17           #[kg]  S charged to burner
S2 = .035*79.63                             # S in cinder
p = S2*100/S1
print "percentage of S left in cinder = ",p

a
Total cinder produced =  79.398250005 kg
Composition of cinder :  ZnO =  14.2073921971 kg
Fe2O3 =  44.97581 kg
S as FeS2 =  1.57 kg
S as SO3 =  4.64504780785 kg
inerts =  14.0 kg
b
percentage of S left in cinder =  6.57552394194


### Example 4.13 Page 138¶

In :
# solution
# Variables
m1 = 1200*1.2               #[kg] mass of reactants
pOH1 = 14-6                 #pOH of reactants
pOH = 14-9                  #pOH of final mass
# ROWs = 1/sigma(Wi/ROWsi)
#Ms = mass of .5% NaOH required
#ROWs = density of final solution

# Calculation
#ROWs = 1/{((m1*10**3*1)/(((m1*10**3+Ms)*1.2)+(Ms/((m1*10**3+Ms)*1.005))}    (i)
#balance of OH- ions
#1200*10**-8 +Ms*10**-1.15/(1.005*10**-5) = (1200*1.2*10**3+Ms)*10**-5/ROWs*10**-5      (ii)
#solving (i) and (ii)
Ms = 170.21                 #g
ROWs = 1.2016               #[kg/l]

# Result
print "Mass of 0.5 percnt NaOH required to be added to raise the pH = ",Ms,"g."

Mass of 0.5 percnt NaOH required to be added to raise the pH =  170.21 g.


### Example 4.14 Page 140¶

In :
from numpy import array, linalg
# solution
# Variables
# using equations of example 4.10

# soving 4.10 by linear model method
M = array([[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ,1 ,1 ,1 ,2],
[0, 0, 1, 0, 0, 0, 0, 0, 0, 0, .5, 1.5, 0, -.5, 0],
[0 ,0 ,0 ,1 ,0 ,0, 0, 0, 0, 0, -1, -2 ,0 ,0 ,-1],
[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -2, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, .5, 1.5, 0, -.5, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, 0, 0, -1],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]])
V = array([1058.1,125,281.27,23.73,0,0,0,0,0,0,.99*125,.2437*281.27,-5.4756*23.73,.61875,1.98])

# Calculation
X = linalg.lstsq(M,V)

# Result
print (X)

[  1.05810000e+03   1.25000000e+00   2.12724501e+02   1.53665988e+02
1.12037218e+02   8.45438500e+00   9.69022000e-01   1.93804400e+00
8.52651283e-14   9.90000000e-01   1.12037218e+02   8.45438500e+00
9.69022000e-01   3.09375000e-01   9.90000000e-01]


### Example 4.15 Page 143¶

In :
# solution
# Variables
# basis = 1.12 M63 O2 at NTP
m1 = 1.12*1000*32/22.4                      #[g] O2
m2 = m1/8.                                  # g eq  O2

# Calculation
#at cathode : Cu++ +2e = Cu
#at anode : SO4-- - 2e = SO4
eqwtCu = 63.5/2
depositedCu = eqwtCu*m2
E = (1130*18000.)/96485                     #faradays  Total energy passed to cell
libCu = (1130*18000*eqwtCu)/96485.          #[g]  theoritical liberation of Cu
eff = (depositedCu/libCu)*100.              # current efficiency

# Result
print "a   Amount of Cu lberated = ",libCu
print "b   Current efficiency of the cell = ",eff," percent."

a   Amount of Cu lberated =  6693.21656216
b   Current efficiency of the cell =  94.872173058  percent.


### Example 4.16 Page 144¶

In :
# solution

# Variables
# basis : 1day operation
# NaCl = Na+ + Cl-
#H2O = H+ + OH-
#Na+ + OH- = NaOH
#H+ + e = (1/2)H2
#Cl- - e = (1/2)Cl2
E = (15000.*3600*24)/96485                      # faraday/day   Total energy passed thrrough cell
NaOH = (15000*3600*24*40)/(96485*1000.)         #[kg/day] theoretical NaOH
eff = (514.1/NaOH)*100                          # current efficiency
Cl2 = (35.5/40)*514.1
H2 = (456.3*2)/(35.5*2)

# Calculation
#40 g NaOH = 58.5g NaCl
consNaCl = (58.5/40)*514.1                      # NaCl consumed
Tliquor = 514.1/.11                             #[kg/day]  total cell liquor
remNaCl = 514.1*1.4
totalNaCl = consNaCl+remNaCl
Fbrine = totalNaCl/.266                         #feed rate of brine
consH2O = (18./40)*514.1
lossH2O = Fbrine-Tliquor-consH2O

# Result
print "a   Current efficiency of the cell = ",eff,
print " percent.   \nb   Cl2 produced = ",Cl2,
print " kg/day  H2 produced = ",H2,
print " kg/day  \nc   loss of water = ",lossH2O," kg/day"

a   Current efficiency of the cell =  95.6846807485  percent.
b   Cl2 produced =  456.26375  kg/day  H2 produced =  12.8535211268  kg/day
c   loss of water =  627.391756664  kg/day


### Example 4.17 Page 146¶

In :
# solution

# Variables
#M = mix feed rate, F = fresh feed rate , R = recycle stream
# using fig 4.3
# N2 balance
# a = 24.75M/(.25M+7.5M)    (i)
# P = (4.15M + 17.75a)/M     (ii)
# .585M -1.775a +(4.15M+17.75a)/M = 100  (iii)
#solving (i,) (ii), (iii)
M = 438.589                             #[kmol/s]

# Calculation
a = (24.75*M)/((.25*M)+7.5)             #kmol/s
P = (4.15*438.589+17.75*92.662)/M       #kmol/s
R = M-100                               # kmol/s
r = R/100                               # recycle ratio
NH3 = (.585*M-2.275*a)*17.0305          #kg/s

# Result
print "a   recycle feed rate = ",R," kmol/s   \nb   purge gas rate = ",P,\
" kmol/s   \nc   mass rate of NH3 = ",NH3," kg/s"

a   recycle feed rate =  338.589  kmol/s
b   purge gas rate =  7.90009519163  kmol/s
c   mass rate of NH3 =  779.467550624  kg/s


### Example 4.18 Page 149¶

In :
# solution

# Variables
# given
# (.1*M*R1)/(.415M+1.775a) + (.1125a*P)/(.415M + 1.775a) + 1 = .1M
# R1*(.315M-1.225a)/(.415M + 1.775a) = .9M-4a
# M = 100 + R1 + (2.25a*p)/(.415M + 1.775a)
# .1M*P/(.415M + 1.775a) - (.1125a*P)/(.415M1.775a)
#solving them
M = 457.011                             # kmol/s
R1 = 350.771                            # kmol/s
P = 10.368                              # kmol/s
a = 96.608                              # kmol/s

# Calculation
R2 = 2.25*96.608*10.369/(.415*457.011 + 1.775*96.608)           # kmol/s
F = M -R1 - R2

# Result
print "Mixed feed rate = ",M," kmol/s \nRecycle stream = ",R1,\
" kmol/s \nRecovered H2 stream = ",R2," kmol/s \nFresh feed rate = ",F,\
" kmol/s \nRecycle ratio = ",R1+R2/F," kmol/kmol of fresh feed."

Mixed feed rate =  457.011  kmol/s
Recycle stream =  350.771  kmol/s
Recovered H2 stream =  6.24106025284  kmol/s
Fresh feed rate =  99.9989397472  kmol/s
Recycle ratio =  350.833411264  kmol/kmol of fresh feed.


### Example 4.19 Page 153¶

In :
# solution
# Variables
m1 = (50/35.5)*312                      #[mg/l]  Cl2 expressed as equivalent CaCO3
m2 = (50/48)*43.2                       #[mg/l]  Sulphates as equivalent CaCO3
A = m1+m2                               #[mg/l as CaCO3]    EMA in raw water
M1 = 550.                               # alkalinity of raw water
M2 = 50.                                # alkalinity of blend water

# Calculation
#let 100 l of raw water enters both ion exchangers
# balancing neutrilasion
x = 100.*(M1-M2)/(A+M1)                 # raw water inlet to H2 ion echanger

# Result
print x," percent of total raw water is passed through the H ion exchanger."

48.4197432526  percent of total raw water is passed through the H ion exchanger.


### Example 4.20 Page 155¶

In :
# solution
# Variables
m1 = 1488.1                             #kmol/h gas mix to reactor1 (basis)
m2 = m1*.0625                           # CH3OH
m3 = m1-m2                              # ambient air flow
m4 = m3/1.01772                         # dry air flow rate
m5 = m3-m4                              # moisture
m6 = m2*.99                             # CH3OH conversion in R1
m7 = m2-m6                              # unreacted CH3OH

# Calculation
#rxn i
m8 = m7*.9                              # CH3OH reacted = HCHO produced = H2O produced
m9 = m8/2                               # O2 consumed
m10 = m6-m8                             # CH3OH reacted in rxn ii to v

#rxn ii
m11 = m10*.71                           # CH3OH reacted = CO2 produced
m12 = m11*1.5                           # O2 consumed
m13 = 2*m11                             # H2O produced

#rxn iii
m14 = m10*.08                           # CH3OH reacted = CO produced
m15 = 2*m14                             # H2 produced

#rxn iv
m16 = m10*.05                           # Ch3OH reacted = CH4 produced
m17 = m16/2                             # O2 produced

#rxn v
m18 = m10-m16-m14-m11                   # CH3OH reacted
m19 = m18/2                             # (CH3)2O = H2O produced

m20 = 287.87-m9-m12+m17                 # O2 in R1 exit stream
m21 = m5+m8+m13+m19                     # H2O in R1
m = m7+m8+m11+m14+m15+m16+m19+m20+1082.93+m21

# R2
# x kmol/h CH3OH is added b/w reactors
# (m7+x)/(m+x) = .084 solving it
x = 140.548                             #[kmol/h]
m22 = x+m7                              # CH3OH entering R2
m23 = m22*.99                           #CH3OH reacted
m24 = m22-m23                           # CH3OH unreacted

#rxn i
m25 = m23*.9                            # CH3OH reacted = HCHO produced = H2O produced
m26 = m25/2                             # O2 consumed
m27 = m23 - m25                         # CH3OH reacted in rxn ii to v

#rxn ii
m28 = m27*.71                           # CH3OH reacted = CO2 produced
m29 = m28*1.5                           # O2 consumed
m30 = m28*2                             # H2O produced

#rxn iii
m31 = m27*.08                           # CH3OH reacted = CO produced
m32 = m31*2                             # H2 produced

#rxn iv
m33 = m27*.05                           # Ch3OH reacted = CH4 produced
m34 = m33/2                             # O2 produced

#rxn v
m35 = m27-m28-m31-m33                   # CH3OH reacted
m36 = m35/2                             # (CH3)2O = H2O produced

m37 = m20 - m26-m29+m34                 # O2 in R2 exit stream
m38 = m21+m25+m36                       # H2O in R2
m39 = 92.07+m25                         # HCHO in R2
m40 = m24+m39+m28+m31+m32+m33+m36+m37+m38+1082.93

m41 = m39*30                            # kg/h   HCHO produced
m42 = m41/.37                           # bottom sol floe rate
c = (m42-9030.4)*100/9030.4             # increase in capacity

# Result
print "Increase in capacity = ",c," percent."

Increase in capacity =  95.8492338978  percent.


### Example 4.21 Page 159¶

In :
# solution

# Variables
# basis 1 tonne of pig iron
coke = 1000.                        #kg
flux = 400.                         #kg
Fe1 = 1000*.95                      # Fe in pig iron

# Calculation and  Result
Fe2 = (112/160.)*.8                 # Fe available per kg of ore
ore = Fe1/Fe2                       # kg
Si = .014*1000                      #kg  #Si in pig iron
si1 = (60/28.)*14                   # silica present in pig iron
si2 = ore*.12                       # silica in ore
si3 = .1*coke                       # silica in coke
si4 = si2+si3-si1                   # silica in slag
alumina = ore*.08                   # Al2O3 in ore = Al2O3 in slag
CaO = flux*(56/100.)
slag = si4+alumina+CaO
print "a   Mass of slag made = ",slag," kg.   \nb   Mass of ore required = ",ore,\
" kg.   \nc   Composition of slag :  SiO2 = ",si4," kg  Al2O3 = ",alumina," kg  CaO = ",CaO," kg.    \nd  ",
C = .9*coke+(12/100.)*flux-36       # total C available

# CO:CO2 = 2:1
C1 = C/3                            # C converted to CO2
C2 = 2*C/3                          # C converted to CO
O21 = C1*(32/12.)+C2*(16./12)       # O2 required for CO and CO2 formation
O22 = (32/28.)*Si                   # O2 from SiO2
O23 = ore*(.8*48/160)               # O2 from Fe2O3
O24 = flux*(32/100.)                # O2 from CaCO3
O25 = O21-O22-O23-O24               #kg O2 to be supplied
O26 = O25/32                        #kmol
air = O26/.21                       #kmol
V = air*22.414                      #m**3
print " Volume of air to be supplied = ",V," m**3."

a   Mass of slag made =  633.285714286  kg.
b   Mass of ore required =  1696.42857143  kg.
c   Composition of slag :  SiO2 =  273.571428571  kg  Al2O3 =  135.714285714  kg  CaO =  224.0  kg.
d    Volume of air to be supplied =  3569.53115079  m**3.