summaryrefslogtreecommitdiff
path: root/Elementary_Principles_of_Chemical_Processes/Chapter4.ipynb
diff options
context:
space:
mode:
authorhardythe12014-08-06 17:26:32 +0530
committerhardythe12014-08-06 17:26:32 +0530
commit98bff1c301dd3b8b14983037a8a483e3eae1796d (patch)
tree1f6a831fd79192d4cbc0c4738c77f8fbf29d0552 /Elementary_Principles_of_Chemical_Processes/Chapter4.ipynb
parent90bb10608fa3697134121eabc32cfae69e7686d8 (diff)
downloadPython-Textbook-Companions-98bff1c301dd3b8b14983037a8a483e3eae1796d.tar.gz
Python-Textbook-Companions-98bff1c301dd3b8b14983037a8a483e3eae1796d.tar.bz2
Python-Textbook-Companions-98bff1c301dd3b8b14983037a8a483e3eae1796d.zip
adding books
Diffstat (limited to 'Elementary_Principles_of_Chemical_Processes/Chapter4.ipynb')
-rwxr-xr-xElementary_Principles_of_Chemical_Processes/Chapter4.ipynb1771
1 files changed, 1771 insertions, 0 deletions
diff --git a/Elementary_Principles_of_Chemical_Processes/Chapter4.ipynb b/Elementary_Principles_of_Chemical_Processes/Chapter4.ipynb
new file mode 100755
index 00000000..0ee3fbef
--- /dev/null
+++ b/Elementary_Principles_of_Chemical_Processes/Chapter4.ipynb
@@ -0,0 +1,1771 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:cf9c0d91c794ab27af5e7da425a28b836daf2f988940f28c4a10f4b42bda95d5"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 4: Fundamentals of Material Balances"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.2-1, page no. 85"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initialization of variables\n",
+ "input=50000 #ppl/yr\n",
+ "generation=22000 #ppl/yr\n",
+ "consumption=19000 #ppl/yr\n",
+ "output=75000 #ppl/yr\n",
+ "print (\"All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "#Calculations and printing:\n",
+ "accumulation = input+generation-output-consumption\n",
+ "print (\" We know that accumulation=input+generation-output-consumption\")\n",
+ "print '%s %d %s' %('Hence, Each year population decreases by', -accumulation, 'people')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ " We know that accumulation=input+generation-output-consumption\n",
+ "Hence, Each year population decreases by 22000 people\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 1,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.2-2, page no. 86"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "inputBenzene=500 #kg/h\n",
+ "inputToluene=500 #kg/h\n",
+ "UpStreamBenzene=450 #kg/h\n",
+ "DownStreamToluene=475 #kg/h\n",
+ "#Calculations and printing:\n",
+ "print(\"All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "print(\"Using benzene balance,\")\n",
+ "m2dot=inputBenzene-UpStreamBenzene\n",
+ "print ' %s %d %s' %(' m2dot= ', m2dot, ' kg B/h')\n",
+ "print(\"Using Toluene balance\")\n",
+ "m1dot=inputToluene-DownStreamToluene\n",
+ "print ' %s %d %s' %(' m1dot= ', m1dot, ' kg T/h')\n",
+ "print(\"To check we can perform Overall mass balance\")\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ "Using benzene balance,\n",
+ " m2dot= 50 kg B/h\n",
+ "Using Toluene balance\n",
+ " m1dot= 25 kg T/h\n",
+ "To check we can perform Overall mass balance\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 2,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.2-3, page no. 87"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initialization of variables\n",
+ "m1=200 #g\n",
+ "m2=150 #g\n",
+ "x1=0.4 #methanol/g\n",
+ "x2=0.7 #methanol/g\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "m=m1+m2\n",
+ "print '%s %d %s' %(' Total mass after mixing m=',m, 'g',)\n",
+ "x=(m1*x1 + m2*x2)/m\n",
+ "print'%s %.2f %s %.2f' %(' The composition of the methanol in the product is', x ,' and water is', 1-x)\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ " Total mass after mixing m= 350 g\n",
+ " The composition of the methanol in the product is 0.53 and water is 0.47\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 3,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.2-4, page no. 88"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "rate=0.1 #kmol/min\n",
+ "x1=0.1 #mole fraction hexane vapour\n",
+ "vol=10 #m^3\n",
+ "d=0.659 #kg/L\n",
+ "M=86.2 #Kg/kmol\n",
+ "#Calculations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "ndot=rate/(1-x1)\n",
+ "deltaN= -vol*d*1000 /M\n",
+ "tf=deltaN/(-0.1 * ndot)\n",
+ "print '%s %.2f %s' %(' The time Required for the Total process= ',tf, 'min')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ " The time Required for the Total process= 6880.51 min\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 5,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.3-1, page no. 92"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "Vdot=20 #CC/min\n",
+ "x=0.015\n",
+ "MH2O=18.02 #g\n",
+ "DH2O=1 #g/CC\n",
+ "x1=0.2\n",
+ "#Calculations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "n2=Vdot*DH2O/MH2O\n",
+ "print'%s %.2f %s' %('n2=', n2, ' mol/min')\n",
+ "print(\"Using Water Balance,\")\n",
+ "n3=n2/x\n",
+ "print'%s %.2f %s' %('n3=', n3, ' mol/min')\n",
+ "print(\"Using total mole balance,\")\n",
+ "n1=(n3-n2)/(1+x1)\n",
+ "print'%s %.2f %s' %('n1=', n1, ' mol/min')\n",
+ "print(\"Using N2 balance,\")\n",
+ "y=1-x-0.79*n1/n3\n",
+ "print '%s %.2f %s' %('y=',y,' mol O2/mol')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ "n2= 1.11 mol/min\n",
+ "Using Water Balance,\n",
+ "n3= 73.99 mol/min\n",
+ "Using total mole balance,\n",
+ "n1= 60.73 mol/min\n",
+ "Using N2 balance,\n",
+ "y= 0.34 mol O2/mol\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 6,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.3-2, page no. 94"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "basis=100 #mol\n",
+ "FinalBasis=1250.0 #lb-moles/h\n",
+ "#Calulations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "multiply=FinalBasis/basis\n",
+ "Feed=100*multiply\n",
+ "TopStream=50*multiply\n",
+ "BottomStream1=12.5*multiply\n",
+ "BottomStream2=37.5*multiply\n",
+ "print '%s %.2f %s' %(' Final Basis=',Feed,' lb-moles /h')\n",
+ "print '%s %.2f %s' %(' Final Top Stream Feed=',TopStream, 'lb-moles /h')\n",
+ "print '%s %.2f %s' %(' Final Bottom Stream Feed 1 =', BottomStream1,'lb-moles A/h')\n",
+ "print '%s %.2f %s' %(' Final Bottom Stream Feed 2 =' ,BottomStream2,' lb-moles B/h')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ " Final Basis= 1250.00 lb-moles /h\n",
+ " Final Top Stream Feed= 625.00 lb-moles /h\n",
+ " Final Bottom Stream Feed 1 = 156.25 lb-moles A/h\n",
+ " Final Bottom Stream Feed 2 = 468.75 lb-moles B/h\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 7,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.3-3, page no. 97"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "basis=100 #kg\n",
+ "inputx=0.2\n",
+ "outputx=0.08\n",
+ "D=1 #kg/L\n",
+ "#Calculations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "print(\"Using NaOH balance\")\n",
+ "m2=inputx*basis/outputx\n",
+ "print '%s %.2f %s' %('m2=',m2 ,'Kg NaOH')\n",
+ "print(\"Using Total mass balance\")\n",
+ "m1=m2-basis\n",
+ "print '%s %.2f %s' %('m1=',m1, 'Kg Water')\n",
+ "V1=m1/D\n",
+ "print '%s %.2f %s' %(' V1=',V1 ,'Litres')\n",
+ "Ratio1=V1/basis\n",
+ "Ratio2=m2/basis\n",
+ "print '%s %.2f %s' %(' Ratio of lt water/Kg Feed =', Ratio1,' lt water/Kg Feed')\n",
+ "print '%s %.2f %s' %(' Ratio of Kg product/Kg Feed =', Ratio2 ,'Kg product/Kg Feed')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ "Using NaOH balance\n",
+ "m2= 250.00 Kg NaOH\n",
+ "Using Total mass balance\n",
+ "m1= 150.00 Kg Water\n",
+ " V1= 150.00 Litres\n",
+ " Ratio of lt water/Kg Feed = 1.50 lt water/Kg Feed\n",
+ " Ratio of Kg product/Kg Feed = 2.50 Kg product/Kg Feed\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 8,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.3-5, page no. 102"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "inputx=0.45\n",
+ "outputx=0.95\n",
+ "basis=2000 #L/h\n",
+ "outputBasis=100 #Kmol\n",
+ "M1=78.11\n",
+ "M2=92.13\n",
+ "D=0.872\n",
+ "z=0.08\n",
+ "#Calculations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "mass1=outputBasis*M1*outputx\n",
+ "mass2=outputBasis*M2*(1-outputx)\n",
+ "mass=mass1+mass2\n",
+ "yB2=mass1/mass\n",
+ "m1=basis*D\n",
+ "print '%s %.2f %s' %(' m1=',m1,' Kg/h')\n",
+ "mB3=z*inputx*m1\n",
+ "print '%s %.2f %s' %(' mB3=',mB3,' Kg/h')\n",
+ "print(\"Using Benzene balance,\")\n",
+ "m2=(inputx*m1-mB3)/yB2\n",
+ "print '%s %.2f %s' %(' m2=',m2, 'Kg/h')\n",
+ "print(\"Using Toluene balance,\")\n",
+ "mT3=(1-inputx)*m1-(1-yB2)*m2\n",
+ "print '%s %.2f %s' %(' mT3=',mT3,' Kg/h')\n",
+ "m3=mB3+mT3\n",
+ "print '%s %.2f %s' %(' m3=',m3,' Kg/h')\n",
+ "yB3=mB3/m3\n",
+ "print '%s %.2f %s' %(' yB3=',yB3,' kg B/kg')\n",
+ "yT3=1-yB3\n",
+ "print '%s %.2f %s' %(' yT3=',yT3, 'kg T/kg')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ " m1= 1744.00 Kg/h\n",
+ " mB3= 62.78 Kg/h\n",
+ "Using Benzene balance,\n",
+ " m2= 766.84 Kg/h\n",
+ "Using Toluene balance,\n",
+ " mT3= 914.38 Kg/h\n",
+ " m3= 977.16 Kg/h\n",
+ " yB3= 0.06 kg B/kg\n",
+ " yT3= 0.94 kg T/kg\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 10,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.4-1, page no. 105"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "inputMass1=100 #Kg/h\n",
+ "inputMass2=30 #Kg/h\n",
+ "outputMass1=40 #Kg/h\n",
+ "outputMass2=30 #Kg/h\n",
+ "inputx1=0.5\n",
+ "inputx2=0.3\n",
+ "outputx1=0.9\n",
+ "outputx2=0.6\n",
+ "#Calculations and printing\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "print(\"using Overall Mass balance, \")\n",
+ "m3=inputMass1+inputMass2-outputMass1-outputMass2\n",
+ "print '%s %d %s' %('m3=',m3,' Kg/h')\n",
+ "print(\"using Overall balance on A, \")\n",
+ "x3=(inputMass1*inputx1+inputMass2*inputx2-outputMass1*outputx1-outputMass2*outputx2)/m3\n",
+ "print '%s %.2f %s' %('x3=',x3,' Kg A/kg')\n",
+ "print(\"using Mass balance on Unit 1, \")\n",
+ "m1=inputMass1-outputMass1\n",
+ "print '%s %d %s' %('m1=',m1,' Kg/h')\n",
+ "print(\"using A balance on Unit 1, \")\n",
+ "x1=(inputMass1*inputx1-outputMass1*outputx1)/m1\n",
+ "print '%s %.2f %s' %('x1=',x1,' Kg A/kg')\n",
+ "print(\"using Mass balance on mixing point, \")\n",
+ "m2=inputMass2+m1\n",
+ "print '%s %d %s' %('m2=',m2,'Kg/h')\n",
+ "print(\"using A balance on mixing point, \")\n",
+ "x2=(inputMass2*inputx2+m1*x1)/m2\n",
+ "print '%s %.2f %s' %('x2=',x2 ,'Kg A/kg')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ "using Overall Mass balance, \n",
+ "m3= 60 Kg/h\n",
+ "using Overall balance on A, \n",
+ "x3= 0.08 Kg A/kg\n",
+ "using Mass balance on Unit 1, \n",
+ "m1= 60 Kg/h\n",
+ "using A balance on Unit 1, \n",
+ "x1= 0.23 Kg A/kg\n",
+ "using Mass balance on mixing point, \n",
+ "m2= 90 Kg/h\n",
+ "using A balance on mixing point, \n",
+ "x2= 0.26 Kg A/kg\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 12,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.4-2, page no. 107"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "from numpy import matrix, array, dot\n",
+ "from numpy.linalg import inv\n",
+ "import math\n",
+ "massin=100 #kg\n",
+ "M1=100 #kg\n",
+ "M2=75 #Kg\n",
+ "massout=43.1 #kg\n",
+ "inputx=0.5\n",
+ "outputxA=0.053\n",
+ "outputxM=0.016\n",
+ "m1xA=0.275\n",
+ "m1xM=0.725\n",
+ "m3xW=0.03\n",
+ "m3xA=0.09\n",
+ "m3xM=0.88\n",
+ "#Calculations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "print(\"Using Balances around two-extraxtor system,\")\n",
+ "print(\"Balance on total mass,\")\n",
+ "\n",
+ "A=array([[1,1],[m1xA,m3xA]])\n",
+ "b=array([[massin+M1+M2-massout],[massin*inputx - massout*outputxA]])\n",
+ "C=dot(inv(A),b)\n",
+ "m1=C[0,0]\n",
+ "m3=C[1,0]\n",
+ "print '%s %.2f %s' %(' m1=',m1,' Kg')\n",
+ "print '%s %.2f %s' %(' m3=',m3,' Kg')\n",
+ "print(\"Balance on M\")\n",
+ "xM1=(massin+M2-massout*outputxM-m3*m3xM)/m1\n",
+ "print '%s %.2f %s' %(' xM1=',xM1,' kg MIBK/kg')\n",
+ "print(\"Balances around Extract mixing point, \")\n",
+ "print(\"Balance on A\")\n",
+ "mA4=m1*m1xA+m3*m3xA\n",
+ "print '%s %.2f %s' %(' mA4=',mA4 ,'Kg Acetone')\n",
+ "print(\"Balance on M\")\n",
+ "mM4=m1*xM1+m3*m3xM\n",
+ "print '%s %.2f %s' %(' mM4=',mM4,' Kg MIBK')\n",
+ "print(\"Balance on W\")\n",
+ "mW4=m1*(m1xM-xM1) + m3*m3xW\n",
+ "print '%s %.2f %s' %(' mW4=',mW4 ,'Kg Water')\n",
+ "print(\"Balances around the First extractor\")\n",
+ "print(\"Balance on A\")\n",
+ "mA2=massin*inputx-m1*m1xA\n",
+ "print '%s %.2f %s' %(' mA2=',mA2,' Kg Acetone')\n",
+ "print(\"Balance on M\")\n",
+ "mM2=massin-m1*xM1\n",
+ "print '%s %.2f %s' %(' xM1=',xM1, 'Kg MIBK')\n",
+ "print(\"Balance on W\")\n",
+ "mW2=massin*inputx- m1*(m1xM-xM1)\n",
+ "print '%s %.2f %s' %(' mW2=',mW2,'Kg Water')\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ "Using Balances around two-extraxtor system,\n",
+ "Balance on total mass,\n",
+ " m1= 145.11 Kg\n",
+ " m3= 86.79 Kg\n",
+ "Balance on M\n",
+ " xM1= 0.67 kg MIBK/kg\n",
+ "Balances around Extract mixing point, \n",
+ "Balance on A\n",
+ " mA4= 47.72 Kg Acetone\n",
+ "Balance on M\n",
+ " mM4= 174.31 Kg MIBK\n",
+ "Balance on W\n",
+ " mW4= 9.87 Kg Water\n",
+ "Balances around the First extractor\n",
+ "Balance on A\n",
+ " mA2= 10.10 Kg Acetone\n",
+ "Balance on M\n",
+ " xM1= 0.67 Kg MIBK\n",
+ "Balance on W\n",
+ " mW2= 42.73 Kg Water\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.5-1, page no. 110"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "x1=0.960\n",
+ "x2=0.977\n",
+ "x3=0.983\n",
+ "basis=100 #mol\n",
+ "#Calculations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "print(\"Overall dry Air balance,\")\n",
+ "n1=x3*basis/x1\n",
+ "print '%s %.2f %s' %('n1=',n1,' mol Fresh feed')\n",
+ "print(\"Overall mole balance,\")\n",
+ "n3=n1-basis\n",
+ "print '%s %.2f %s' %('n3=',n3,' mol Water condensed')\n",
+ "print(\"Mole balance on mixing point,\")\n",
+ "print(\"n1+n5=n2\")\n",
+ "print(\"Water balance on mixing point\")\n",
+ "print ' %.2f %s %.2f %s %.2f %s' %(1-x1,' n1+ ', 1-x3,' n5 =', 1-x2,'n2')\n",
+ "A=([[1 ,-1],[1-x2,-(1-x3)]])\n",
+ "b=([[n1],[(1-x1)*n1]])\n",
+ "C=numpy.dot(linalg.inv(A),b)\n",
+ "n2=C[0,0]\n",
+ "n5=C[1,0]\n",
+ "print '%s %.2f %s' %(' \\n n2=',n2,' mol')\n",
+ "print '%s %.2f %s' %(' \\n n5=',n5,' mol Recycled')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ "Overall dry Air balance,\n",
+ "n1= 102.40 mol Fresh feed\n",
+ "Overall mole balance,\n",
+ "n3= 2.40 mol Water condensed\n",
+ "Mole balance on mixing point,\n",
+ "n1+n5=n2\n",
+ "Water balance on mixing point\n",
+ " 0.04 n1+ 0.02 n5 = 0.02 n2\n",
+ " \n",
+ " n2= 392.52 mol\n",
+ " \n",
+ " n5= 290.12 mol Recycled\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 15,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.5-2, page no. 112"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "feed=4500 #kg/h\n",
+ "feedx=0.333\n",
+ "m3x=0.494\n",
+ "m5x=0.364\n",
+ "x=0.95\n",
+ "#Calculations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "m6x=m5x\n",
+ "print '%s %.2f %s' %('Given, m4=',x,' (m4+m5)')\n",
+ "print(\"using Overall K2CrO4 balance, \")\n",
+ "print ' %.2f %s %.2f %s %.2f %s' %(feedx,' *', feed ,'= m4+', m6x,'m5')\n",
+ "A=([[1-x,-x],[1,m6x]])\n",
+ "b=([[0],[feedx*feed]])\n",
+ "C=numpy.dot(linalg.inv(A),b)\n",
+ "m4=C[0,0]\n",
+ "m5=C[1,0]\n",
+ "print '%s %.2f %s' %(' \\n m4=',m4,' K2CrO4 crystals/h')\n",
+ "print '%s %.2f %s' %(' \\n m5=',m5,' entrained solution/h')\n",
+ "print(\"Overall Total mass balance , \")\n",
+ "m2=feed-m4-m5\n",
+ "print '%s %.2f %s' %('m2=',m2,' Kg H2O evaporated/h')\n",
+ "print(\"Mass balance around the crystallizer,\")\n",
+ "print(\"m3=m4+m5+m6\")\n",
+ "print(\"Water balance around the crystallizer, \")\n",
+ "print ' %.2f %s %.2f %s %.2f %s' %(1-m3x, 'm3=', 1-m5x,' m5 + ',1-m6x,' m6')\n",
+ "D=([[1,-1],[1,(-1+m6x)/(1-m3x)]])\n",
+ "e=([[m4+m5],[(1-m5x)*m5/(1-m3x)]])\n",
+ "F=numpy.dot(linalg.inv(D),e)\n",
+ "m3=F[0,0]\n",
+ "m6=F[1,0]\n",
+ "print '%s %.2f %s' %(' \\n m3=',m3,' Kg/h fed to the crystallizer')\n",
+ "print '%s %.2f %s' %(' \\n m6=',m6,' Kg/h')\n",
+ "ratio=m6/feed\n",
+ "print '%s %.2f %s' %(' \\n ratio=',ratio,' Kg recycle/ Kg fresh feed')\n",
+ "print(\"mass balance around Recycle-fresh feed mixing point, \")\n",
+ "m1=feed+m6\n",
+ "print '%s %.2f %s' %('m1=',m1,' kg/h feed to the evaporator')\n",
+ "print(\"With out recycle, \")\n",
+ "print(\"m3=622 Kg/h\")\n",
+ "print(\"m5=2380 Kg/h\")\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ "Given, m4= 0.95 (m4+m5)\n",
+ "using Overall K2CrO4 balance, \n",
+ " 0.33 * 4500.00 = m4+ 0.36 m5\n",
+ " \n",
+ " m4= 1470.33 K2CrO4 crystals/h\n",
+ " \n",
+ " m5= 77.39 entrained solution/h\n",
+ "Overall Total mass balance , \n",
+ "m2= 2952.28 Kg H2O evaporated/h\n",
+ "Mass balance around the crystallizer,\n",
+ "m3=m4+m5+m6\n",
+ "Water balance around the crystallizer, \n",
+ " 0.51 m3= 0.64 m5 + 0.64 m6\n",
+ " \n",
+ " m3= 7193.31 Kg/h fed to the crystallizer\n",
+ " \n",
+ " m6= 5645.60 Kg/h\n",
+ " \n",
+ " ratio= 1.25 Kg recycle/ Kg fresh feed\n",
+ "mass balance around Recycle-fresh feed mixing point, \n",
+ "m1= 10145.60 kg/h feed to the evaporator\n",
+ "With out recycle, \n",
+ "m3=622 Kg/h\n",
+ "m5=2380 Kg/h\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 16,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.6-1, page no. 120"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "basis=100 #mol\n",
+ "xP=0.1\n",
+ "xN=0.12\n",
+ "xA=0.78\n",
+ "x=0.3\n",
+ "#Calculations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "nP=basis*xP\n",
+ "nN=basis*xN\n",
+ "nO2=basis*xA*0.21\n",
+ "nN2=basis-nP-nN-nO2\n",
+ "if nN/nP>1:\n",
+ " print(\"NH3 is in excess\")\n",
+ "else:\n",
+ " print(\"Propene is in excess\")\n",
+ "\n",
+ "if nO2/nP>1:\n",
+ " print(\"O2 is in excess\")\n",
+ "else:\n",
+ " print(\"propene is in excess\")\n",
+ "\n",
+ "nO2reacted=nP*1.5\n",
+ "nNreacted=nP*1\n",
+ "ExcessAmmonia=(nN-nNreacted)*100/nNreacted\n",
+ "ExcessO2=(nO2-nO2reacted)*100/nO2reacted\n",
+ "print '%s %.2f' %(' \\n percentage excess Ammonia=',ExcessAmmonia)\n",
+ "print '%s %.2f' %(' \\n percentage excess Oxygen=',ExcessO2)\n",
+ "nPout=(1-x)*nP\n",
+ "print '%s %.2f %s' %(' \\n no.of moles of Propylene left=', nPout,' mol')\n",
+ "E=nP-nPout\n",
+ "nNout=nN-E\n",
+ "nO2out=nO2-1.5*E\n",
+ "nAc=E\n",
+ "nW=3*E\n",
+ "print'%s %.2f %s' %(' \\n no.of moles of Ammonia left=', nNout,' mol')\n",
+ "print'%s %.2f %s' %(' \\n no.of moles of oxygen left=' ,nO2out,' mol')\n",
+ "print'%s %.2f %s' %(' \\n no.of moles of ACN formed= ',nAc ,'mol')\n",
+ "print'%s %.2f %s' %(' \\n no.of moles of water formed=', nW ,'mol')\n",
+ "print'%s %.2f %s' %(' \\n no.of moles of Nirtogen present= ',nN2 ,'mol')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ "NH3 is in excess\n",
+ "O2 is in excess\n",
+ " \n",
+ " percentage excess Ammonia= 20.00\n",
+ " \n",
+ " percentage excess Oxygen= 9.20\n",
+ " \n",
+ " no.of moles of Propylene left= 7.00 mol\n",
+ " \n",
+ " no.of moles of Ammonia left= 9.00 mol\n",
+ " \n",
+ " no.of moles of oxygen left= 11.88 mol\n",
+ " \n",
+ " no.of moles of ACN formed= 3.00 mol\n",
+ " \n",
+ " no.of moles of water formed= 9.00 mol\n",
+ " \n",
+ " no.of moles of Nirtogen present= 61.62 mol\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 17,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.6-2, page no. 122"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "print(\"Given, Reaction is CO(g)+ H2O(g) --> CO2(g)+ H2(g)\")\n",
+ "nCO=1.\n",
+ "nH2O=2.\n",
+ "#Calculations and printing:\n",
+ "nt=nCO+nH2O\n",
+ "print(\"\\n It is found that Ee=0.667\")\n",
+ "Ee=0.667\n",
+ "yCO=(nCO-Ee)/nt\n",
+ "yH2O=(nH2O-Ee)/nt\n",
+ "yCO2=Ee/nt\n",
+ "yH2=Ee/nt\n",
+ "print(\"\\n Ee is obtained by solving the quadratic yCO2*yH2/(yCO*yH2O)=1\")\n",
+ "print(\"\\n Limiting reactant is CO\")\n",
+ "print '%s %.3f' %(\"\\n yCO = \",yCO)\n",
+ "print '%s %.3f' %(\"\\n yCO2 = \",yCO2)\n",
+ "print '%s %.3f' %(\"\\n yH2O = \",yH2O)\n",
+ "print '%s %.3f' %(\"\\n yH2 = \",yH2)\n",
+ "nCOF=yCO*nt\n",
+ "fCO=(nCO-nCOF)/nCO\n",
+ "print '%s %.3f' %(\"\\n Fractional conversion of CO at equilibrium is \", fCO)\n",
+ "raw_input('press enter key to exit')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Given, Reaction is CO(g)+ H2O(g) --> CO2(g)+ H2(g)\n",
+ "\n",
+ " It is found that Ee=0.667\n",
+ "\n",
+ " Ee is obtained by solving the quadratic yCO2*yH2/(yCO*yH2O)=1\n",
+ "\n",
+ " Limiting reactant is CO\n",
+ "\n",
+ " yCO = 0.111\n",
+ "\n",
+ " yCO2 = 0.222\n",
+ "\n",
+ " yH2O = 0.444\n",
+ "\n",
+ " yH2 = 0.222\n",
+ "\n",
+ " Fractional conversion of CO at equilibrium is 0.667\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "press enter key to exit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 18,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.6-3, page no. 124"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "basis=100 #mol\n",
+ "x=0.850\n",
+ "conv1=0.501\n",
+ "conv2=0.471\n",
+ "#Calculations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "n1=(1-conv1)*basis*x\n",
+ "n2=conv2*basis*x\n",
+ "E1=n2\n",
+ "E2=basis*x - E1-n1\n",
+ "n3=E1-E2\n",
+ "n4=2*E2\n",
+ "n5=basis*(1-x)\n",
+ "nt=n1+n2+n3+n4+n5\n",
+ "selectivity=n2/n4\n",
+ "print '%s %.2f %s ' %('selectivity=',selectivity,' mol Ethene/mol methane')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ "selectivity= 7.85 mol Ethene/mol methane \n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 19,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.7-2, page no. 135"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "basis=100 #mol\n",
+ "x=0.850\n",
+ "conv1=0.501\n",
+ "conv2=0.471\n",
+ "#Calculations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "n1=(1-conv1)*basis*x\n",
+ "n2=conv2*basis*x\n",
+ "E1=n2\n",
+ "E2=basis*x - E1-n1\n",
+ "n3=E1-E2\n",
+ "n4=2*E2\n",
+ "n5=basis*(1-x)\n",
+ "nt=n1+n2+n3+n4+n5\n",
+ "selectivity=n2/n4\n",
+ "print '%s %.2f %s ' %('selectivity=',selectivity,' mol Ethene/mol methane')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ "selectivity= 7.85 mol Ethene/mol methane \n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 20,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.7-3, page no. 139"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "import math\n",
+ "import numpy\n",
+ "from numpy import linalg\n",
+ "x0=0.996\n",
+ "basis=100 #mol combined feed to the reactor\n",
+ "inputxH2=0.7\n",
+ "single_pass=0.6\n",
+ "inputxCO2=0.28\n",
+ "molI=2\n",
+ "Ix=0.004\n",
+ "final=155 #kmol/h\n",
+ "#Calculations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "print(\"Reactor analysis, \")\n",
+ "n2=(1-single_pass)*basis*inputxH2\n",
+ "print '%s %.2f %s' %('n2=',n2,' mol H2')\n",
+ "print(\"H2 balance\")\n",
+ "consH2=basis*inputxH2-n2\n",
+ "print '%s %.2f %s' %('H2 moles consumed=',consH2,' mol H2')\n",
+ "print(\"CO2 balance\")\n",
+ "n1=basis*inputxCO2-consH2/3\n",
+ "print '%s %.2f %s' %('n1=',n1,'mol CO2')\n",
+ "print(\"Methanol balance\")\n",
+ "n3=consH2/3\n",
+ "print '%s %.2f %s' %('n3=',n3,'mol Methanol')\n",
+ "print(\"H2O balance\")\n",
+ "n4=consH2/3\n",
+ "print '%s %.2f %s' %('n4=',n4,' mol H2O')\n",
+ "print(\"condenser analysis\")\n",
+ "print(\"Total mole balance\")\n",
+ "n5=n1+n2+molI\n",
+ "print '%s %.2f %s' %('n5=',n5 ,'mol')\n",
+ "print(\"CO2 balance\")\n",
+ "x5C=n1/n5\n",
+ "print '%s %.2f %s' %('x5C=',x5C,' mol CO2/mol')\n",
+ "print(\"H2 balance\")\n",
+ "x5H=n2/n5\n",
+ "print '%s %.2f %s' %('x5H=', x5H,'mol CO2/mol')\n",
+ "x1=1-x5C-x5H\n",
+ "print '%s %.2f %s' %('x1=',x1,' mol I/mol')\n",
+ "print(\"Fresh Feed-Recycle mixing point analysis\")\n",
+ "print(\"Total mole balance\")\n",
+ "print '%s %.2f' %('n0+nr=',basis)\n",
+ "print(\"I balance\")\n",
+ "print '%s %.2f %s %.2f %s %.2f' %('n0', Ix,' + nr ',x1,' = ',molI)\n",
+ "A=([[1, 1],[Ix, x1]])\n",
+ "b=([[basis],[molI]])\n",
+ "C=numpy.dot(linalg.inv(A),b) #Here We solve two linear equations simultaneously\n",
+ "n0=C[0,0]\n",
+ "nr=C[1,0]\n",
+ "print '%s %.2f %s' %(' \\n n0=',n0,' mol fresh feed')\n",
+ "print '%s %.2f %s' %(' \\n nr=', nr ,'mol recycle')\n",
+ "x0C=(basis*inputxCO2-nr*x5C)/n0\n",
+ "print '%s %.2f %s' %(' \\n x0C=',x0C,' mol CO2/mol')\n",
+ "x0H=1-x0C-Ix\n",
+ "print '%s %.2f %s' %(' \\n x0H=',x0H ,'mol H2/mol')\n",
+ "print(\"Recycle-Purge splitting Analysis\")\n",
+ "print(\"Total mole balance\")\n",
+ "np=n5-nr\n",
+ "print '%s %.2f %s' %('np=',np,' mol purge')\n",
+ "print(\"Flow chart scaling\")\n",
+ "Factor=final/n3\n",
+ "print '%s %.2f %s' %('Factor for scaling=',Factor,' Kmol/h/mol')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ "Reactor analysis, \n",
+ "n2= 28.00 mol H2\n",
+ "H2 balance\n",
+ "H2 moles consumed= 42.00 mol H2\n",
+ "CO2 balance\n",
+ "n1= 14.00 mol CO2\n",
+ "Methanol balance\n",
+ "n3= 14.00 mol Methanol\n",
+ "H2O balance\n",
+ "n4= 14.00 mol H2O\n",
+ "condenser analysis\n",
+ "Total mole balance\n",
+ "n5= 44.00 mol\n",
+ "CO2 balance\n",
+ "x5C= 0.32 mol CO2/mol\n",
+ "H2 balance\n",
+ "x5H= 0.64 mol CO2/mol\n",
+ "x1= 0.05 mol I/mol\n",
+ "Fresh Feed-Recycle mixing point analysis\n",
+ "Total mole balance\n",
+ "n0+nr= 100.00\n",
+ "I balance\n",
+ "n0 0.00 + nr 0.05 = 2.00\n",
+ " \n",
+ " n0= 61.40 mol fresh feed\n",
+ " \n",
+ " nr= 38.60 mol recycle\n",
+ " \n",
+ " x0C= 0.26 mol CO2/mol\n",
+ " \n",
+ " x0H= 0.74 mol H2/mol\n",
+ "Recycle-Purge splitting Analysis\n",
+ "Total mole balance\n",
+ "np= 5.40 mol purge\n",
+ "Flow chart scaling\n",
+ "Factor for scaling= 11.07 Kmol/h/mol\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 21,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.8-1, page no. 143"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "xN2wet=0.6\n",
+ "xCO2wet=0.15\n",
+ "xO2wet=0.1\n",
+ "xH2O=0.15\n",
+ "basis=100 #mol Wet gas \n",
+ "#Calculations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "print(\"part 1\")\n",
+ "wet=xN2wet+xCO2wet+xO2wet\n",
+ "xN2dry=xN2wet/wet\n",
+ "xCO2dry=xCO2wet/wet\n",
+ "xO2dry=xO2wet/wet\n",
+ "print '%s %f %s' %(' \\n xN2 dry =', xN2dry,' mol N2/mol dry gas')\n",
+ "print '%s %f %s' %(' \\n xO2 dry =',xO2dry,' mol O2/mol dry gas')\n",
+ "print '%s %f %s' %(' \\n xCO2 dry =', xCO2dry ,'mol CO2/mol dry gas')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ "part 1\n",
+ " \n",
+ " xN2 dry = 0.705882 mol N2/mol dry gas\n",
+ " \n",
+ " xO2 dry = 0.117647 mol O2/mol dry gas\n",
+ " \n",
+ " xCO2 dry = 0.176471 mol CO2/mol dry gas\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 22,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.8-2, page no. 145"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "basisButane=100. #mol/h butane\n",
+ "basisAir=5000. #mol/h\n",
+ "#calculations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "nO2Theoretical=basisButane*6.5\n",
+ "nAirTheoretical=nO2Theoretical*4.76\n",
+ "percent=(basisAir-nAirTheoretical)*100/nAirTheoretical\n",
+ "print '%s %.2f' %(' \\n percent excess air=',percent)\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ " \n",
+ " percent excess air= 61.60\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 23,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.8-3, page no. 147"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "basis=100. #mol ethane feed\n",
+ "E1=0.9\n",
+ "E2=0.25\n",
+ "excess=0.5\n",
+ "#Calculations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "print(\" 50percent excess air\")\n",
+ "nO2theoretical=basis*3.5\n",
+ "n0=nO2theoretical*(1+excess)/0.21\n",
+ "print '%s %.4f %s' %(' n0=',n0,' mol air fed')\n",
+ "print(\"90% ethane conversion\")\n",
+ "n1=(1-E1)*basis\n",
+ "print '%s %.4f' %('No. of moles of ethane unreacted=',n1)\n",
+ "print(\"25% conversion to CO\")\n",
+ "n4=E2*(basis-n1)*2\n",
+ "print '%s %.4f %s' %('n4=', n4 ,'mol CO')\n",
+ "print(\"nitrogen balance\")\n",
+ "n3=0.79*n0\n",
+ "print '%s %.4f %s' %('n3=', n3,' mol N2')\n",
+ "print(\"Atomic carbon balance\")\n",
+ "n5=2*basis-2*n1-n4\n",
+ "print '%s %.4f %s' %('n5=', n5 ,'mol CO2')\n",
+ "print(\"Atomic hydrogen balance\")\n",
+ "n6=(basis*6-n1*6)/2\n",
+ "print '%s %.4f %s' %('n6=', n6,' mol H2O')\n",
+ "print(\"Atomic oxygen balance\")\n",
+ "n2=(nO2theoretical*1.5*2-n4-n5*2-n6)/2\n",
+ "print '%s %.4f %s' %('n2=', n2 ,'mol O2')\n",
+ "dry=n1+n2+n3+n4+n5\n",
+ "wet=dry+n6\n",
+ "y1=n1/dry\n",
+ "print '%s %.4f %s' %('\\n y1=', y1,' mol C2H6/mol')\n",
+ "y2=n2/dry\n",
+ "print '%s %.4f %s' %('\\n y2=', y2 ,'mol O2/mol')\n",
+ "y3=n3/dry\n",
+ "print '%s %.4f %s' %('\\n y3=', y3,' mol N2/mol')\n",
+ "y4=n4/dry\n",
+ "print '%s %.4f %s' %('\\n y4=', y4 ,'mol CO/mol')\n",
+ "y5=n5/dry\n",
+ "print '%s %.4f %s' %('\\n y5=',y5,' mol CO2/mol')\n",
+ "ratio=n6/dry\n",
+ "print '%s %.4f %s' %(' \\n ratio=',ratio,' mol H2O/mol dry stack gas')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ " 50percent excess air\n",
+ " n0= 2500.0000 mol air fed\n",
+ "90% ethane conversion\n",
+ "No. of moles of ethane unreacted= 10.0000\n",
+ "25% conversion to CO\n",
+ "n4= 45.0000 mol CO\n",
+ "nitrogen balance\n",
+ "n3= 1975.0000 mol N2\n",
+ "Atomic carbon balance\n",
+ "n5= 135.0000 mol CO2\n",
+ "Atomic hydrogen balance\n",
+ "n6= 270.0000 mol H2O\n",
+ "Atomic oxygen balance\n",
+ "n2= 232.5000 mol O2\n",
+ "\n",
+ " y1= 0.0042 mol C2H6/mol\n",
+ "\n",
+ " y2= 0.0970 mol O2/mol\n",
+ "\n",
+ " y3= 0.8238 mol N2/mol\n",
+ "\n",
+ " y4= 0.0188 mol CO/mol\n",
+ "\n",
+ " y5= 0.0563 mol CO2/mol\n",
+ " \n",
+ " ratio= 0.1126 mol H2O/mol dry stack gas\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 24,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.8-4, page no. 149"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "basis=100 #mol pf product gas\n",
+ "xCO=0.015\n",
+ "xCO2=0.060\n",
+ "xO2=0.082\n",
+ "xN2=0.843\n",
+ "#Calculations and printing:\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "print(\"N2 balance\")\n",
+ "na=basis*xN2/0.79\n",
+ "print '%s %.2f %s' %('na=',na,' mol air')\n",
+ "print(\"Atomic C balance\")\n",
+ "nc=basis*xCO + basis*xCO2\n",
+ "print '%s %.2f %s' %('nc=',nc ,'mol C')\n",
+ "print(\"Atomic O balance\")\n",
+ "nw=0.21*na*2-basis*(xCO + xCO2*2 + xO2*2)\n",
+ "print '%s %.2f %s' %('nw=',nw,' mol oxygen')\n",
+ "print(\"Atomic H2 balance\")\n",
+ "nh=nw*2\n",
+ "print '%s %.2f %s' %('nh=',nh ,'mol H2')\n",
+ "ratio=nh/nc\n",
+ "print '%s %.2f %s' %('\\n C/H ratio in fuel=',ratio,' mol H/mol C')\n",
+ "print(\"percent excess air\")\n",
+ "nO2theoretical=nc + nh/4\n",
+ "print '%s %.2f %s' %('nO2 theoretical=',nO2theoretical ,'mol O2')\n",
+ "nO2fed=0.21*na\n",
+ "print '%s %.2f %s' %(' \\n nO2fed=',nO2fed,' mol O2')\n",
+ "percent=(nO2fed-nO2theoretical)*100/nO2theoretical\n",
+ "print '%s %.2f %s' %('\\n percentage excess air=',percent ,'excess air')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ "N2 balance\n",
+ "na= 106.71 mol air\n",
+ "Atomic C balance\n",
+ "nc= 7.50 mol C\n",
+ "Atomic O balance\n",
+ "nw= 14.92 mol oxygen\n",
+ "Atomic H2 balance\n",
+ "nh= 29.84 mol H2\n",
+ "\n",
+ " C/H ratio in fuel= 3.98 mol H/mol C\n",
+ "percent excess air\n",
+ "nO2 theoretical= 14.96 mol O2\n",
+ " \n",
+ " nO2fed= 22.41 mol O2\n",
+ "\n",
+ " percentage excess air= 49.80 excess air\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press the Enter key to quit\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 25,
+ "text": [
+ "''"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.9-1, page no. 151"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Initilization of variables\n",
+ "feed=59.6 #mol/s\n",
+ "x=0.2\n",
+ "TopFlow1=48.7 #mol/s\n",
+ "outputx1=0.021\n",
+ "BottomFlow1=10.9\n",
+ "TopFlow2=48.3\n",
+ "outputx2=0.063\n",
+ "BottomFlow2=6.4\n",
+ "print(\" All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\")\n",
+ "print(\"Design\")\n",
+ "MEKin1=feed*x\n",
+ "MEKout1=TopFlow1*outputx1 + BottomFlow1\n",
+ "closure1=MEKout1*100/MEKin1\n",
+ "print '%s %d %s' %('closure1=',closure1,' percent')\n",
+ "print(\"Experiment\")\n",
+ "MEKin2=feed*x\n",
+ "MEKout2=TopFlow2*outputx2 + BottomFlow2\n",
+ "closure2=MEKout2*100/MEKin2\n",
+ "print '%s %d %s' %('closure2=',closure2, 'percent')\n",
+ "raw_input(\"Press the Enter key to quit\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " All the values in the textbook are Approximated hence the values in this code differ from those of Textbook\n",
+ "Design\n",
+ "closure1= 100 percent\n",
+ "Experiment\n",
+ "closure2= 79 percent\n"
+ ]
+ }
+ ]
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file