{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 11 : Chemical Thermodynamics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.1 Page no : 503"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "C = 0.88; \t\t\t#Fraction of carbon in coal\n",
      "H = 0.042; \t\t\t#Fraction of Hydrogen in coal\n",
      "w_f = 0.848; \t\t\t#gm\n",
      "w_fw = 0.027; \t\t\t#gm\n",
      "w = 1950.; \t\t\t#gm\n",
      "w_e = 380.; \t\t\t#gm\n",
      "dt = 3.06; \t\t\t#0C; Observed temperature rise\n",
      "tc = 0.017; \t\t\t#0C\n",
      "dt1 = dt+tc; \t\t\t#Corrected temperature rise\n",
      "Cal = 6700.; \t\t\t#J/gm; Calorific value of fuse wire\n",
      " \n",
      "# Calculations\n",
      "Q_received = (w+w_e)*4.18*dt1; \t\t\t#Heat received by water\n",
      "Q_rejected = w_fw*Cal; \t\t\t#Heat given out by fuse wire\n",
      "Q_produced = Q_received - Q_rejected;\n",
      "HCV = Q_produced/w_f;\n",
      "\n",
      "# Results\n",
      "print (\"Higher calorific value = %.3f\")% (HCV), (\"kJ/kg\")\n",
      "\n",
      "LCV = HCV - 2465*9*H;\n",
      "print (\"Lower Calorific value = %.3f\")% (LCV), (\"kJ/kg\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Higher calorific value = 35126.455 kJ/kg\n",
        "Lower Calorific value = 34194.685 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.2 Page no : 505"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "p1 = 75.882; \t\t\t#cm of Hg\n",
      "T1 = 286.; \t\t\t#K\n",
      "V1 = 0.08; \t\t\t#m**3\n",
      "p2 = 76.; \t\t\t#cm of Hg\n",
      "T2 = 288.; \t\t\t#K\n",
      "\n",
      "# Calculations\n",
      "V2 = p1*V1*T2/p2/T1;\n",
      "m = 28.; \t\t\t#kg\n",
      "c = 4.18;\n",
      "t2 = 23.5; \t\t\t#0C\n",
      "t1 = 10.; \t\t\t#0C\n",
      "Q_received = m*c*(t2-t1);\n",
      "HCV = Q_received/V2;\n",
      "\n",
      "# Results\n",
      "print (\"Higher calorific value  = %.3f\")% (HCV), (\"kJ/m**3\")\n",
      "\n",
      "amt = 0.06/0.08; \t\t\t#Amount of vapour formed per m**3 of gas burnt\n",
      "LCV = HCV-2465*amt;\n",
      "print (\"Lower calorific value  = %.3f\")% (LCV), (\"kJ/kg\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Higher calorific value  = 19643.843 kJ/m**3\n",
        "Lower calorific value  = 17795.093 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.3 Page no : 508"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "C = 0.85; \t\t\t#Weight of Carbon present\n",
      "H2 = 0.06; \t\t\t#Weight of Hydrogen present\n",
      "O2 = 0.06; \t\t\t#Weight of Oxygen present\n",
      "\n",
      "# Calculations\n",
      "w_required = C*8./3 + H2*8; \t\t\t#Weight of O2 required \n",
      "w_needed = w_required-O2; \t\t\t#Weight of O2 to be supplied\n",
      "w_air = w_needed*100./23;\n",
      "\n",
      "# Results\n",
      "print (\"Weight of air needed = %.3f\")% (w_air), (\"kg\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Weight of air needed = 11.681 kg\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.4 Page no : 508"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "C = 0.848; \t\t\t#kg\n",
      "H2 = 0.152; \t\t\t#kg\n",
      "O2_used = C*8./3 + H2*8;\n",
      "\n",
      "# Calculations and Results\n",
      "print (\"(i) Minimum weight of air needed for combustion\")\n",
      "w_min = O2_used*100/23.;\n",
      "print (\"Minimum weight of air needed for combustion = %.3f\")%(w_min), (\"kg\")\n",
      "\n",
      "w_excess = w_min*0.15; \t\t\t#Excess air supplied\n",
      "w_O2 = w_excess*23/100; \t\t\t#Weight of O2 in excess air\n",
      "w_total = w_min + w_excess; \t\t\t#Total air supplied for combustion\n",
      "w_N2 = w_total*77/100; \t\t\t#Weight of N2 in flue gases\n",
      "\n",
      "print (\"(ii) the volumetric composition of the products of combustion\")\n",
      "\n",
      "#For CO2\n",
      "x1 = 3.109;\n",
      "y1 = 44.;\n",
      "z1 = x1/y1;\n",
      "\n",
      "#For O2\n",
      "x2 = w_O2;\n",
      "y2 = 32.;\n",
      "z2 = x2/y2;\n",
      "\n",
      "#For N2\n",
      "x3 = w_N2;\n",
      "y3 = 28.;\n",
      "z3 = x3/y3;\n",
      "z = z1+z2+z3;\n",
      "\n",
      "#For CO2\n",
      "V1 = z1/z*100;\n",
      "print (\"volume of CO2  = %.3f\")% (V1), (\"%\")\n",
      "\n",
      "#For O2\n",
      "V2 = z2/z*100;\n",
      "print (\"volume of O2  = %.3f\")% (V2), (\"%\")\n",
      "\n",
      "#For CO2\n",
      "V3 = z3/z*100;\n",
      "print (\"volume of N2  = %.3f\")% (V3), (\"%\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Minimum weight of air needed for combustion\n",
        "Minimum weight of air needed for combustion = 15.119 kg\n",
        "(ii) the volumetric composition of the products of combustion\n",
        "volume of CO2  = 12.504 %\n",
        "volume of O2  = 2.884 %\n",
        "volume of N2  = 84.612 %\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.5 Page no : 509"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "C=0.78;\n",
      "H2=0.06;\n",
      "O2=0.03;\n",
      "\n",
      "w_O2=C*8./3 + H2*8;\n",
      "w_min=(w_O2-O2)*100./23; \t\t\t#Minimum wt. of air needed for combustion\n",
      "\n",
      "\n",
      "#For CO2\n",
      "x1=0.104;\n",
      "y1=44.;\n",
      "z1=x1*y1;\n",
      "\n",
      "#For CO\n",
      "x2=0.002;\n",
      "y2=28.;\n",
      "z2=x2*y2;\n",
      "\n",
      "#For N2\n",
      "x3=0.816;\n",
      "y3=28.;\n",
      "z3=x3*y3;\n",
      "\n",
      "#For O2\n",
      "x4=0.078;\n",
      "y4=32.;\n",
      "z4=x4*y4;\n",
      "\n",
      "z=z1+z2+z3+z4;\n",
      "\n",
      "# Calculations\n",
      "W_CO2=z1/z; \t\t\t#Weight per kg of flue gas\n",
      "W_CO=z2/z; \t\t\t#Weight per kg of flue gas\n",
      "W_N2=z3/z; \t\t\t#Weight per kg of flue gas\n",
      "W_O2=z4/z; \t\t\t#Weight per kg of flue gas\n",
      "\n",
      "amt=3./11*W_CO2 + 3./7*W_CO;\n",
      "\n",
      "W=C/amt; \t\t\t#Weight of dry flue gas per kg of fuel\n",
      "\n",
      "# Results\n",
      "print (\"(i)Weight of dry flue gas per kg of fuel = %.3f\")% (W), (\"kg\")\n",
      "\n",
      "m_O2=W_O2-4/7*W_CO; \t\t\t#Weight of excess oxygen per kg of flue gas\n",
      "m_excess=W*m_O2; \t\t\t#Weight of excess O2 per kg of fuel\n",
      "\n",
      "w_excess=m_excess*100/23; \t\t\t#Weight of excess air per kg of fuel\n",
      "print (\"(ii)Weight of excess air per kg of fuel= %.3f\")% (w_excess), (\"kg\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)Weight of dry flue gas per kg of fuel = 18.382 kg\n",
        "(ii)Weight of excess air per kg of fuel= 6.655 kg\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.6 Page no : 510"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "v_CO = 0.05;\n",
      "v_CO2 = 0.10;\n",
      "v_H2 = 0.50;\n",
      "v_CH4 = 0.25;\n",
      "v_N2 = 0.10;\n",
      "V_fuel = 1.;\n",
      "\n",
      "# Calculations\n",
      "V_O2 = v_CO/2+v_H2/2+2*v_CH4; \t\t\t#Volume of O2 needed\n",
      "V_air = V_O2*100./21; \t\t\t#Volume of air required\n",
      "V_N2 = V_air*79./100; \t\t\t#Volume of nitrogen in the air\n",
      "V = v_CO + v_CO2 + v_CH4 + v_N2 + V_N2; \t\t\t#Dry combustion products\n",
      "O2 = 6.;\n",
      "V_excess = O2*V/(21-O2);\n",
      "V_total = V_air+V_excess;\n",
      "\n",
      "ratio = V_total/V_fuel;\n",
      "\n",
      "# Results\n",
      "print (\"Air fuel ratio = %.f\")%(ratio)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Air fuel ratio = 5\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.7 Page no : 511"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "C = 0.85;\n",
      "H2 = 0.15;\n",
      "\n",
      "#For CO2\n",
      "x1 = 0.115;\n",
      "y1 = 44;\n",
      "z1 = x1*y1;\n",
      "\n",
      "#For CO\n",
      "x2 = 0.012;\n",
      "y2 = 28;\n",
      "z2 = x2*y2;\n",
      "\n",
      "#For O2\n",
      "x3 = 0.009;\n",
      "y3 = 32;\n",
      "z3 = x3*y3;\n",
      "\n",
      "#For N2\n",
      "x4 = 0.86;\n",
      "y4 = 28;\n",
      "z4 = x4*y4;\n",
      "\n",
      "# Calculations\n",
      "z = z1+z2+z3+z4;\n",
      "\n",
      "W_CO2 = z1/z; \t\t\t#Weight per kg of flue gas\n",
      "W_CO = z2/z; \t\t\t#Weight per kg of flue gas\n",
      "W_O2 = z3/z; \t\t\t#Weight per kg of flue gas\n",
      "W_N2 = 4/z; \t\t\t#Weight per kg of flue gas\n",
      "\n",
      "W_C = 3./11*W_CO2 + 3./7*W_CO; \t\t\t#Weight of carbon per kg of flue gas\n",
      "\n",
      "W = C/W_C; \t\t\t#Weight of dry flue gas per kg of fuel\n",
      "\n",
      "Vapour = 1.35; \t\t\t#kg; Vapour of combustion\n",
      "\n",
      "W_total = W+Vapour; \t\t\t#Total weight of gas\n",
      "\n",
      "W_air = W_total-1; \t\t\t#Air supplied\n",
      "\n",
      "ratio = W_air/1;\n",
      "\n",
      "# Results\n",
      "print (\"Ratio of air to petrol  = %.3f\")% (ratio)\n",
      "\n",
      "S_air = (C*8./3 + H2*8)*100./23; \t\t\t#Stoichiometric air\n",
      "\n",
      "W_excess = W_air-S_air; \t\t\t#Excess air\n",
      "\n",
      "Excess = W_excess/S_air*100; \t\t\t#Percentage excess air\n",
      "\n",
      "print (\"Percentage excess air %.3f\")% (Excess),\n",
      "print (\"%\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ratio of air to petrol  = 16.951\n",
        "Percentage excess air 12.461 %\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.8 Page no : 512"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "C = 0.86;\n",
      "H2 = 0.08;\n",
      "S = 0.03;\n",
      "O2 = 0.02;\n",
      "\n",
      "# Calculations and Results\n",
      "W_O2 = C*8./3 + H2*8 + S*1;\n",
      "A = W_O2-O2; \t\t\t#Weight of oxygen to be supplied per kg of fuel\n",
      "W_min = A*100./23;\n",
      "r_correct = 1./W_min/1; \t\t\t#\u201ccorrect\u201d fuel-air ratio\n",
      "r_actual = 1./12;\n",
      "\n",
      "print (\"(i) Mixture strength\")\n",
      "s = r_actual/r_correct*100; \t\t\t#Mixture strength\n",
      "\n",
      "richness = s-100;\n",
      "print (\"richness =  %.3f\")% (richness), (\"%\")\n",
      "print (\"This show that mixture is 6.5% rich.\")\n",
      "\n",
      "D = 1/r_correct-1/r_actual;\n",
      "\n",
      "CO = 0.313; \t\t\t#kg\n",
      "CO2 = 2.662; \t\t\t#kg\n",
      "N2 = 9.24; \t\t\t#kg\n",
      "SO2 = 0.06; \t\t\t#kg\n",
      "\n",
      "print (\"(ii) The percentage composition of dry flue gases\")\n",
      "\n",
      "#For CO\n",
      "x1 = 0.313; \t\t\t#kg\n",
      "y1 = 28.;\n",
      "z1 = x1/y1;\n",
      "\n",
      "#For CO2\n",
      "x2 = 2.662; \t\t\t#kg\n",
      "y2 = 44;\n",
      "z2 = x2/y2;\n",
      "\n",
      "#For N2\n",
      "x3 = 9.24; \t\t\t#kg\n",
      "y3 = 28;\n",
      "z3 = x3/y3;\n",
      "\n",
      "#For SO2\n",
      "x4 = 0.06; \t\t\t#kg\n",
      "y4 = 64;\n",
      "z4 = x4/y4;\n",
      "\n",
      "z = z1+z2+z3+z4;\n",
      "\n",
      "#Let percentage volume be denoted by V\n",
      "V_CO = z1/z*100;\n",
      "print (\"Percentage volume of CO = %.3f\")% (V_CO), (\"%\")\n",
      "\n",
      "V_CO2 = z2/z*100;\n",
      "print (\"Percentage volume of CO2 = %.3f\")% (V_CO2), (\"%\")\n",
      "\n",
      "V_N2 = z3/z*100;\n",
      "print (\"Percentage volume of N2 = %.3f\")% (V_N2), (\"%\")\n",
      "\n",
      "\n",
      "V_SO2 = z4/z*100;\n",
      "print (\"Percentage volume of SO2 = %.3f\")% (V_SO2), (\"%\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Mixture strength\n",
        "richness =  6.643 %\n",
        "This show that mixture is 6.5% rich.\n",
        "(ii) The percentage composition of dry flue gases\n",
        "Percentage volume of CO = 2.776 %\n",
        "Percentage volume of CO2 = 15.027 %\n",
        "Percentage volume of N2 = 81.964 %\n",
        "Percentage volume of SO2 = 0.233 %\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.9 Page no :513"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "A = 992./284*100./23; \t\t\t#Air required for complete combustion\n",
      "B = 13.; \t\t\t#kg/kg of fuel; Air actually supplied\n",
      "D = A-B; \t\t\t#Deficiency of air\n",
      "\n",
      "# Calculations\n",
      "W_CO2 = 0.466*11./3;\n",
      "W_CO = 0.379*7./3;\n",
      "W_H2O = 22./142*9;\n",
      "W_N2 = 13.*0.77;\n",
      "\n",
      "#For CO2\n",
      "x1 = W_CO2\n",
      "y1 = 44.;\n",
      "z1 = x1/y1;\n",
      "\n",
      "#For CO\n",
      "x2 = W_CO;\n",
      "y2 = 28.;\n",
      "z2 = x2/y2;\n",
      "\n",
      "#For H2O\n",
      "x3 = W_H2O;\n",
      "y3 = 18.;\n",
      "z3 = x3/y3;\n",
      "\n",
      "#For N2\n",
      "x4 = W_N2;\n",
      "y4 = 28.;\n",
      "z4 = x4/y4;\n",
      "\n",
      "z = z1+z2+z3+z4;\n",
      "\n",
      "CO2 = z1/z*100;\n",
      "\n",
      "# Results\n",
      "print (\"Percentage of CO2 = %.3f\")% (CO2), (\"%\")\n",
      "\n",
      "CO = z2/z*100;\n",
      "print (\"Percentage of CO = %.3f\")% (CO), (\"%\")\n",
      "\n",
      "H2O = z3/z*100;\n",
      "print (\"Percentage of H2O = %.3f\")% (H2O), (\"%\")\n",
      "\n",
      "N2 = z4/z*100;\n",
      "print (\"Percentage of N2 = %.3f\")% (N2), (\"%\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percentage of CO2 = 7.684 %\n",
        "Percentage of CO = 6.249 %\n",
        "Percentage of H2O = 15.328 %\n",
        "Percentage of N2 = 70.739 %\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.11 Page no : 515"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "C = 80.;\n",
      "#Analysis of gas entering the economiser\n",
      "CO2_1 = 8.3;\n",
      "CO_1 = 0.;\n",
      "O2_1 = 11.4;\n",
      "N2_1 = 80.3;\n",
      "\n",
      "\t\t\t#Analysis of gas leaving the economiser\n",
      "CO2_2 = 7.9;\n",
      "CO_2 = 0.;\n",
      "O2_2 = 11.5;\n",
      "N2_2 = 80.6;\n",
      "\n",
      "# Calculations and Results\n",
      "A1 = N2_1*C/33./(CO2_1 + CO_1); \t\t\t#Air supplied on the basis of conditions at entry to the economiser\n",
      "A2 = N2_2*C/33./(CO2_2 + CO_2); \t\t\t#Air applied on the basis of conditions at exit\n",
      "\n",
      "leakage = A2-A1; \t\t\t#Air leakage\n",
      "print (\"Air leakege  = %.3f\")% (leakage), (\"kg of air per kg of fuel\")\n",
      "\n",
      "W_fuel = 0.85; \t\t\t#kg; Weight of fuel pasmath.sing up the chimney\n",
      "\n",
      "c = 1.05;\n",
      "T2 = 410.;\n",
      "T1 = 0.;\n",
      "\n",
      "W = A1+W_fuel; \t\t\t#Total weight of products\n",
      "Q1 = W*c*(T2-T1); \t\t\t#Heat in flue gases per kg of coal\n",
      "Q2 = leakage*1.005*(20-0); \t\t\t#Heat in leakage air\n",
      "t = (Q1+Q2)/(1.005*leakage + W*1.05);\n",
      "dT = T2-t;\n",
      "\n",
      "print (\"Fall in temperature as a result of the air leakage into the economiser %.3f\")%(dT),(\"C\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Air leakege  = 1.280 kg of air per kg of fuel\n",
        "Fall in temperature as a result of the air leakage into the economiser 18.711 C\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.12 Page no : 516"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "w_O2 = 3.*32./46*100./23; \t\t\t#For complete combustion of 1 kg of C2H6O, oxygen required\n",
      "\n",
      "# Calculations and Results\n",
      "ratio = w_O2;\n",
      "print (\"A:F ratio = %.3f\")%(ratio)\n",
      "\n",
      "w1 = 88.; \t\t\t#kg\n",
      "w2 = 54.; \t\t\t#kg\n",
      "\n",
      "w = w1+w2; \t\t\t#kg\n",
      "W = 46.; \t\t\t#kg\n",
      "\n",
      "w_CO2 = w1/W*100;\n",
      "print (\"CO2 produced by fuel %.3f\")% (w_CO2), (\"%\")\n",
      "\n",
      "w_H2O = w2/W*100;\n",
      "print (\"H2O produced by fuel %.3f\")% (w_H2O), (\"%\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "A:F ratio = 9.074\n",
        "CO2 produced by fuel 191.304 %\n",
        "H2O produced by fuel 117.391 %\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.13 Page no : 517"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# C2H2+xO2---->aCO2+bH2O\n",
      "\n",
      "# Calculations\n",
      "Amount =  3.076 + 10.12;\n",
      "\n",
      "# Results\n",
      "print (\"Hence amount of theoretical air required for combustion of 1 kg acetylene  = \"), (Amount), (\"kg\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Hence amount of theoretical air required for combustion of 1 kg acetylene  =  13.196 kg\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.14 Page no : 517"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# C2H2+2.5O2+2.5*(79/21)N2 --> 2CO2+H2O+2.5*(79/21)N2\n",
      "\n",
      "# Variables\n",
      "m_CO2 = 3.38; \t\t\t#kg\n",
      "m_H2O = 0.69; \t\t\t#kg\n",
      "m_O2 = 3.07; \t\t\t#kg\n",
      "m_N2 = 20.25; \t\t\t#kg\n",
      "\n",
      "# Calculations\n",
      "m_total = m_CO2+m_H2O+m_O2+m_N2;\n",
      "\n",
      "CO2 = m_CO2/m_total*100;\n",
      "H2O = m_H2O/m_total*100;\n",
      "O2 = m_O2/m_total*100;\n",
      "N2 = m_N2/m_total*100;\n",
      "\n",
      "# Results\n",
      "print (\"Hence the gravimetric analysis of the complete combustion is : \")\n",
      "print (\"CO2 = %.3f\")%(CO2), (\"%\")\n",
      "\n",
      "print (\"H2O = %.3f\")%(H2O), (\"%\")\n",
      "\n",
      "print (\"O2 = %.3f\")% (O2), (\"%\")\n",
      "\n",
      "print (\"N2 = %.3f\")%(N2), (\"%\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Hence the gravimetric analysis of the complete combustion is : \n",
        "CO2 = 12.340 %\n",
        "H2O = 2.519 %\n",
        "O2 = 11.208 %\n",
        "N2 = 73.932 %\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.15 Page no : 518"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculations\n",
      "AF_mole = (12.5+12.5*(79./21))/1;\n",
      "AF_mass = AF_mole*28.97/(8.*12+1*18);\n",
      "\n",
      "# Results\n",
      "print (\"Air fuel ratio  = %.3f\")%(AF_mass), (\"kg air/kg fuel\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Air fuel ratio  = 15.126 kg air/kg fuel\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.16 Page no : 518"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# C8H18+12.5*O2+12.5*(79/21)N2 --> 8CO2+9H2O+12.5*(79/21)*N2\n",
      "# C8H18 + (2) (12.5) O2 + (2) (12.5)*(79/21)N2-->8CO2 + 9H2O + (1) (12.5) O2 + (2) (12.5)*(79/21)*N2\n",
      "\n",
      "# Calculations and Results\n",
      "m_fuel = 1*(8*12+1*18);\n",
      "m_air = 2*12.5*(1+79./21)*28.97;\n",
      "\n",
      "AF = m_air/m_fuel;\n",
      "print (\"(i) Air-fuel ratio  = %.3f\")%(AF)\n",
      "\n",
      "print (\"(ii) Dew point of the products\")\n",
      "n = 8+9+12.5+2*12.5*(79./21);\n",
      "\n",
      "x = 9./n;\n",
      "p = 100.*x;\n",
      "\n",
      "#Hence\n",
      "t_dp = 39.7; \t\t\t#0C\n",
      "\n",
      "print (\"t_dp = %.3f\")%(t_dp),(\"\u00b0C\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Air-fuel ratio  = 30.253\n",
        "(ii) Dew point of the products\n",
        "t_dp = 39.700 \u00b0C\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.17 Page no : 519"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# C2H6 + 3.5O2 \u2192 2CO2 + 3H2O\n",
      "\n",
      "# Calculations\n",
      "n = 1.3+0.7+0.9*3.5*(79./21);\n",
      "CO2 = 1.3/n*100;\n",
      "CO = 0.7/n*100;\n",
      "N2 = 11.85/n*100;\n",
      "\n",
      "# Results\n",
      "print (\"Volumetric analysis of dry products of combustion is as follows \")\n",
      "\n",
      "print (\"CO2  = %.3f\")% (CO2), (\"%\")\n",
      "\n",
      "print (\"CO  = %.3f\")% (CO), (\"%\")\n",
      "\n",
      "print (\"N2  = %.3f\")% (N2), (\"%\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volumetric analysis of dry products of combustion is as follows \n",
        "CO2  = 9.386 %\n",
        "CO  = 5.054 %\n",
        "N2  = 85.560 %\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.18 Page no : 520"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print (\"(i) Combustion equation\")\n",
      "\n",
      "# Variables\n",
      "z = 87.1;\n",
      "y = z*(79/21.);\n",
      "x = 10+0.53;\n",
      "a = 2*x;\n",
      "\n",
      "#10.53 CH4 + 23.16 O2 + 87.1 N2 \u2192 10.0 CO2 + 0.53 CO + 2.37 O2 + 21.06 H2O + 87.1 N2\n",
      "\n",
      "print (\"CH4 + 2.2 O2 + 8.27 N2 \u2192 0.95 CO2 + 0.05 CO + 2H2O + 0.225 O2 + 8.27 N2\")\n",
      "\n",
      "print (\"(ii) Air-fuel ratio \")\n",
      "\n",
      "AF_mole = 2.2+8.27;\n",
      "print (\"air-fuel ratio on a mole basis  = \"), (AF_mole), (\"moles air/mole fuel\")\n",
      "\n",
      "AF_mass = AF_mole*28.97/(12+1*4);\n",
      "print (\"air-fuel ratio on a mass basis  = %.3f\")%(AF_mass), (\"air/kg fuel\")\n",
      "\n",
      "# CH4 + 2O2 + 2*(79/21)N2 \u2192 CO2 + 2H2O + (2)*(79/21)N2\n",
      "AF_theor = (2+2*(79./21))*28.97/(12+1*4);\n",
      "print (\"theoretical air-fuel ratio  = %.3f\")% (AF_theor), (\"kg air/kg fuel\")\n",
      "\n",
      "theo = AF_mass/AF_theor*100;\n",
      "print (\"(iii) Percent theoretical air  = %.3f\")%(theo), (\"%\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Combustion equation\n",
        "CH4 + 2.2 O2 + 8.27 N2 \u2192 0.95 CO2 + 0.05 CO + 2H2O + 0.225 O2 + 8.27 N2\n",
        "(ii) Air-fuel ratio \n",
        "air-fuel ratio on a mole basis  =  10.47 moles air/mole fuel\n",
        "air-fuel ratio on a mass basis  = 18.957 air/kg fuel\n",
        "theoretical air-fuel ratio  = 17.244 kg air/kg fuel\n",
        "(iii) Percent theoretical air  = 109.935 %\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.19 Page no : 521"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print (\"(i) The stoichiometric A/F ratio\")\n",
      "\n",
      "# Variables\n",
      "a = 0.82/12; \t\t\t# Carbon balance\n",
      "b = 0.10/2; \t\t\t#Hydrogen balance\n",
      "x = (2*a+b)/2; \t\t\t# Oxygen balance\n",
      "\n",
      "# Calculations and Results\n",
      "Stoichiometric_AF_ratio = 2.976/0.233;\n",
      "\n",
      "print (\"Stoichiometric AF ratio  = %.3f\")%(Stoichiometric_AF_ratio)\n",
      "\n",
      "n = a+b+3.76*x;\n",
      "CO2 = 0.068/n*100;\n",
      "H2 = 0.05/n*100;\n",
      "N2 = 3.76*0.093/n*100;\n",
      "\n",
      "print (\"the analysis of the products is\")\n",
      "print (\"CO2  = %.3f\")%(CO2),(\"%\")\n",
      "\n",
      "print (\"H2  = %.3f\")%(H2),(\"%\")\n",
      "\n",
      "print (\"N2  = %.3f\")%(N2),(\"%\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) The stoichiometric A/F ratio\n",
        "Stoichiometric AF ratio  = 12.773\n",
        "the analysis of the products is\n",
        "CO2  = 14.491 %\n",
        "H2  = 10.655 %\n",
        "N2  = 74.516 %\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.20 Page no : 522"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# C + O2 \u2192 CO2\n",
      "# 2H2 + O2 \u2192 2H2O\n",
      "# S + O2 \u2192 SO2\n",
      "\n",
      "# Variables\n",
      "O2_req = 2.636; \t\t\t#kg\n",
      "\n",
      "# Calculations and Results\n",
      "AF = O2_req/0.233;\n",
      "print (\"The stoichiometric A/F ratio  = %.3f\")%(AF)\n",
      "\n",
      "AF_act = AF+0.3*AF;\n",
      "print (\"(i) Actual A/F ratio  = %.3f\")%(AF_act)\n",
      "\n",
      "print (\"(ii) Wet and dry analyses of products of combustion by volume\")\n",
      "\n",
      "n_wet = 0.5208;\n",
      "n_dry = 0.5008;\n",
      "\n",
      "print (\"Analysis of wet products is as follows :\")\n",
      "\n",
      "CO2 = 0.0734/n_wet*100;\n",
      "print (\"CO2  = %.3f\")%(CO2), (\"%\")\n",
      "\n",
      "H2O = 0.0200/n_wet*100;\n",
      "print (\"H2O  = %.3f\")%(H2O), (\"%\")\n",
      "\n",
      "SO2 = 0.0002/n_wet*100;\n",
      "print (\"SO2  = %.3f\")% (SO2), (\"%\")\n",
      "\n",
      "O2 = 0.0244/n_wet*100;\n",
      "print (\"O2  = %.3f\")% (O2), (\"%\")\n",
      "\n",
      "N2 = 0.4028/n_wet*100;\n",
      "print (\"N2  = %.3f\")%(N2), (\"%\")\n",
      "\n",
      "print (\"Analysis of dry products is as follows :\")\n",
      "\n",
      "CO2 = 0.0734/n_dry*100;\n",
      "print (\"CO2  = %.3f\")% (CO2), (\"%\")\n",
      "\n",
      "SO2 = 0.0002/n_dry*100;\n",
      "print (\"SO2  = %.3f\")% (SO2), (\"%\")\n",
      "\n",
      "O2 = 0.0244/n_dry*100;\n",
      "print (\"O2  = %.3f\")%(O2),(\"%\")\n",
      "\n",
      "N2 = 0.4028/n_dry*100;\n",
      "print (\"N2  =  %.3f\")%(N2),(\"%\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The stoichiometric A/F ratio  = 11.313\n",
        "(i) Actual A/F ratio  = 14.707\n",
        "(ii) Wet and dry analyses of products of combustion by volume\n",
        "Analysis of wet products is as follows :\n",
        "CO2  = 14.094 %\n",
        "H2O  = 3.840 %\n",
        "SO2  = 0.038 %\n",
        "O2  = 4.685 %\n",
        "N2  = 77.343 %\n",
        "Analysis of dry products is as follows :\n",
        "CO2  = 14.657 %\n",
        "SO2  = 0.040 %\n",
        "O2  = 4.872 %\n",
        "N2  =  80.431 %\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.21 Page no : 523"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "n_O2 = 0.853; \t\t\t#total moles of O2\n",
      "\n",
      "# Calculations and Results\n",
      "AF = n_O2/0.21;\n",
      "print (\"(i) Stoichiometric A/F ratio  = %.3f\")%(AF)\n",
      "\n",
      "print (\"(ii) Wet and dry analyses of the products of combustion if the actual mixture is 30% weak :\")\n",
      "AF_act = AF+0.3*AF;\n",
      "n_N2 = 0.79*AF_act;\n",
      "O2_excess = 0.21*AF_act-n_O2;\n",
      "\n",
      "n_wet = 5.899;\n",
      "n_dry = 4.915;\n",
      "\n",
      "print (\"Analysis by volume of wet products is as follows :\")\n",
      "CO2 = 0.490/n_wet*100;\n",
      "print (\"CO2  = %.3f\")%(CO2),(\"%\")\n",
      "\n",
      "H2O = 0.984/n_wet*100;\n",
      "print (\"H2O  = %.3f\")%(H2O),(\"%\")\n",
      "\n",
      "O2 = O2_excess/n_wet*100;\n",
      "print (\"O2  = %.3f\")%(O2), (\"%\")\n",
      "\n",
      "N2 = n_N2/n_wet*100;\n",
      "print (\"N2  = %.3f\")%(N2),(\"%\")\n",
      "\n",
      "print (\"Analysis by volume of dry products is as follows :\")\n",
      "\n",
      "CO2 = 0.490/n_dry*100;\n",
      "print (\"CO2  = %.3f\")%(CO2), (\"%\")\n",
      "\n",
      "O2 = O2_excess/n_dry*100;\n",
      "print (\"O2  = %.3f\")%(O2), (\"%\")\n",
      "\n",
      "N2 = n_N2/n_dry*100;\n",
      "print (\"N2  = %.3f\")%(N2), (\"%\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Stoichiometric A/F ratio  = 4.062\n",
        "(ii) Wet and dry analyses of the products of combustion if the actual mixture is 30% weak :\n",
        "Analysis by volume of wet products is as follows :\n",
        "CO2  = 8.306 %\n",
        "H2O  = 16.681 %\n",
        "O2  = 4.338 %\n",
        "N2  = 70.717 %\n",
        "Analysis by volume of dry products is as follows :\n",
        "CO2  = 9.969 %\n",
        "O2  = 5.207 %\n",
        "N2  = 84.874 %\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.22 Page no : 525"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Calculations and Results\n",
      "O2_req = 3*32./46;\n",
      "AF = O2_req/0.233;\n",
      "print (\"Stoichiometric A/F ratio  = %.3f\")% (AF)\n",
      "\n",
      "mix = 0.8; \t\t\t#mixture strength\n",
      "\n",
      "AF_actual = AF/mix;\n",
      "print (\"Actual A/F ratio  = %.3f\")%(AF_actual),\n",
      "\n",
      "# C2H6O + 1.25*(3 O2 + 3*79/21 N2) \u2192 2CO2 + 3H2O + 0.25*3O2 + 1.25*3*79/21 N2\n",
      "\n",
      "n = 2+3+0.75+14.1;\n",
      "\n",
      "print (\"Hence wet analysis is\")\n",
      "\n",
      "CO2 = 2/n*100.;\n",
      "print (\"CO2  = %.3f\")%(CO2), (\"%\")\n",
      "\n",
      "H2O = 3/n*100.;\n",
      "print (\"H2O  = %.3f\")%(H2O),(\"%\")\n",
      "\n",
      "\n",
      "O2 = 0.75/n*100;\n",
      "print (\"O2  = %.3f\")%(O2), (\"%\")\n",
      "\n",
      "N2 = 14.1/n*100;\n",
      "print (\"N2  = %.3f\")%(N2),(\"%\")\n",
      "\n",
      "nd = 2+0.75+14.1; \t\t\t#total dry moles\n",
      "\n",
      "print (\"Hence dry analysis is : \")\n",
      "\n",
      "CO2 = 2/nd*100.;\n",
      "print (\"CO2  = %.3f\")%(CO2),(\"%\")\n",
      "\n",
      "O2 = 0.75/nd*100;\n",
      "print (\"O2  = %.3f\")%(O2),(\"%\")\n",
      "\n",
      "N2 = 14.1/nd*100;\n",
      "print (\"N2  = %.3f\")% (N2), (\"%\")\n",
      "\n",
      "mix = 1.3;\n",
      "AF_act = AF/mix;\n",
      "print (\"Actual A/F ratio  = %.3f\")% (AF_act)\n",
      "\n",
      "print \"Hence wet analysis is :\"\n",
      "CO2 = .614/13.678 * 100\n",
      "print \"CO2 = %.2f %%\"%CO2\n",
      "CO = 1.386/13.678 * 100\n",
      "print \"CO = %.2f %%\" %CO\n",
      "H2O = 3/13.678 * 100\n",
      "print \"H2O = %.2f %%\" %H2O\n",
      "N2 = 8.678/13.678 * 100\n",
      "print \"N2 = %.2f %%\" %N2\n",
      "\n",
      "print \"Hence dry analysis is :\"\n",
      "CO2 = .614/10.678 * 100\n",
      "print \"CO2 = %.2f %%\"%CO2\n",
      "CO = 1.386/10.678 * 100\n",
      "print \"CO = %.2f %%\" %CO\n",
      "N2 = 8.678/10.678 * 100\n",
      "print \"N2 = %.2f %%\" %N2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Stoichiometric A/F ratio  = 8.957\n",
        "Actual A/F ratio  = 11.196 Hence wet analysis is\n",
        "CO2  = 10.076 %\n",
        "H2O  = 15.113 %\n",
        "O2  = 3.778 %\n",
        "N2  = 71.033 %\n",
        "Hence dry analysis is : \n",
        "CO2  = 11.869 %\n",
        "O2  = 4.451 %\n",
        "N2  = 83.680 %\n",
        "Actual A/F ratio  = 6.890\n",
        "Hence wet analysis is :\n",
        "CO2 = 4.49 %\n",
        "CO = 10.13 %\n",
        "H2O = 21.93 %\n",
        "N2 = 63.44 %\n",
        "Hence dry analysis is :\n",
        "CO2 = 5.75 %\n",
        "CO = 12.98 %\n",
        "N2 = 81.27 %\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.23 Page no : 527"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# C2H6O + 3O2 + 3*79/21 N2 \u2192 2CO2 + 3H2O + 3*79/21 N2\n",
      "\n",
      "# Variables\n",
      "R0 = 8.314*10**3; \t\t\t#kJ/kg K\n",
      "m = 46.; \t\t\t#kg\n",
      "\n",
      "print (\"(i) Volume of reacmath.tants per kg of fuel \")\n",
      "\n",
      "n = 1+3+3*79./21;\n",
      "T = 323.; \t\t\t#K\n",
      "p = 1.013*10**5; \t\t\t#Pa\n",
      "\n",
      "# Calculations\n",
      "V = n*R0*T/p;\n",
      "\n",
      "Vr = V/m;\n",
      "print (\"Vr = %.3f\")% (Vr), (\"m**3\")\n",
      "\n",
      "print (\"(ii) Volume of products per kg of fuel\")\n",
      "\n",
      "n = 2+3+3*79./21;\n",
      "T = 403.; \t\t\t#K\n",
      "p = 1*10.**5; \t\t\t#Pa\n",
      "\n",
      "V = n*R0*T/p;\n",
      "\n",
      "Vp = V/m;\n",
      "print (\"Vp = %.3f\")% (Vp), (\"m**3\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Volume of reacmath.tants per kg of fuel \n",
        "Vr = 8.809 m**3\n",
        "(ii) Volume of products per kg of fuel\n",
        "Vp = 11.862 m**3\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.24 Page no : 527"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# 0.506H2 + 0.1CO + 0.26CH4 + 0.04C4H8 + 0.004O2 + 0.03CO2 + 0.06N2 + 0.21 \u00d7 7O2 + 0.79 \u00d7 7N2 \u2192 a CO2 + b H2O + c O2 + d N2\n",
      "\n",
      "# Variables\n",
      "a = 0.1*0.26+4*0.04+0.03;\n",
      "b = (2*0.506+4*0.26+8*0.04)/2;\n",
      "c = (0.1+2*0.004+2*0.03+0.21*7*2-2*a-b)/2;\n",
      "d = (2*0.06+2*0.79*7)/2;\n",
      "n = 0.55+0.411+5.59;\n",
      "\n",
      "# Calculations and Results\n",
      "print (\"analysis by volume is\")\n",
      "CO2 = 0.55/n*100;\n",
      "print (\"CO2 = %.3f\")%(CO2), (\"%\")\n",
      "\n",
      "O2 = 0.411/n*100;\n",
      "print (\"O2 = %.3f\")%(O2), (\"%\")\n",
      "\n",
      "N2 = 5.59/n*100;\n",
      "print (\"N2  = %.3f\")%(N2), (\"%\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "analysis by volume is\n",
        "CO2 = 8.396 %\n",
        "O2 = 6.274 %\n",
        "N2  = 85.330 %\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.25 Page no : 528"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# C_aH_bO_cN_dS_e\n",
      "\n",
      "# Variables\n",
      "a = 60./12;\n",
      "b = 20.;\n",
      "c = 5./16;\n",
      "d = 10./14;\n",
      "e = 5./32;\n",
      "p = 5;\n",
      "q = 20./2;\n",
      "\n",
      "# Calculations\n",
      "r = 0.1562;\n",
      "x = (2*p+q+2*r-0.3125)/2;\n",
      "s = (0.7143+2*x*79./21)/2;\n",
      "air = (9.92*32+x*79./21*28)/100;\n",
      "\n",
      "# Results\n",
      "print (\"Stoichiometric air required  = %.3f\")%(air), (\"kg/kg of fuel\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Stoichiometric air required  = 13.708 kg/kg of fuel\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.26 Page no : 529"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# C_aH_bO_cN_d\n",
      "\n",
      "# Variables\n",
      "a = 84./12;\n",
      "b = 10.;\n",
      "c = 3.5/16;\n",
      "d = 1.5/14;\n",
      "\n",
      "# C7 H10 O0.218 N0.107 + x O2 + x*(79/21)N2 \u2192 p CO2 + q H2O + r N2\n",
      "\n",
      "p = 7.;\n",
      "q = 10./2;\n",
      "x = (2*p+q-c)/2.;\n",
      "r = (d+2*x*(79./21))/2;\n",
      "\n",
      "# Calculations and Results\n",
      "AF = (x*32+x*79/21*28)/100;\n",
      "print (\"(i)Stoichiometric A/F ratio  = %.3f\")% (AF)\n",
      "\n",
      "\n",
      "\n",
      "# C7H10O0.218N0.107 + (1.2)(9.39) O2 + (1.2)(9.39)*(79/21)N2 \u2192 7CO2 + 5H2O + (0.2)(9.39) O2 + (1.2)(35.4) N2\n",
      "\n",
      "n = 7+0.2*9.39+1.2*35.4;\n",
      "\n",
      "print (\"(ii)Percentage composition of dry flue gases by volume is as follows :\")\n",
      "CO2 = 7/n*100.;\n",
      "print (\"CO2  = %.3f\")% (CO2), (\"%\")\n",
      "\n",
      "O2 = 1.878/n*100;\n",
      "print (\"O2  = %.3f\")% (O2), (\"%\")\n",
      "\n",
      "N2 = 42.48/n*100;\n",
      "print (\"N2  = %.3f\")% (N2), (\"%\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)Stoichiometric A/F ratio  = 12.896\n",
        "(ii)Percentage composition of dry flue gases by volume is as follows :\n",
        "CO2  = 13.630 %\n",
        "O2  = 3.657 %\n",
        "N2  = 82.714 %\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.27 Page no : 530"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# a C + b H + c O2 + (79/21)*c N2  =  8CO2 + 0.5CO + 6.3O2 + x H2O + 85.2N2\n",
      "\n",
      "# Variables\n",
      "a = 8+0.5;\n",
      "c = 85.2/(79./21);\n",
      "x = 2*(c-8-0.5/2-6.3);\n",
      "b = 2*x;\n",
      "\n",
      "# Calculations and Results\n",
      "\n",
      "AF = (c*32+(79./21)*c*28)/(a*12+b*1);\n",
      "print (\"(i) Air-fuel ratio  = %.3f\")% (AF), (\"kg of air/kg of fuel\")\n",
      "\n",
      "\n",
      "mf_C = 12*a/(12.*a+b);\n",
      "mf_H2 = b*1/(12.*a+b);\n",
      "air = mf_C*8./3*100./23.3 + mf_H2*8*100/23.3; \t\t\t#air required for complete combustion\n",
      "percent = AF/air*100.;\n",
      "print (\"(ii)Per cent theoretical air required for combustion  = %.3f\")% (percent), (\"%\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Air-fuel ratio  = 23.144 kg of air/kg of fuel\n",
        "(ii)Per cent theoretical air required for combustion  = 136.444 %\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.28 Page no : 531"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print (\"(i) By a carbon balance\")\n",
      "\n",
      "# Calculations and Results\n",
      "# a C8H18 + 78.1N2 + 78.1*(21/79)O2 \u2192 8.9CO2 + 8.2CO + 4.3H2 + 0.5CH4 + 78.1N2 + x H2O\n",
      "a = (8.9+8.2+0.5)/8;\n",
      "AF1 = (78.1*28+78.1*21./79*32)/a/(8*12+1*18);\n",
      "print (\"Air fuel ratio  = %.3f\")% (AF1)\n",
      "\n",
      "print (\"(ii) By a hydrogen-oxygen balance \")\n",
      "\n",
      "# a C8H18 + b O2 + b*(79/21)N2 \u2192 8.9CO2 + 8.2CO + 4.3H2 + 0.5CH4 + b*(79/21)N2 + x*H2O\n",
      "\n",
      "a = (8.9+8.2+0.5)/8;\n",
      "x = (18*a-4.3*2-4*0.5)/2;\n",
      "b = (8.9*2+8.2+x)/2;\n",
      "\n",
      "AF2 = (b*32+b*(79./21.)*28.)/a/(8.*12+1*18);\n",
      "print (\"Air fuel ratio  = %.3f\")% (AF2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) By a carbon balance\n",
        "Air fuel ratio  = 11.368\n",
        "(ii) By a hydrogen-oxygen balance \n",
        "Air fuel ratio  = 11.089\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.29 Page no : 532"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# X(0.88/12 C + 0.12/2 H2) + Y O2 + 79/21*Y N2 \u2192 0.12CO2 + a O2 + (0.88 \u2013 a) N2 + b H2O\n",
      "\n",
      "# Variables\n",
      "X = 0.12/(0.88/12);\n",
      "b = 0.06*X;\n",
      "a = 0.0513;\n",
      "Y = 0.2203;\n",
      "\n",
      "# Calculations\n",
      "Air_supplied = 0.2203*32/0.233;\n",
      "AF = Air_supplied/X;\n",
      "\n",
      "# Results\n",
      "print (\"A/F ratio  = %.3f\")% (AF)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "A/F ratio  = 18.490\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.30 Page no : 532"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# X*(x/12 C + y/2 H2) + Y O2 + 79/21*Y/N2 \u2192 0.15CO2 + 0.03CO + 0.03CH4 + 0.01H2 + 0.02O2 + a H2O + 0.76N2\n",
      "\n",
      "# Variables\n",
      "Y = 0.76/(79./21);\n",
      "a = 2*(Y-0.15-0.03/2-0.02);\n",
      "Xx = 12*(0.15+0.03+0.03);\n",
      "Xy = 2*(2*0.03+0.01+a);\n",
      "\n",
      "# Calculations\n",
      "ratio = Xx/Xy;\n",
      "\n",
      "# Results\n",
      "print (\"Ratio of C to H2 in fuel  = %.3f\")% (ratio)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ratio of C to H2 in fuel  = 12.109\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.31 Page no : 533"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "h_fg0 = 2441.8; \t\t\t#kJ/kg\n",
      "m = 3.*18;\n",
      "dH0_liq = -3301000.; \t\t\t#kJ/mole\n",
      "\n",
      "# Calculations\n",
      "dH0_vap = dH0_liq+m*h_fg0;\n",
      "\n",
      "# Results\n",
      "print (\"dH0_vapour  = %.3f\")% (dH0_vap), (\"kJ/mole\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "dH0_vapour  = -3169142.800 kJ/mole\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.32 Page no : 533"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "# C6H6 + 7.5O2  \u2192 6CO2 + 3H2O (vapour)\n",
      "dH0 = -3169100.; \t\t\t#kJ\n",
      "n_R = 1+7.5;\n",
      "n_P = 6+3;\n",
      "R0 = 8.314;\n",
      "T0 = 298.; \t\t\t#K\n",
      "\n",
      "# Calculations\n",
      "dU0 = (dH0-(n_P-n_R)*R0*T0)/(6*12+1*6);\n",
      "\n",
      "# Results\n",
      "print (\"dU0  = %.3f\")% (dU0), (\"kJ/kg\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "dU0  = -40645.369 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.33 Page no : 534"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# CO+1/2 O2 \u2192 CO2\n",
      "import math \n",
      "\n",
      "# Variables\n",
      "H_R0 = 1*9705+1/2*9696; \t\t\t#kJ\n",
      "H_RT = 1*94080+1/2*99790; \t\t\t#kJ\n",
      "H_P0 = 1*10760; \t\t\t#kJ\n",
      "H_PT = 1*149100; \t\t\t#kJ\n",
      "\n",
      "# Calculations\n",
      "dH_T = -(285200+(143975-14553)-(149100-10760));\n",
      "\n",
      "# Results\n",
      "print (\"dH_T  = \"), (dH_T), (\"kJ/mole\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "dH_T  =  -276282 kJ/mole\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.34 Page no : 535"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print (\"(i) Higher heating value at consmath.tant pressure\")\n",
      "\n",
      "# Variables\n",
      "m = 4.*18;\n",
      "h_fg = 2443.; \t\t\t#kJ/kg\n",
      "LHVp = 2044009.; \t\t\t#kJ/kg\n",
      "R0 = 8.3143; \t\t\t#kJ/kg K\n",
      "T = 298.; \t\t\t#K\n",
      "\n",
      "# Calculations and Results\n",
      "HHVp = LHVp+m*h_fg;\n",
      "print (\"HHVp  = \"), (HHVp), (\"kJ/kg\")\n",
      "\n",
      "print (\"(ii) Higher heating value at consmath.tant volume\")\n",
      "dn = 3-(1+5.);\n",
      "\n",
      "HHVv = HHVp+dn*R0*T;\n",
      "print (\"HHVv  = \"), (HHVv), (\"kJ/kg\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Higher heating value at consmath.tant pressure\n",
        "HHVp  =  2219905.0 kJ/kg\n",
        "(ii) Higher heating value at consmath.tant volume\n",
        "HHVv  =  2212472.0158 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.35 Page no : 535"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "HHV = 5494977.; \t\t\t#kJ/kg\n",
      "m = 9.*18;\n",
      "u_fg = 2305.; \t\t\t#kJ/kg\n",
      "\n",
      "# Calculations\n",
      "LHVv = HHV-m*u_fg;\n",
      "\n",
      "# Results\n",
      "print (\"LHVv  = \"), (LHVv), (\"kJ/kg\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "LHVv  =  5121567.0 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.36 Page no : 535"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print (\"(i) Air and benzene vapour \")\n",
      "\n",
      "# C6H6(g) + 7.5O2(g) + 7.5*(79/21)N2(g)  =  6CO2(g) + 3H2O(g) + 7.5*(79/21)*N2(g)\n",
      "\n",
      "# Variables\n",
      "LHVp = 3169500.; \t\t\t#kJ/mole\n",
      "m = 54.; \t\t\t#kg/kg mole of fuel\n",
      "h_fg = 2442.; \t\t\t#kJ/kg\n",
      "\n",
      "# Calculations and Results\n",
      "LHVv = round(LHVp/((12*6+6*1)+(7.5*32)+7.5*(79./21)*28))\n",
      "\n",
      "print (\"LHVv per kg of mixture  = %d\")% (LHVv), (\"kJ/kg\")\n",
      "\n",
      "HHVp = (LHVp+m*h_fg)/(78+240+790);\n",
      "\n",
      "print (\"HHVp per kg of mixture  = %.0f\")% (HHVp), (\"kJ/kg\")\n",
      "\n",
      "print (\"(ii) Air and octane vapour \")\n",
      "LHVp = 5116200.; \t\t\t#kJ/mole of C8H18\n",
      "\n",
      "# C8H18(g) + 12.5O2(g) \uf8e7\u2192 8CO2(g) + 9H2O(g) + 12.5*(79/21)N2(g)\n",
      "\n",
      "LHVp1 = LHVp/((12*8+18*1)+12.5*32+12.5*79./21*28);\n",
      "print (\"LHVp per kg of mixture  = %d\")% (LHVp1), (\"kJ/kg\")\n",
      "\n",
      "m = 9*18.;\n",
      "HHVp = LHVp+m*h_fg;\n",
      "HHVp1 = HHVp/(114.+400+1317);\n",
      "print (\"HHVp per kg of mixture  = %d\")% (HHVp1), (\"kJ/kg\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Air and benzene vapour \n",
        "LHVv per kg of mixture  = 2861 kJ/kg\n",
        "HHVp per kg of mixture  = 2980 kJ/kg\n",
        "(ii) Air and octane vapour \n",
        "LHVp per kg of mixture  = 2794 kJ/kg\n",
        "HHVp per kg of mixture  = 3010 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.37 Page no : 537"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "m_CO2 = 44./12*0.88; \t\t\t#kg\n",
      "m_H2O = 18/2*0.12; \t\t\t#kg\n",
      "u_fg = 2304.; \t\t\t#kJ/kg\n",
      "h_fg = 2442.; \t\t\t#kJ/kg\n",
      "HHVv = 45670.; \t\t\t#kJ/kg\n",
      "R0 = 8.3143; \t\t\t#kJ/kg K\n",
      "T = 298.; \t\t\t#K\n",
      "\n",
      "# Calculations and Results\n",
      "\n",
      "LHVv = HHVv-m_H2O*u_fg;\n",
      "print (\"(i) (LHV)v  = \"), (LHVv), (\"kJ/kg\")\n",
      "\n",
      "print (\"(ii) (HHV)p, (LHV)p\")\n",
      "\n",
      "#1 mole fuel+x/32 O2-->3.23/44 CO2 + 1.08/18 H2O\n",
      "\n",
      "x = 32*(m_CO2/44+m_H2O/18./2.);\n",
      "\n",
      "# 1 kg fuel + 3.31 kg O2  =  3.23CO2 + 1.08H2O\n",
      "dn = (m_CO2/44-x/32);\n",
      "HHVp = HHVv-dn*R0*T;\n",
      "\n",
      "print (\"HHVp  = %.3f\")% (HHVp), (\"kJ/kg\")\n",
      "\n",
      "LHVp = HHVp-m_H2O*h_fg;\n",
      "print (\"LHVp  = %.3f\")% (LHVp), (\"kJ/kg\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) (LHV)v  =  43181.68 kJ/kg\n",
        "(ii) (HHV)p, (LHV)p\n",
        "HHVp  = 45744.330 kJ/kg\n",
        "LHVp  = 43106.970 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 40
    }
   ],
   "metadata": {}
  }
 ]
}