{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 10 : Material Balance with Chemical Reaction"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.1 pageno : 329"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "mair = 500.                                 #kg\n",
      "mCO2 = 55.                                  #kg\n",
      "mCO = 15.                                   #kg\n",
      "\n",
      "#C3H8 + 5O2 = 3CO2 + 4H20\n",
      "MCO2 = 44 \n",
      "MCO = 28 \n",
      "\n",
      "# Calculation \n",
      "NCO2 = mCO2 / MCO2 \n",
      "NCO = mCO / MCO \n",
      "Mair = 29 \n",
      "Nair = mair / Mair \n",
      "#carbon balance gives,\n",
      "F = (NCO2 + NCO)/3 \n",
      "MC3H8 = 44.064 \n",
      "mC3H8 = MC3H8 * F  \n",
      "\n",
      "# Result\n",
      "print \"(a)mass of propane burnt = %.2f\"%mC3H8,\"kg\"\n",
      "\n",
      "#one mole of propane requres 5 moles of oxygen for combustion\n",
      "NO2 = F * 5 \n",
      "Nairt = NO2 * 100 /21.                      #theoretical air required\n",
      "Pexcess = (Nair - Nairt) * 100 / Nairt \n",
      "print \"(b)The percent excess air = %.2f\"%Pexcess,\"%\"\n",
      "\n",
      "#C3H8 + 7/2 * O2 = 3CO + 4H2O\n",
      "NH2O = F * 4 \n",
      "#Taking oxygen balance, unburned oxygen is calculated,\n",
      "#O2 supplied = O2 present in form of CO2, CO and H2O + unburned O2\n",
      "Nunburnt = Nair * 21. / 100 - NCO2 - NCO/2 - NH2O/2. \n",
      "NN2 = Nair * 79 / 100. \n",
      "Ntotal = NCO2 + NCO + NH2O + NN2 + Nunburnt \n",
      "PCO2 = NCO2 * 100 / Ntotal \n",
      "PCO = NCO *100/ Ntotal \n",
      "PH2O = NH2O *100/ Ntotal \n",
      "PN2 = NN2 *100/ Ntotal \n",
      "PO2 = Nunburnt *100 / Ntotal \n",
      "\n",
      "print \"(c)Percent composition of CO2 = %.2f\"%PCO2,\"%\"\n",
      "print \"Percent composition of CO = %.2f\"%PCO,\"%\"\n",
      "print \"Percent composition of H2O = %.2f\"%PH2O,\"%\"\n",
      "print \"Percent composition of N2 = %.2f\"%PN2,\"%\"\n",
      "print \"Percent composition of O2 = %.2f\"%PO2,\"%\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)mass of propane burnt = 26.23 kg\n",
        "(b)The percent excess air = 21.66 %\n",
        "(c)Percent composition of CO2 = 6.68 %\n",
        "Percent composition of CO = 2.86 %\n",
        "Percent composition of H2O = 12.73 %\n",
        "Percent composition of N2 = 72.84 %\n",
        "Percent composition of O2 = 4.88 %\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.2 pageno : 331"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "Nflue = 100.                        #kmol\n",
      "NCO2 = 14.84 \n",
      "NCO = 1.65 \n",
      "NO2 = 5.16 \n",
      "NN2 = 78.35 \n",
      "PCF = 85.                           #PERCENT CARBON IN FEED\n",
      "PIF = 15.                           #PERCENT INERT IN FEED\n",
      "\n",
      "# Calculation \n",
      "#F - amount of coke charged, W - mass of coke left,W = 0.05F\n",
      "NCflue = NCO2 + NCO  \n",
      "MC = 12. \n",
      "mC = MC * NCflue  \n",
      "\n",
      "#carbon balance gives, F * PCF / 100 = W * PCF + mC \n",
      "F = mC / ( PCF / 100 - 0.05*PCF / 100) \n",
      "#let A kmol air supplied, taking N2 balance,\n",
      "Nair = NN2 * 100/79. \n",
      "NO2supplied = Nair - NN2 \n",
      "Ntheoretical = F * PCF / (100 * MC) \n",
      "Pexcess = ( NO2supplied - Ntheoretical ) * 100 / ( Ntheoretical ) \n",
      "\n",
      "# Result\n",
      "print \"(a)Percentage excess air = %.2f\"%Pexcess,\"%\"\n",
      "mair = Nair * 29 \n",
      "m = mair / F                        #air supplied per kg of coke charged\n",
      "print \"(b)air supplied per kg of coke charged = %.2f\"%m,\"kg\"\n",
      "P = 100.                            #kPa\n",
      "T = 500.                            #K\n",
      "V = Nflue *22.4143*101.325 * T / (F * P * 273.15) \n",
      "print \"(c)volume of flue gas per kg of coke = %.2f\"%V,\"m**3\"\n",
      "W = 0.05*F \n",
      "mCr = W * PCF/100.                  #carbon in refuse\n",
      "mir = F * (1-PCF/100.)              #inert in refuse\n",
      "mr = mCr + mir \n",
      "C = mCr * 100 / mr \n",
      "I = mir *100/ mr \n",
      "print \"(d)Carbon = %.2f\"%C,\"%\"\n",
      "print \"Inert = %.2f\"%I,\"%\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Percentage excess air = 19.99 %\n",
        "(b)air supplied per kg of coke charged = 11.74 kg\n",
        "(c)volume of flue gas per kg of coke = 16.96 m**3\n",
        "(d)Carbon = 22.08 %\n",
        "Inert = 77.92 %\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.3 pageno :  333"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "Nflue = 100.                            #kmol\n",
      "NCO2 = 9. \n",
      "NCO = 2. \n",
      "NO2 = 3. \n",
      "NN2 = 86. \n",
      "NCflue = NCO2 + NCO  \n",
      "MC = 12. \n",
      "mC = MC * NCflue  \n",
      "\n",
      "# Calculation \n",
      "#let A kmol air supplied, taking N2 balance,\n",
      "Nair = NN2 * 100/79. \n",
      "NO2supplied = Nair - NN2 \n",
      "\n",
      "# if CO in the flue gas was to be completely converted to CO2, \n",
      "#then, the moles of oxygen present in the flue gas would be 3-1 =2kmol\n",
      "Noexcess = NO2 - NCO/2. \n",
      "Pexcess =  Noexcess * 100. / ( NO2supplied - Noexcess) \n",
      "\n",
      "# Result\n",
      "print \"(a)Percentage excess air = %.2f\"%Pexcess,\"%\"\n",
      "NwaterO = NO2supplied - NCO2 - NCO/2 - NO2 \n",
      "NH2 = NwaterO*2 \n",
      "mH2 = NH2 * 2 \n",
      "xCF = 0.7\n",
      "R = mC / mH2 \n",
      "print \"(b)Ratio of carbon to hydrogen in the fuel = %.2f\"%R\n",
      "#let x be the amount of moisture in the feed, n it is \n",
      "#given that 70% is carbon,therefore,\n",
      "#0.7 = 3.32 / ( 1 + 3.32 + x )\n",
      "x = R / xCF - 1 - R \n",
      "mH = x * 2.016 / 18.016 \n",
      "mHtotal = mH + mH2 \n",
      "Rtotal = mC / mHtotal \n",
      "print \"(c)Ratio of carbon to total hydrogen in the fuel = %.2f\"%Rtotal\n",
      "ntotal = R + 1  +x \n",
      "PH2 = 1*100./ntotal \n",
      "PH2O = x * 100. / ntotal \n",
      "print \"(d)percentage of combustible hydrogen in the fuel = %.2f\"%PH2,\"%\"\n",
      "print \"percentage of moisture in the fuel = %.2f\"%PH2O,\"%\"\n",
      "nH2Ototal = (PH2O + PH2 * 18.016 / 2.016)/100 \n",
      "print \"(e)The mass of moisture in the flue gas per kg of fuel burned = %.3f\"%nH2Ototal,\"kg\"\n",
      "\n",
      "# note : answer may vary because of rounding error\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Percentage excess air = 9.59 %\n",
        "(b)Ratio of carbon to hydrogen in the fuel = 3.35\n",
        "(c)Ratio of carbon to total hydrogen in the fuel = 3.34\n",
        "(d)percentage of combustible hydrogen in the fuel = 20.92 %\n",
        "percentage of moisture in the fuel = 9.08 %\n",
        "(e)The mass of moisture in the flue gas per kg of fuel burned = 1.960 kg\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.4 pageno : 335"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "Nflue = 100.                            #kmoles\n",
      "NCO2 = 9.05 \n",
      "NCO = 1.34 \n",
      "NO2 = 9.98 \n",
      "NN2 = 79.63 \n",
      "PCO2F = 9.2                             #% ( Feed )\n",
      "PCOF = 21.3                             #%\n",
      "PH2F = 18.                              #%\n",
      "PCH4F = 2.5                             #%\n",
      "PN2F = 49.                              #%\n",
      "\n",
      "\n",
      "# Calculation \n",
      "#Taking carbon balance, \n",
      "F = (NCO2 + NCO )/ ( (PCO2F + PCOF + PCH4F)/100.) \n",
      "\n",
      "#Nitrogen balance gives,\n",
      "Nair = (NN2 - F*PN2F/(100) )* 100 / 79. \n",
      "R = Nair/F \n",
      "\n",
      "# Result\n",
      "print \"(a)molar Ratio of air to fuel = %.2f\"%R\n",
      "Oexcess = NO2 - NCO / 2 \n",
      "Pexcess = Oexcess *100/ (Nair*21./100 - Oexcess) \n",
      "print \"(b)Percent excess of air = %d\"%Pexcess,\"%\"\n",
      "NN2F = F * PN2F / 100 \n",
      "PN2F = NN2F *100/ NN2 \n",
      "print \"(c)Percent of nitrogen in the flue gas that came from fuel = %.2f\"%PN2F,\"%\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)molar Ratio of air to fuel = 2.58\n",
        "(b)Percent excess of air = 120 %\n",
        "(c)Percent of nitrogen in the flue gas that came from fuel = 19.37 %\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.5 pageno : 337"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "Nflue = 100.                        #kmole\n",
      "NCO2 = 16.4 \n",
      "NCO = 0.4 \n",
      "NO2 = 2.3 \n",
      "NN2 = 80.9 \n",
      "PCF = 80.5                          #% ( Feed )\n",
      "PO = 5.0                            #%\n",
      "PHF = 4.6                           #%\n",
      "PN = 1.1                            #%\n",
      "Pash = 8.8                          #%\n",
      "\n",
      "# Calculation \n",
      "#Taking Carbon balance,\n",
      "W = (NCO2 + NCO)*12. / (PCF / 100) \n",
      "mCO2 = NCO2 * 44 \n",
      "mCO = NCO * 32 \n",
      "mO2 = NO2 * 28 \n",
      "mN2 = NN2 * 28.014 \n",
      "mtotal = mCO2 + mCO + mO2 + mN2 \n",
      "Mdryflue = mtotal * 100/ W \n",
      "\n",
      "# Result\n",
      "print \"(a)The weight of dry gaseous products formed per 100 kg of coal fired = %.2f\"%Mdryflue,\"kg\"\n",
      "#taking nitrogen balance,\n",
      "x = (mN2 - W*PN/100)/28.014 \n",
      "Noxygen = x * 21 / 79. \n",
      "Nrequired = W * (PCF /12 + PHF/(2*2.016) - PO/32)/100 \n",
      "Pexcess = (Noxygen - Nrequired)*100/Nrequired  \n",
      "print \"(b)Percent excess air supplied for combustion = %.2f\"%Pexcess,\"%\"\n",
      "\n",
      "\n",
      "# note: answer may vary because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The weight of dry gaseous products formed per 100 kg of coal fired = 1223.92 kg\n",
        "(b)Percent excess air supplied for combustion = 11.49 %\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.6 pageno : 338"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "mcoal = 100.                    #kg\n",
      "mC = 63.                        #kg\n",
      "mH = 12.                        #kg\n",
      "mO = 16.                        #kg\n",
      "mash  = 9.                      #kg\n",
      "mfixC = 39.                     #kg\n",
      "mH2O = 10.                      #kg\n",
      "\n",
      "# Calculation \n",
      "mCvolatile = mC - mfixC \n",
      "mHH2O = mH2O *2.016/18.016      #(mass of hydrogen in moisture)\n",
      "mHvolatile = mH - mHH2O \n",
      "mOH2O = mH2O - mHH2O \n",
      "mOvolatile = mO - mOH2O \n",
      "mtvolatile = mCvolatile + mHvolatile + mOvolatile \n",
      "PC = mCvolatile * 100 / mtvolatile \n",
      "PH = mHvolatile * 100 / mtvolatile \n",
      "PO = mOvolatile * 100 / mtvolatile \n",
      "\n",
      "# Result\n",
      "print \"(a)percent carbon in volatile matter = %.2f\"%PC,\"%\"\n",
      "print \"   percent hydrogen in volatile matter = %.2f\"%PH,\"%\"\n",
      "print \"   percent oxygen in volatile matter = %.2f\"%PO,\"%\"\n",
      "\n",
      "PCflue = 10.8                   #%\n",
      "Pvflue = 9.0                    #%\n",
      "Pashflue = 80.2                 #%\n",
      "\n",
      "#taking ash balance, Wis the weight of the refuse,\n",
      "W = mash *100. / Pashflue \n",
      "mvflue = Pvflue * W /100. \n",
      "mCflue = W * PCflue / 100 \n",
      "Ctflue = mCflue + mvflue * PC / 100 #total carbon in flue\n",
      "Htflue = mvflue * PH / 100 \n",
      "Otflue = mvflue * PO / 100 \n",
      "PCflue = Ctflue *100/W \n",
      "PHflue = Htflue *100/W \n",
      "POflue = Otflue *100/W \n",
      "\n",
      "print \"(b)percent Carbon in refuse = %.2f\"%PCflue,\"%\"\n",
      "print \"   percent Hydrogen in refuse = %.2f\"%PHflue,\"%\"\n",
      "print \"   percent Oxygen in refuse = %.2f\"%POflue,\"%\"\n",
      "print \"   percent Ash in refuse = %.2f\"%Pashflue,\"%\"\n",
      "\n",
      "Coalburnt = mcoal - W \n",
      "NCburnt = (mC - Ctflue)/12 \n",
      "NHburnt = (mH - Htflue)/2.016 \n",
      "NOburnt = (mO - Otflue)/32 \n",
      "PCO2 = 80.                      #Percentage of carbon burnt\n",
      "NCO2 = PCO2 * NCburnt / 100. \n",
      "NCO = ( 1 - PCO2/100. )*NCburnt \n",
      "Vair = 1000.                    #m**3\n",
      "Nair = Vair / 22.4143 \n",
      "NN2 = Nair * 79 / 100. \n",
      "NO2 = Nair * 21 / 100. \n",
      "Ocompounds = NCO2 + NCO/2 + NHburnt/2               #Oxygen present in CO2,CO and H2O\n",
      "\n",
      "#Oxygen balance gives free oxygen as,\n",
      "Ofree = NO2 + mO/32 - Otflue/32 - Ocompounds \n",
      "Ntotal = NN2 + Ofree + NCO2 + NCO                   #dry basis\n",
      "PCO21 = NCO2 *100/Ntotal \n",
      "PCO1 = NCO * 100/Ntotal \n",
      "PO21 = Ofree * 100/Ntotal \n",
      "PN21 = NN2 * 100/Ntotal \n",
      "print \"(c)percent CO2 in flue = %.2f\"%PCO21,\"%\"\n",
      "print \"   percent CO in flue = %.2f\"%PCO1,\"%\"\n",
      "print \"   percent O2 in flue = %.2f\"%PO21,\"%\"\n",
      "print \"   percent N2 in flue = %.2f\"%PN21,\"%\"\n",
      "NOrequired = mC/12 + mH/(2.016*2) - mO/32 \n",
      "Oexcess = NO2 - NOrequired \n",
      "Pexcess = Oexcess * 100 / NOrequired \n",
      "print \"(d)Percent excess air supplied = %.2f\"%Pexcess,\"%\"\n",
      "NH2Oflue = NHburnt \n",
      "mH2O = NH2Oflue * 18.016 \n",
      "m = mH2O * 100/Ntotal \n",
      "print \"(e)mass of water vapour per 100 moles of dry flue gas = %.2f\"%\\\n",
      "m,\"g water vapour / 100kmol dry flue gas\"\n",
      "\n",
      "# note: answer may vary because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)percent carbon in volatile matter = 57.14 %\n",
        "   percent hydrogen in volatile matter = 25.91 %\n",
        "   percent oxygen in volatile matter = 16.95 %\n",
        "(b)percent Carbon in refuse = 15.94 %\n",
        "   percent Hydrogen in refuse = 2.33 %\n",
        "   percent Oxygen in refuse = 1.53 %\n",
        "   percent Ash in refuse = 80.20 %\n",
        "(c)percent CO2 in flue = 9.55 %\n",
        "   percent CO in flue = 2.39 %\n",
        "   percent O2 in flue = 5.53 %\n",
        "   percent N2 in flue = 82.53 %\n",
        "(d)Percent excess air supplied = 21.26 %\n",
        "(e)mass of water vapour per 100 moles of dry flue gas = 245.62 g water vapour / 100kmol dry flue gas\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.7 pageno : 343"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "Pexcess = 20.                           #%\n",
      "PSO3 = 5.                               #% ( Percent of sulphur burnt to SO3 )\n",
      "\n",
      "#S + O2 = SO2\n",
      "N = 1.                                  #kmol sulphur\n",
      "Orequired = N                           #kmol\n",
      "\n",
      "# Calculation \n",
      "Osupplied = Orequired * ( 1 + Pexcess/100) \n",
      "Nsupplied = Osupplied * 79/21. \n",
      "NSO2 = (1-PSO3/100)*N \n",
      "NSO3 = PSO3 * N /100. \n",
      "Oconsumed = NSO2 + 3/2. * PSO3/100 \n",
      "Oremaining = Osupplied - Oconsumed \n",
      "Ntotal = NSO2 + NSO3 + Oremaining + Nsupplied \n",
      "PSO2 = NSO2 * 100 / Ntotal \n",
      "PSO3 = NSO3 * 100 / Ntotal \n",
      "PO2 = Oremaining * 100 / Ntotal \n",
      "PN2 = Nsupplied * 100 / Ntotal \n",
      "\n",
      "# Result\n",
      "print \"Percent SO2 in burner gas = %.2f\"%PSO2,\"%\"\n",
      "print \"Percent SO3 in burner gas = %.2f\"%PSO3,\"%\"\n",
      "print \"Percent O2 in burner gas = %.2f\"%PO2,\"%\"\n",
      "print \"Percent N2 in burner gas = %.2f\"%PN2,\"%\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percent SO2 in burner gas = 16.70 %\n",
        "Percent SO3 in burner gas = 0.88 %\n",
        "Percent O2 in burner gas = 3.08 %\n",
        "Percent N2 in burner gas = 79.35 %\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.8 pageno : 343"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "Nburner = 100.                      #kmol\n",
      "NSO2b = 9.5                         #kmol\n",
      "NO2b = 7.                           #kmol\n",
      "\n",
      "# Calculation \n",
      "NN2 = Nburner - NSO2b - NO2b \n",
      "NOsupplied = NN2 * 21 / 79.         #Oxygen supplied\n",
      "\n",
      "#4FeS2 + 11O2 = 2Fe2O3 + 8SO2\n",
      "#4FeS2 + 15O2 = 2Fe2O3 + 8SO3\n",
      "NOtotal = NO2b + NSO2b + NSO2b * 3 / 8. \n",
      "NOunaccounted = NOsupplied - NOtotal \n",
      "NSO31 = NOunaccounted * 8 /15 \n",
      "NStotal = NSO2b + NSO31 \n",
      "mS = NStotal * 32.064 \n",
      "Pburnt = 50.                        #% ( percentage of pyrites burnt )\n",
      "mFeS2 = mS * 100/ Pburnt \n",
      "\n",
      "# Result\n",
      "print \"(a)Total pyrites burnt = %.2f\"%mFeS2,\"kg\"\n",
      "NFeS2 = NStotal / 2 \n",
      "MFeS2 = 119.975 \n",
      "mFeS21 = MFeS2 * NFeS2 \n",
      "mgangue = mFeS2 - mFeS21 \n",
      "NFe2O3 = NFeS2 * Pburnt / 100 \n",
      "MFe2O3 = 159.694 \n",
      "mFe2O3 = MFe2O3 * NFe2O3 \n",
      "PSO3c = 2.5                         #% ( percentage sulphur as SO3 in cinder )\n",
      "mc = 100.                           #kg ( basis )\n",
      "NSO3 = PSO3c / 32.064 \n",
      "mSO3 = NSO3 * 80.064 \n",
      "mremaining = mc - mSO3              # ( Fe2O3 + gangue )\n",
      "\n",
      "#x be the weight of the cinder \n",
      "x = (mFe2O3 + mgangue)*100/mremaining  \n",
      "print \"(b)weight of cinder produced = %.f\"%x,\"kg\"\n",
      "Slost = x * NSO3 / 100 \n",
      "PSlost = Slost *100/ NStotal \n",
      "print \"(c)Percent of total S lost in the cinder = %.2f\"%PSlost,\"%\"\n",
      "mSO3c = mSO3 * x / 100 \n",
      "NSO3b = NSO31 - Slost \n",
      "P = NSO3b * 100 / NStotal \n",
      "print \"(d)Percentage of S charged that is present as SO3 in the burner gas = %.2f\"%P,\"%\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Total pyrites burnt = 682.19 kg\n",
        "(b)weight of cinder produced = 500 kg\n",
        "(c)Percent of total S lost in the cinder = 3.66 %\n",
        "(d)Percentage of S charged that is present as SO3 in the burner gas = 7.03 %\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.9 pageno : 345"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "Ncgas = 100.                #kmol ( basis - SO3 free converter gas )\n",
      "NSO2 = 4.5                  #kmol\n",
      "NO2 = 7.5                   #kmol\n",
      "NN2 = 88.0                  #kmol\n",
      "\n",
      "\n",
      "# Calculation \n",
      "NOsupplied = NN2 * 21./ 79 \n",
      "NOconverter = NO2 + NSO2 \n",
      "NOconsumed = NOsupplied - NOconverter           #(Oxygen consumed for SO3)\n",
      "NSO3c = NOconsumed / 1.5 \n",
      "NStotal = NSO3c + NSO2 \n",
      "Nbgas = 100.                                    #kmol ( basis - SO3 free burner gas )\n",
      "NSO21 = 15.                                     #%\n",
      "NO21 = 5.                                       #%\n",
      "NN21 = 80.                                      #%\n",
      "NOburner = NO21 + NSO21 \n",
      "NOsupplied1 = NN21 * 21. / 79. \n",
      "NOconsumed1 = NOsupplied1 - NOburner            #(Oxygen consumed for SO3)\n",
      "NSO3b = NOconsumed1 / 1.5 \n",
      "NStotal1 = NSO3b + NSO21 \n",
      "mS = 100.                                       #kg ( basis - sulphur charged )\n",
      "Pburned = 95.                                   #%\n",
      "mburned = mS * Pburned / 100. \n",
      "Nburned = mburned / 32.064 \n",
      "\n",
      "#let x be the SO3 free burner gas produced, then sulphur balance gives,\n",
      "x = Nburned * Nbgas / NStotal1 \n",
      "NSO2b = NSO21 * x / 100 \n",
      "NO2b = NO21 * x / 100 \n",
      "NN2b = NN21 * x / 100 \n",
      "Ntotalb = NSO2b + NO2b + NN2b \n",
      "NSO3b1 = NSO3b * x / 100 \n",
      "\n",
      "#let y be the no. of converter gas produced\n",
      "y = Nburned * Ncgas / NStotal \n",
      "NSO2c = NSO2 * y / 100 \n",
      "NO2c = NO2 * y / 100 \n",
      "NN2c = NN2 * y / 100 \n",
      "Ntotalc = NSO2c + NO2c + NN2c \n",
      "NSO3c1 = NSO3c * y / 100 \n",
      "Nairsec = (NN2c - NN2b ) * 100 / 79. \n",
      "P = 100.                                        #kPa\n",
      "T = 300.                                        #K\n",
      "V = Nairsec * 22.414 * 101.3 * T / (P * 273.15) \n",
      "\n",
      "# Result\n",
      "print \"(a)The volume of secondary air at 100kPa and 300K = %.1f\"%V,\"m**3/h\"\n",
      "NSabsorbed = 95.                                #%\n",
      "mSO3abs = NSabsorbed * NSO3c1 * 80.064 / 100 \n",
      "\n",
      "#let z be the amount of 98% H2SO4, therefore , 100% H2SO4 produced = z + mSO3abs\n",
      "# taking SO3 balance\n",
      "z = (mSO3abs - mSO3abs * 80.064 / 98.08) / ( 80.064 / 98.08 - 0.98 * 80.064/98.08) \n",
      "print \"(b)98%% H2SO4 required per hour = %.1f\"%z,\"kg\"\n",
      "w = z + mSO3abs \n",
      "print \"(c)100%% H2SO4 produced per hour = %.1f\"%w,\"kg\"\n",
      "\n",
      "# note: answer may vary because of rounding error\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The volume of secondary air at 100kPa and 300K = 208.2 m**3/h\n",
        "(b)98% H2SO4 required per hour = 1592.1 kg\n",
        "(c)100% H2SO4 produced per hour = 1733.6 kg\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.10 pageno : 349"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "mlime = 5.                          #kg\n",
      "mcoke = 1.                          #kg\n",
      "PCaCO3l = 84.5                      #%\n",
      "PMgCO3l = 11.5                      #%\n",
      "\n",
      "# Calculation \n",
      "NCaCO3l = PCaCO3l * mlime / (100.09*100) \n",
      "NMgCO3l = PMgCO3l * mlime / (84.312*100) \n",
      "mInertsl = mlime * ( 100 - PCaCO3l - PMgCO3l ) / 100 \n",
      "PCc = 76.                           #%\n",
      "Pashc = 21.                         #%\n",
      "Pwaterc = 3.                        #%\n",
      "NCc = mcoke *  PCc /(100*12) \n",
      "Nwaterc = mcoke * Pwaterc / ( 100 * 18.016 ) \n",
      "mash = Pashc * mcoke / 100 \n",
      "\n",
      "#CaCO3 + C + O2 = CaO + 2CO2\n",
      "#MgCO3 + C + O2 = MgO + 2CO2\n",
      "PCaCO3conv = 95.                    #(Percent calcination of CaCO3)\n",
      "PMgCO3conv = 90.                    #(Percent calcination of MgCO3)\n",
      "NCaO = PCaCO3conv * NCaCO3l / 100. \n",
      "mCaO = NCaO * 56.08 \n",
      "NMgO = PMgCO3conv * NMgCO3l / 100. \n",
      "mMgO = NMgO * 40.312 \n",
      "mCaCO3 = (NCaCO3l * (1-PCaCO3conv/100)*100.09) \n",
      "mMgCO3 = (NMgCO3l * (1-PMgCO3conv/100)*84.312) \n",
      "mtotal = mCaO + mMgO + mCaCO3 + mMgCO3 + mInertsl + mash \n",
      "PCaO = mCaO * 100 / mtotal \n",
      "\n",
      "# Result\n",
      "print \"The weight percent of CaO in the product leaving the kiln = %.2f\"%PCaO,\"%\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The weight percent of CaO in the product leaving the kiln = 70.83 %\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.11 pageno : 350"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "R = 100.                        #kg ( basis - residue )\n",
      "MCaSO4 = 136.144 \n",
      "MMgSO4 = 120.376 \n",
      "mCaSO4r = 9.                    #kg\n",
      "mMgSO4r = 5.                    #kg\n",
      "mH2SO4r = 1.2                   #kg\n",
      "minertr = 0.5                   #kg\n",
      "mCO2r = 0.2                     #kg\n",
      "mH2O = 84.10                    #kg\n",
      "\n",
      "\n",
      "# Calculation \n",
      "NCaSO4 = mCaSO4r / MCaSO4 \n",
      "NMgSO4 = mMgSO4r / MMgSO4 \n",
      "\n",
      "#CaCO3 + H2SO4 = CaSO4 + H2O + CO2\n",
      "#MgSO4 + H2SO4 = MgSO4 + H2O + CO2\n",
      "\n",
      "mCaCO3 = NCaSO4 * 100.08 \n",
      "mMgCO3 = NMgSO4 * 84.312 \n",
      "mtotallime = minertr + mCaCO3 + mMgCO3 \n",
      "PCaCO3 = mCaCO3 * 100/ mtotallime \n",
      "PMgCO3 = mMgCO3 *100/ mtotallime \n",
      "Pinerts = minertr *100/ mtotallime \n",
      "\n",
      "# Result\n",
      "print \"(a)Percentage of CaCO3 in limestone = %.2f\"%PCaCO3,\"%\"\n",
      "print \"   Percentage of MgCO3 in limestone = %.2f\"%PMgCO3,\"%\"\n",
      "print \"   Percentage of inerts in limestone = %.2f\"%Pinerts,\"%\"\n",
      "\n",
      "NH2SO4 = NCaSO4 + NMgSO4 \n",
      "mH2SO4 = NH2SO4 * 98.08 \n",
      "Pexcess = mH2SO4r * 100 / ( mH2SO4) \n",
      "print \"(b)The percentage excess of acid used = %.2f\"%Pexcess,\"%\"\n",
      "\n",
      "macidt = mH2SO4 + mH2SO4r \n",
      "Pacidic = 12.                   #%\n",
      "mwaterin = macidt * (100 - Pacidic)/ Pacidic \n",
      "mwaterr = (NCaSO4 + NMgSO4)*18.016 \n",
      "mwatert = mwaterin + mwaterr \n",
      "mvaporized = mwatert - mH2O \n",
      "m = mvaporized * 100/mtotallime             #water vaporized per 100kg of limestone\n",
      "print \"(c)the mass of water vaporized per 100kg of limestone = %.2f\"%m,\"kg\"\n",
      "mCO2pr = (NCaSO4 + NMgSO4)*44 \n",
      "mCO2rel = mCO2pr - mCO2r \n",
      "m1 = mCO2rel * 100 / mtotallime             #CO2 per 100kg of limestone\n",
      "print \"(d)the mass of CO2 per 100kg of limestone = %.2f\"%m1,\"kg\"\n",
      "\n",
      "# note : answer may vary because of rounding error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Percentage of CaCO3 in limestone = 62.31 %\n",
        "   Percentage of MgCO3 in limestone = 32.98 %\n",
        "   Percentage of inerts in limestone = 4.71 %\n",
        "(b)The percentage excess of acid used = 11.37 %\n",
        "(c)the mass of water vaporized per 100kg of limestone = 38.25 kg\n",
        "(d)the mass of CO2 per 100kg of limestone = 42.72 kg\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.12 pageno : 353"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "macid = 1000.                   #kg ( basis - dilute phosphoric acid )\n",
      "Mphacid = 97.998 \n",
      "P = 1.25                        #% ( dilute % )\n",
      "\n",
      "# Calculation \n",
      "mphacid = macid * P /100 \n",
      "Nphacid = mphacid / Mphacid \n",
      "\n",
      "#1mole of phosphoric acid - 1mole of trisodium phosphate\n",
      "NTSP = Nphacid \n",
      "MTSP = 380.166 \n",
      "mTSP = NTSP * MTSP \n",
      "\n",
      "# Result\n",
      "print \"(a)Maximum weight of TSP obtained = %.2f\"%mTSP,\"kg\"\n",
      "NCO2 = NTSP \n",
      "Pwater = 6.27                   #kPa\n",
      "\n",
      "#since gas is saturated with water vapour, vapour pressure = partial pressure\n",
      "Nwater = NCO2 * Pwater / ( 100 - Pwater ) \n",
      "Ntotal = Nwater + NCO2 \n",
      "P = 100.                        #kPa\n",
      "T = 310.                        #K\n",
      "V = Ntotal * 101.3 * T *22.4143 / ( P * 273.15 ) \n",
      "print \"(b)Volume of CO2 = %.2f\"%V,\"m**3\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Maximum weight of TSP obtained = 48.49 kg\n",
        "(b)Volume of CO2 = 3.51 m**3\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.13 pageno : 353"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "mTSPd = 1000.                       #kg ( basis - 20% dilute TSP )\n",
      "P = 20.                             #%\n",
      "\n",
      "# Calculation \n",
      "mTSP = mTSPd * P / 100 \n",
      "NTSP = mTSP / 163.974 \n",
      "msodaashd = NTSP * 106 \n",
      "mphacidd = NTSP * 97.998 \n",
      "mNaOHd = NTSP * 40.008 \n",
      "Pphacid = 85.                       #% (85% solution phosphoric acid)\n",
      "PNaOH = 50.                         #% (50% solution NaOH)\n",
      "\n",
      "#let x be the water in soda ash,\n",
      "#taking water balance,\n",
      "x = (mTSPd - mTSP) - mNaOHd * PNaOH /(100 - PNaOH) - mphacidd * (100 - Pphacid) / Pphacid \n",
      "msodaash = msodaashd + x \n",
      "C = msodaashd *100 / msodaash \n",
      "\n",
      "# Result\n",
      "print \"(a)Concentration of soda ash solution = %.2f\"%C,\"%\"\n",
      "mphacid = mphacidd * 100 / Pphacid \n",
      "R = msodaash / mphacid \n",
      "print \"(b)Weight ratio in which soda ash and commercial phosphoric acid are mixed = %.2f\"%R\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Concentration of soda ash solution = 15.04 %\n",
        "(b)Weight ratio in which soda ash and commercial phosphoric acid are mixed = 6.11\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.14 pageno : 355"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "m = 1000.                       #kg ( basis - pig iron produced )\n",
      "\n",
      "#let x be the iron ore charged and y be the amount of flux added and z be the weight of slag produced\n",
      "PFepg = 95.                     #% ( Fe% in product )\n",
      "PCpg = 4.                       #%\n",
      "PSipg = 1.                      #%\n",
      "PFech = 85.                     #% (Fe% in feed )\n",
      "mcoke = 1000.                   #kg\n",
      "PCcoke = 90.                    #%\n",
      "PSicoke = 10.                   #%\n",
      "PSislag = 60.                   #%\n",
      "PSiflux = 5.                    #%\n",
      "PCaCO3fx = 90.                  #%\n",
      "PMgCO3fx = 5.                   #%\n",
      "PCMslag = 40.                   #% \n",
      "\n",
      "# Calculation \n",
      "#iron balance gives,\n",
      "x = PFepg * m *159.694 / ( PFech * 111.694) \n",
      "#silicon balance gives,\n",
      "#x*(100 - PFech)*28.086/(100*60.086)+mcoke*Psicoke*28.086/(100*60.086)+y*PSiflux*28.086/(100*60.086) = 10 + z*Psislag*28.086 / ( 100*60.086 )\n",
      "#taking (CaO + MgO) balance\n",
      "#y * ((PCaCO3fx)*56.88/(100*100.88)+(PMgCO3fx*40.312/(100*84.312))=z*PCMslag/100\n",
      "#solving above 2 equations , we get\n",
      "y = 403.31 \n",
      "\n",
      "# Result\n",
      "print \"the amount of flux required to produce 1000kg of pig iron = \",y,\"kg\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the amount of flux required to produce 1000kg of pig iron =  403.31 kg\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.15 pageno : 357"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "N = 100.                    #mol(basis - scrubber)\n",
      "NNOs = 2.4                  #mol\n",
      "NN2s = 92.                  #mol\n",
      "NO2s = 5.6                  #mol\n",
      "PNOs = 20.                  #% ( Percentage NO leaving scrubber)\n",
      "\n",
      "# Calculation \n",
      "NNOreac = NNOs * 100 / PNOs \n",
      "#let x mol of nitroge be produced in the reaction, then the amount of N2 present in the air = NN2s - x mol - (1)\n",
      "#4NH3 + 5O2 = 4NO + 6H2O\n",
      "#4NH3 + 3O2 = 2N2 + 6H2O\n",
      "#4moles of NO - 5 moles of O2, 2moles of N2 - 3 moles of O2\n",
      "#Total oxygen used up, O  =  NNOreac * 5/4 + x*3/2\n",
      "#total oxygen supplied, NOtotal= (O) + NO2s\n",
      "#Nitrogen associated with O2 supplied NN2 = NOtotal*79/21 - (2)\n",
      "#comparing 1 and 2,\n",
      "x = 2.1835 \n",
      "#12moles NO requires 12moles ammonia, 1 mole N2 requires 2 mole ammonia\n",
      "Nammonia = x*2 + NNOreac \n",
      "Oreq = Nammonia * 5 / 4 \n",
      "Osupp = NNOreac * 5/4 + x*3/2 + NO2s \n",
      "Pexcess = (Osupp - Oreq)*100/Oreq  \n",
      "\n",
      "# Result\n",
      "print \"(a)Percentage excess oxygen = %.1f\"%Pexcess,\"%\"\n",
      "fr = x * 2 / Nammonia \n",
      "print \"Fraction of ammonia taking part in side reaction = %.3f\"%fr\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Percentage excess oxygen = 16.7 %\n",
        "Fraction of ammonia taking part in side reaction = 0.267\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.16 pageno : 359"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "m = 100.                        #kg (basis sodium nitrate reacted)\n",
      "NNaNO3 = m/85\n",
      " \n",
      "# Calculation \n",
      "#2NaNO3 + H2SO4 = 2HNO3 + Na2SO4\n",
      "mh2so4 = NNaNO3 * 98.08/2 \n",
      "mhno3 = NNaNO3*63.008 \n",
      "mna2so4 = NNaNO3 * 142.064 /2 \n",
      "Phno3 = 2.                      #%(percent nitric acid remaining in the cake)\n",
      "mhno3cake = mhno3 * Phno3 / 100 \n",
      "Ph2so4 = 35.                    #%\n",
      "Pwater = 1.5                    #%\n",
      "mtotal = (mna2so4 + mhno3cake)*100/(100 - Ph2so4 - Pwater) \n",
      "mwater = Pwater * mtotal / 100 \n",
      "mh2so4c = Ph2so4 * mtotal / 100 \n",
      "Pna2so4 = mna2so4 *100/mtotal \n",
      "Phno3c = mhno3cake * 100 / mtotal \n",
      "\n",
      "# Result\n",
      "print \"(a)Mass of Na2SO4 in the cake = %.3f\"%mna2so4,\"kg\"\n",
      "print \"Mass of H2SO4 in the cake = %.3f\"%mh2so4c,\"kg\"\n",
      "print \"Mass of HNO3 in the cake = %.4f\"%mhno3,\"kg\"\n",
      "print \"Mass of water in the cake = %.3f\"%mwater,\"kg\"\n",
      "print \"Percentage of Na2SO4 in the cake = %.3f\"%Pna2so4,\"%\"\n",
      "print \"Percentage of H2SO4 in the cake = %.2f\"%Ph2so4,\"%\"\n",
      "print \"Percentage of HNO3 in the cake = %.2f\"%Phno3c,\"%\"\n",
      "print \"Percentage of water in the cake = %.2f\"%Pwater,\"%\"\n",
      "\n",
      "mh2so4req = mh2so4 + mh2so4c \n",
      "P = 95.                         #% (95% dilute sulphuric acid)\n",
      "w = mh2so4req * 100 / P \n",
      "print \"(b)Weight of 95%% sulphuric acid required = %.2f\"%w,\"kg\"\n",
      "mnitric = mhno3 - mhno3cake \n",
      "print \"(c)weight of nitric acid product obtained = %.2f\"%mnitric,\"kg\"\n",
      "mwaterd = w*(1-P/100)-mwater \n",
      "print \"(d)the water vapour tha tis distilled from the nitre cake = %.3f\"%mwaterd,\"kg\"\n",
      "\n",
      "\n",
      "# Note : The value of HNO3 is taken wrongly in the textbook while calculating mass of HNO3"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Mass of Na2SO4 in the cake = 83.567 kg\n",
        "Mass of H2SO4 in the cake = 46.878 kg\n",
        "Mass of HNO3 in the cake = 74.1271 kg\n",
        "Mass of water in the cake = 2.009 kg\n",
        "Percentage of Na2SO4 in the cake = 62.393 %\n",
        "Percentage of H2SO4 in the cake = 35.00 %\n",
        "Percentage of HNO3 in the cake = 1.11 %\n",
        "Percentage of water in the cake = 1.50 %\n",
        "(b)Weight of 95% sulphuric acid required = 110.08 kg\n",
        "(c)weight of nitric acid product obtained = 72.64 kg\n",
        "(d)the water vapour tha tis distilled from the nitre cake = 3.495 kg\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.17 pageno : 361"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "m = 50.                         #kg ( basis - mass of brine charged )\n",
      "#let x be the amount of NaCl in the brine\n",
      "Pelect = 50.                    #% ( electrolyzed )\n",
      "\n",
      "#2NaCl + 2H2O = 2NaOH + Cl2 + H2\n",
      "#amount of NaCl reacted =x*Pelect/(100*58.45)kmol=x*Pelect/100kg   ( 1 )\n",
      "#amount of water reacted = x * Pelect * 18.016 / ( 100 * 58.45 )kg ( 2 )\n",
      "#Gases produced, Cl2 = x * Pelect / (100 * 58.45 * 2 )kmol = x * Pelect *71/ (100 * 58.45 * 2 )kg                                           ( 3 )\n",
      "#H2 = x * Pelect / (100 * 58.45 * 2 )kmol = x * Pelect *2.016/ (100 * 58.45 * 2 )kg                                                         ( 4 )\n",
      "Nwater = 0.03                   #mol water vapour/mol of gas\n",
      "\n",
      "# Calculation \n",
      "#water vapour present = Nwater * 2*(Cl2 + H2)kmol = Nwater * 2*(Cl2 + H2)*18.016 kg                                                         ( 5 )\n",
      "#NaoH = x * Pelect * 40.008/ (100 * 58.45 )kg                      ( 6 )\n",
      "#water = water in brine - water reacted - water present in gas     ( 7 )\n",
      "#= (m - Pelect/100) - water reacted ( 2 ) - water present in the gas( 5 )\n",
      "#Total weight of solution = NaCl ( 1 ) + NaOH ( 6 ) + Water ( 7 )\n",
      "#since NaOH is 10 percent of the total weight, we have NaOH = 0.1 * total weight, from these we get, \n",
      "x = 0.1 * 50 / (0.1* 0.3165 + 0.3422 ) \n",
      "NaOH = x * Pelect * 40.008/ (100 * 58.45 ) \n",
      "NaCl = x * Pelect / 100 \n",
      "water = 34.5032                 #kg\n",
      "Pevap = 50.                     #NaOh percentage in solution leaving evaporator\n",
      "\n",
      "#taking NaOH balance\n",
      "mevap = NaOH * 100 / Pevap \n",
      "\n",
      "# Result\n",
      "print \"(a)amount of 50%% NaOH solution produced = %.4f\"%mevap,\"kg\"\n",
      "Cl2 = x * Pelect *71/ (100 * 58.45 * 2 )                #kg\n",
      "H2 = x * Pelect *2.016/ (100 * 58.45 * 2 )              #kg\n",
      "print \"(b)Chlorine produced = %.4f\"%Cl2,\"kg\"\n",
      "print \"   Hydrogen produced = %.4f\"%H2,\"kg\"\n",
      "Pleav = 1.5                                             #% NaCl leaving the evaporator\n",
      "NaClleav = mevap * Pleav / 100 \n",
      "mcrystal = NaCl - NaClleav \n",
      "print \"(c)Amount of NaCl crystallized = %.4f\"%mcrystal,\"kg/h\"\n",
      "mwaterleav = mevap - NaOH - NaClleav \n",
      "Mwaterevap = water - mwaterleav \n",
      "print \"(d)Weight of water evaporated = %.4f\"%Mwaterevap,\"kg\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)amount of 50% NaOH solution produced = 9.1545 kg\n",
        "(b)Chlorine produced = 4.0615 kg\n",
        "   Hydrogen produced = 0.1153 kg\n",
        "(c)Amount of NaCl crystallized = 6.5499 kg/h\n",
        "(d)Weight of water evaporated = 30.0633 kg\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.18 pageno : 364"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "m = 100.                        #mol ( basis reactore exit gas )\n",
      "#CH3OH + O2 = HCOOH + H2O\n",
      "#CH3OH + O2 / 2 = HCHO + H2O\n",
      "Nn2 = 64.49                     #mol\n",
      "No2 = 13.88                     #mol\n",
      "Nh2o = 5.31                     #mol\n",
      "Nch3oh = 11.02                  #mol\n",
      "Nhcho = 4.08                    #mol\n",
      "Nhcooh = 1.22                   #mol\n",
      "\n",
      "# Calculation \n",
      "#x be the moles of methanol reacted, taking C balance, we get,\n",
      "x = Nch3oh + Nhcho + Nhcooh \n",
      "Pconv = Nhcho * 100 / x  \n",
      "\n",
      "# Result\n",
      "print \"(a)Percent conversion of formaldehyde = \",Pconv,\"%\"\n",
      "Nair = Nn2 * 100 / 79. \n",
      "R = Nair / x \n",
      "print \"(b)Ratio of air to methanol in the feed = %d\"%R\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Percent conversion of formaldehyde =  25.0 %\n",
        "(b)Ratio of air to methanol in the feed = 5\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.19 pageno : 367"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "NA = 100.                       #mol ( basi - 100 mol A in the fresh feed )\n",
      "Pconv = 95.                     #%\n",
      "\n",
      "# Calculation \n",
      "NApro = NA * (100 - Pconv)/100 \n",
      "\n",
      "#A = 2B + C \n",
      "NB = NA * Pconv * 2 / 100 \n",
      "NC = NA * Pconv/100 \n",
      "PAent = 0.5                     #%\n",
      "NAent = NApro * 100 / PAent \n",
      "PBrec = 1.                      #%\n",
      "NBent = NB * 100 / (100 - PBrec) \n",
      "m = (NAent - NApro + NA) \n",
      "conv = ((NAent - NApro + NA) - NAent)*100/(NAent - NApro + NA) \n",
      "\n",
      "# Result\n",
      "print \"(a)single pass converion = %.2f\"%conv,\"%\"\n",
      "Nrecycled = (NAent - NApro) + (NBent - NB) \n",
      "R = Nrecycled/NA \n",
      "print \"(b)recycle ratio = %.2f\"%R\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)single pass converion = 8.68 %\n",
        "(b)recycle ratio = 9.97\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.20 pageno : 368"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "m = 100.                #kg ( basis - sucrose solution as fresh feed )\n",
      "\n",
      "#R - recycle reactor exit, \n",
      "#let x be the weight fraction of sucrose and y be the weight fracton of inversion sugar in the recycle stream, \n",
      "#for combined stream  fraction of Glucose + fructose = 0.04\n",
      "#z be the weight fraction of sucrose in the combined stream entering the reactor\n",
      "Psfeed = 25.            #% percent sucrose in fresh feed\n",
      "\n",
      "#sucrose balance gives, 25 + R*x = (100+R)* z                        (A)\n",
      "#Glucose + fructose balance, R * y = (100 + R )*0.04                 (B)\n",
      "Sucrosecon = 71.7       #% sucrose consumed\n",
      "\n",
      "\n",
      "# Calculation \n",
      "#sucrose balance around the reactor,(100+R)z=0.717*(100+R)z+(100+R)x (C)\n",
      "#From (C) , x = 0.283*z                                              (D)\n",
      "#Amount converted to Glucose + fructose = 0.717 ( 100 + R )* z \n",
      "# = 0.717 ( 100 + R )* z * 360.192 / 342.176 kg\n",
      "#Glucose and fructose balance around the reactor,\n",
      "#(100+R)*0.04 + 0.717(100+R)*z*360.192/342.176 = (100+R)*y           (E)\n",
      "#Solving (E), y = 0.04 + 0.7548*z                                    (F)\n",
      "#Solving, (A), (B), (C) and (F)\n",
      "x = 0.06 \n",
      "y = 0.2 \n",
      "z = 0.212 \n",
      "R = 25 \n",
      "\n",
      "# Result\n",
      "print \"(a)Recycle flow = \",R,\"kg\"\n",
      "print \"(b)Combined concentration of Glucose and Fructose in the recycle stream = \",y*100,\"%\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Recycle flow =  25 kg\n",
        "(b)Combined concentration of Glucose and Fructose in the recycle stream =  20.0 %\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.21 pageno : 370"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "N = 1.                      #mol ( basis - combined feed )\n",
      "\n",
      "#F - moles of fresh feed\n",
      "Pinert = 0.5                #%\n",
      "Pconv = 60.                  #%\n",
      "P1inert = 2.                #%\n",
      "\n",
      "# Calculation \n",
      "NA1 = N * ( 1- P1inert/100. ) \n",
      "NA2 = NA1 * ( 1 - Pconv / 100. ) \n",
      "NB2 = NA1 - NA2 \n",
      "N1inert = N * P1inert / 100. \n",
      "N2inert = N1inert \n",
      "\n",
      "#Let R be the moles recycled and P be the moles purged\n",
      "#W = R + P\n",
      "W = NA2 + N2inert           #              (A)\n",
      "PWinert = N2inert * 100/ ( NA2 + N2inert) \n",
      "\n",
      "#component A balance, A fresh feed = A purge stream + A recycle stream\n",
      "#F * 0.9 = P * 0.9515 + 0.588                      (B)\n",
      "#inert balance at the point where fresh feed is mixed with the recycle,\n",
      "#F*0.005 + R*0.0485 = 1* 0.02                      (C)\n",
      "#Solving (A),(B) and (C)\n",
      "F = 0.6552                  #mol\n",
      "P = 0.0671                  #mol\n",
      "R = 0.3448                  #mol\n",
      "\n",
      "# Result\n",
      "print \"(a)moles of recycle stream = \",R,\"mol\"\n",
      "print \"(b)moles of purge stream = \",P,\"mol\"\n",
      "NAconv = NA1 - NA2 \n",
      "NAf = F * (1 - Pinert / 100.) \n",
      "Conv = NAconv *100./ NAf \n",
      "print \"(c)Overall conversion = %.1f\"%Conv,\"%\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)moles of recycle stream =  0.3448 mol\n",
        "(b)moles of purge stream =  0.0671 mol\n",
        "(c)Overall conversion = 90.2 %\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.22 pageno : 371"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables \n",
      "N = 100.                            #moles ( Basis - Fresh feed )\n",
      "Pconv = 20.                         #%\n",
      "xco = 0.33 \n",
      "xh2 = 0.665 \n",
      "xch4 = 0.005 \n",
      "\n",
      "#R - recycle stream, P - purge stream\n",
      "#x - mole fraction of CO in recycle stream , \n",
      "xch4r = 0.03\n",
      "\n",
      "# Calculation \n",
      "#CO = x, H2 = 1 - xch4r - CO = 0.97- x \n",
      "#methane balance over the entire system, \n",
      "P = xch4 * N / xch4r \n",
      "#taking caron balance, 33.5 = M + P ( 0.03 + x )\n",
      "#Hydrogen balance, 66.5 + 2*0.5 = 2M + P(2*0.03 + 0.97 - x) \n",
      "#substituting P, M + 16.67x = 33.0 and 2M - 16.67x = 50.33\n",
      "M = (33.0 + 50.33)/3 \n",
      "x = ((xco + xch4)*N - M ) / P - xch4r \n",
      "\n",
      "#methanol balance,(xco*N+Rx) * Poncv/100 = M\n",
      "R = (M*100 / Pconv - (xco*N))/x \n",
      "\n",
      "# Result \n",
      "print \"(a)moles of recycle stream = %.1f\"%R,\"mol\"\n",
      "print \"(b)moles of purge stream = %.2f\"%P,\"mol\"\n",
      "H2 = 1 - xch4r - x \n",
      "print \"(c)CH4 in purge stream = \",xch4r*100,\"%\"\n",
      "print \"CO in purge stream = \",x*100,\"%\"\n",
      "print \"hydrogen in purge stream = \",H2*100,\"%\"\n",
      "print \"(d)Methanol produced = %.2f\"%M,\"mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)moles of recycle stream = 337.9 mol\n",
        "(b)moles of purge stream = 16.67 mol\n",
        "(c)CH4 in purge stream =  3.0 %\n",
        "CO in purge stream =  31.34 %\n",
        "hydrogen in purge stream =  65.66 %\n",
        "(d)Methanol produced = 27.78 mol\n"
       ]
      }
     ],
     "prompt_number": 26
    }
   ],
   "metadata": {}
  }
 ]
}