{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter No - 8 : Fuels And Combustion\n",
      "    "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.1 - Page No :  248"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "# Given data\n",
      "C= 85 # in %\n",
      "H= 12.5 # in %\n",
      "H1 = 35000 # heat liberated by carbon in kJ\n",
      "H2 = 143000 # heat liberated by hydrogen in kJ\n",
      "HCV = (C*H1+H*H2)/100 # Higher calorific value in kJ/kg\n",
      "print \"Higher calorific value = %0.0f kJ/kg \" %HCV\n",
      "ms = 9 \n",
      "LCV= HCV -(ms*H*2442)/100  # Lower calorific value in kJ/kg\n",
      "print \"Lower calorific value = %0.0f kJ/kg \" %LCV\n",
      "\n",
      "# Note: The calculated value in the book is not accurate"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Higher calorific value = 47625 kJ/kg \n",
        "Lower calorific value = 44878 kJ/kg \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.2 - Page No :  249"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "CH4 = 77 # in %\n",
      "C2H6 = 22.5 #in %\n",
      "H1 = 40.08 # heat liberated by CH4 in MJ/nm**3\n",
      "H2 = 69.52 # heat liberated by C2H6 in MJ/nm**3\n",
      "HCV = (CH4*H1+C2H6*H2)/100 # Higher calorific value in kJ/kg\n",
      "print \"The higher calorific value = %0.3f MJ/nm**3\" %HCV\n",
      "V1= CH4*2/100 # volume of water due to combustion of CH4 in m**3\n",
      "V2= C2H6*3/100 # volume of water due to combustion of C2H6 in m**3\n",
      "V= V1+V2 # total volume in m**3\n",
      "ms= 18/22.41 # in kg\n",
      "LCV= HCV-ms*V*2.242 # in MJ/nm**3\n",
      "print \"The lower calorific value = %0.3f MJ/nm**3\" %LCV\n",
      "print \"The word nm**3 means that cubic metre at normal temperature and pressure\"\n",
      "\n",
      "# Note: The calculated value in the book is not accurate"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The higher calorific value = 46.504 MJ/nm**3\n",
        "The lower calorific value = 42.515 MJ/nm**3\n",
        "The word nm**3 means that cubic metre at normal temperature and pressure\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.3 - Page No :  253"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "mw = 2.5 #mass of water in kg\n",
      "mc= 0.744 #water equivalen of apparatus in kg\n",
      "CoalMass = 1.01*10**-3 # in kg\n",
      "T_r = 2.59 #temp. rise in degree C\n",
      "C_c = 0.016 # Cooling correction in degree C\n",
      "theta = T_r +C_c #corrected temp. rise in degree C\n",
      "Cp = 4.1868 # in kJ/kg-K\n",
      "m = mw+mc # in kg\n",
      "Qw = m * Cp*theta #heat received by water in kJ\n",
      "C = (Qw/CoalMass) # in kJ/kg\n",
      "print \"Calorific value of the fuel = %0.0f kJ/kg \" %C"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Calorific value of the fuel = 35044 kJ/kg \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.4 - Page No :  255"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "T_r = 2.912 # temp. rise in degree C\n",
      "C_c = 0.058 #cooling correction in degree C\n",
      "theta = T_r + C_c # in degree C\n",
      "HyCon= 14/100 # Hydrogen content\n",
      "C_P = 4.1868 # in J/gm-K\n",
      "Cc = 16750 #calorific value of cotton in J/gm\n",
      "m_w = 1400 # in gm\n",
      "m_c = 500 # in gm\n",
      "m = m_w+m_c # in gm\n",
      "m1 = 0.005 #mass of cotton in gm\n",
      "m2 = 0.579 #mass of oil in gm\n",
      "Qw = m*C_P*theta  # in J\n",
      "H1= m1*Cc # heat given out by combustion of cotton in J\n",
      "Qin= Qw-H1 # in J\n",
      "C= Qin/m2 # J/gm or kJ/kg\n",
      "LCV= C-2442*9*HyCon # in J/gm or kJ/kg\n",
      "print \"Higher Calorific value of the fuel = %0.0f J/gm or kJ/kg\" %C\n",
      "print \"Lower Calorific value of the fuel = %0.0f J/gm or kJ/kg\" %LCV"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Higher Calorific value of the fuel = 40660 J/gm or kJ/kg\n",
        "Lower Calorific value of the fuel = 37583 J/gm or kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.5 - Page No :  259"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "W_c = 500*10**-3 #water collected in kg\n",
      "C_P = 4.1868 # in kJ/kg-K\n",
      "T_o = 28.3 #outlet temp. in \u00b0C\n",
      "T_i = 14 #inlet temp. in \u00b0C\n",
      "P_bero= 785 # barometric pressure in mm\n",
      "P_gas= P_bero+90/13.6 # in mm\n",
      "T1=17+273 # gas temp. in K\n",
      "T2= 15+273 # in K\n",
      "theta = T_o-T_i #temp. rise in \u00b0C\n",
      "Qw = W_c * C_P*theta # in kJ\n",
      "Vgs= 2.8*10**-3 #volume of gas consumed  in m**3\n",
      "E = Qw/Vgs # in kJ\n",
      "V1= P_gas/760*(T2/T1) # in m**3\n",
      "CalorificValue= E/V1 # in kJ/standard m**3\n",
      "print \"Calorific value = %0.2f kJ/m**3 \" %CalorificValue"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Calorific value = 10335.56 kJ/m**3 \n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.6 - Page No :  264"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "C = 0.83 # in kg\n",
      "H = 0.05 # in kg\n",
      "O = 0.02 # in kg\n",
      "S = 0.002 # in kg\n",
      "AbyF_min = (11.6 * C) + +(34.8*(H-(O/8))) + (4.35 * S) # in kg\n",
      "print \"The therotical mass of air = %0.2f kg \" %AbyF_min"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The therotical mass of air = 11.29 kg \n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.7 - Page No :  265"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "C = 0.86 # in kg\n",
      "H = 0.14 # in kg\n",
      "S = 0 # in kg\n",
      "O = 0 # in kg\n",
      "Vair = 0.77 #volume of 1kg of air in m**3\n",
      "Spe_Gravity = 0.8 # specific gravity of petrol\n",
      "maBYmf = (11.6*C)+(34.8*(H-O/8)) + (4.35*S) # in kg\n",
      "print \"The therotical mass of air = %0.1f kg \" %maBYmf\n",
      "V = maBYmf *Spe_Gravity*Vair  # in m**3/litre\n",
      "print \"Volume of air required = %0.3f m**3/litre \" %V"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The therotical mass of air = 14.8 kg \n",
        "Volume of air required = 9.146 m**3/litre \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.8 - Page No :  265"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "C = 0.75 # in kg\n",
      "H = 0.08 # in kg\n",
      "O = 0.03 # in kg\n",
      "S = 0 # in kg\n",
      "P = 1.1 # in bar\n",
      "P = P*10**5 # in N/m**2\n",
      "maBYmf = (11.6*C) + (34.8 * (H-(O/8))) + (4.35 *S) # in kg\n",
      "print \"The mass of air = %0.2f kg \" %maBYmf\n",
      "m = 1.5*(maBYmf ) # in kg\n",
      "T = 20+273 # in K\n",
      "R = 29.27 \n",
      "V = (m*R*T)/P # in m**3\n",
      "print \"Volume = %0.3f m**3 \" %V\n",
      "\n",
      "# Note: The calculated value of V in the book is wrong."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mass of air = 11.35 kg \n",
        "Volume = 1.328 m**3 \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.9 - Page No :  266"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "C = 0.82 # in kg\n",
      "H2 = .12 # in kg\n",
      "O2 = 0.02 # in kg\n",
      "a = C/12 \n",
      "b = H2/2 \n",
      "y = (32*(a+(0.5*b))-O2)/0.23 \n",
      "print \"Minimum quantity of air = %0.2f kg \" %y"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum quantity of air = 13.59 kg \n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.10 - Page No :  267"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "mC= 0.88 #mass of carbon in kg\n",
      "mH2= 0.03 #mass of H2 in kg\n",
      "mS= 0.005 #mass of S in kg\n",
      "O2_mass= 2.66*mC + 8*mH2 + 2*mS # in kg\n",
      "Air_mass= O2_mass/0.23 # in kg\n",
      "Air_mass= 1.5*Air_mass # in kg (as 50% excess air is supplied)\n",
      "print \"Actual mass of air required per kg of fuel for complete combustion = %0.3f kg\" %Air_mass\n",
      "# The flue gases per kg of fuel will be:\n",
      "CO2= 3.226 # in kg\n",
      "N2= 13.04 # in kg\n",
      "O2= 1.298 # in kg\n",
      "total_mass= CO2+N2+O2 # in kg\n",
      "CO2_per_by_mass= CO2/total_mass*100 # in %\n",
      "O2_per_by_mass= O2/total_mass*100 # in %\n",
      "N2_per_by_mass= N2/total_mass*100 # in %\n",
      "print \"Percentage of CO2 by mass is : %0.1f\" %CO2_per_by_mass\n",
      "print \"Percentage of O2 by mass is  : %0.1f\" %O2_per_by_mass\n",
      "print \"Percentage of N2 by mass is  : %0.1f\" %N2_per_by_mass\n",
      "M_wt_CO2= 44 \n",
      "CO2_Per_M_com_M_wt= CO2_per_by_mass/M_wt_CO2 # % Mass composition molecular weight\n",
      "M_wt_O2= 32 \n",
      "O2_Per_M_com_M_wt= O2_per_by_mass/M_wt_O2 # % Mass composition molecular weight\n",
      "M_wt_N2= 28 \n",
      "N2_Per_M_com_M_wt= N2_per_by_mass/M_wt_N2 # % Mass composition molecular weight\n",
      "total= CO2_Per_M_com_M_wt + O2_Per_M_com_M_wt + N2_Per_M_com_M_wt \n",
      "CO2_per_by_vol= CO2_Per_M_com_M_wt/total*100 # in %\n",
      "O2_per_by_vol= O2_Per_M_com_M_wt/total*100 # in %\n",
      "N2_per_by_vol= N2_Per_M_com_M_wt/total*100 # in %\n",
      "print \"Percentage of CO2 by volume is : %0.2f\" %CO2_per_by_vol\n",
      "print \"Percentage of O2 by volume is  : %0.0f\" %O2_per_by_vol\n",
      "print \"Percentage of N2 by volume is  : %0.2f\" %N2_per_by_vol"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Actual mass of air required per kg of fuel for complete combustion = 16.897 kg\n",
        "Percentage of CO2 by mass is : 18.4\n",
        "Percentage of O2 by mass is  : 7.4\n",
        "Percentage of N2 by mass is  : 74.2\n",
        "Percentage of CO2 by volume is : 12.65\n",
        "Percentage of O2 by volume is  : 7\n",
        "Percentage of N2 by volume is  : 80.35\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.11 - Page No :  269"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Cp= 1 # in kJ/kg\n",
      "H= 2.7*10**3 # total heat of vaport in flue gas in kJ/kg\n",
      "CoalCalorific= 32.82*10**3 # in kJ/kg\n",
      "T1= 310 # final gas flue temp. in \u00b0C\n",
      "T2= 25 # boiler house temp. in \u00b0C\n",
      "mC= 0.84 #mass of carbon in kg\n",
      "mH2= 0.05 #mass of H2 in kg\n",
      "O2_mass= 2.66*mC + 9*mH2 # in kg\n",
      "Air_mass= O2_mass/0.23 # in kg\n",
      "Air_mass= 1.5*Air_mass # in kg  (as 50% excess air is supplied)\n",
      "print \"Actual mass of air required per kg of fuel for complete combustion = %0.3f kg \" %Air_mass\n",
      "# Analysis of dry flue gas by weight\n",
      "CO2= 3.08 # in kg\n",
      "N2= 13.24 # in kg\n",
      "O2= 1.32 # in kg\n",
      "total_mass= CO2+N2+O2 # in kg\n",
      "CO2_per_by_mass= CO2/total_mass*100 # in %\n",
      "O2_per_by_mass= O2/total_mass*100 # in %\n",
      "N2_per_by_mass= N2/total_mass*100 # in %\n",
      "print \"Percentage of CO2 by mass is : %0.2f\" %CO2_per_by_mass\n",
      "print \"Percentage of O2 by mass is  : %0.2f\" %O2_per_by_mass\n",
      "print \"Percentage of N2 by mass is  : %0.2f\" %N2_per_by_mass\n",
      "M_wt_CO2= 44 \n",
      "CO2_Per_M_com_M_wt= CO2_per_by_mass/M_wt_CO2 # % Mass composition molecular weight\n",
      "M_wt_O2= 32 \n",
      "O2_Per_M_com_M_wt= O2_per_by_mass/M_wt_O2 # % Mass composition molecular weight\n",
      "M_wt_N2= 28 \n",
      "N2_Per_M_com_M_wt= N2_per_by_mass/M_wt_N2 # % Mass composition molecular weight\n",
      "total= CO2_Per_M_com_M_wt + O2_Per_M_com_M_wt + N2_Per_M_com_M_wt \n",
      "CO2_per_by_vol= CO2_Per_M_com_M_wt/total*100 # in %\n",
      "O2_per_by_vol= O2_Per_M_com_M_wt/total*100 # in %\n",
      "N2_per_by_vol= N2_Per_M_com_M_wt/total*100 # in %\n",
      "print \"Percentage of CO2 by volume is : %0.0f\" %CO2_per_by_vol\n",
      "print \"Percentage of O2 by volume is  : %0.0f\" %O2_per_by_vol\n",
      "print \"Percentage of N2 by volume is  : %0.0f\" %N2_per_by_vol\n",
      "H_w_v= 9*mH2*H #heat carried away by water vapour in kJ\n",
      "H_dry_flue= total_mass*Cp*(T1-T2) # in kJ\n",
      "H_total= H_w_v+H_dry_flue # in kJ\n",
      "H_available= CoalCalorific-H_total # in kJ\n",
      "print \"Heat available for steam generation = %0.0f kJ\" %H_available"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Actual mass of air required per kg of fuel for complete combustion = 17.507 kg \n",
        "Percentage of CO2 by mass is : 17.46\n",
        "Percentage of O2 by mass is  : 7.48\n",
        "Percentage of N2 by mass is  : 75.06\n",
        "Percentage of CO2 by volume is : 12\n",
        "Percentage of O2 by volume is  : 7\n",
        "Percentage of N2 by volume is  : 81\n",
        "Heat available for steam generation = 26578 kJ\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.12 - Page No :  271"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "mC= 0.86 #mass of carbon in kg\n",
      "mH2= 0.14 #mass of H2 in kg\n",
      "maBYmf= (2.66*mC + 8*mH2)/0.23 # in kg/kg of fuel\n",
      "Air_supp_deficiency= maBYmf/10 # in kg/kg of fuel\n",
      "Air_saved= 16/(12*0.23) # in kg/kg of carbon\n",
      "m1= Air_supp_deficiency/Air_saved # mass of coal burns to carbon monoxide\n",
      "m2= mC-m1 # mass of coal burns to carbon diooxide\n",
      "CO2_formed= m2*3.66 # in kg\n",
      "CO_formed= m1*28/12 # in kg\n",
      "N2_formed= Air_supp_deficiency*0.77*9 # in kg\n",
      "M_wt_CO2= 44 # molecular weight\n",
      "M_wt_CO= 28 \n",
      "M_wt_N2= 28 \n",
      "CO2_rel_vol= CO2_formed/M_wt_CO2 \n",
      "CO_rel_vol= CO_formed/M_wt_CO \n",
      "N2_rel_vol= N2_formed/M_wt_N2 \n",
      "total_rel_vol=CO2_rel_vol+CO_rel_vol+N2_rel_vol \n",
      "CO2_vol= CO2_rel_vol/total_rel_vol*100 # in %\n",
      "CO_vol= CO_rel_vol/total_rel_vol*100 # in %\n",
      "N2_vol= N2_rel_vol/total_rel_vol*100 # in %\n",
      "print \"Volumetric analysis of CO2 = %0.2f %%\" %CO2_vol\n",
      "print \"Volumetric analysis of CO = %0.2f %% \" %CO_vol\n",
      "print \"Volumetric analysis of N2 = %0.2f %% \" %N2_vol"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volumetric analysis of CO2 = 11.47 %\n",
        "Volumetric analysis of CO = 4.86 % \n",
        "Volumetric analysis of N2 = 83.67 % \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.13 - Page No :  275"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "N = 83 #compositon of nitrogen in %\n",
      "C = 81 #carbon mass in the fuel in %\n",
      "C1 = 11 #compositon of CO2 in %\n",
      "C2 = 2 # compositon of CO in %\n",
      "O = 4 # composition of O2 in %\n",
      "AirSupplied =N*C/(33*(C1+C2)) # in kg/kg\n",
      "print \"The amount of air supplied = %0.1f kg per kg of fuel  \" %AirSupplied\n",
      "ExcessAir =79*O*C/(21*33*(C1+C2)) # in kg/kg\n",
      "print \"Weight of excess air = %0.2f kg per kg of fuel \" %ExcessAir"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The amount of air supplied = 15.7 kg per kg of fuel  \n",
        "Weight of excess air = 2.84 kg per kg of fuel \n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.14 - Page No :  275"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "CO2= 10 # in %\n",
      "O2= 6 # in %\n",
      "N2= 84 # in %\n",
      "# a= x/12 and b= (1-x)/2\n",
      "# 0.23*y/32= a+b/2+c\n",
      "abyc= CO2/O2 \n",
      "# a/(0.77*y/28)= CO2/N2\n",
      "x=0.835 \n",
      "carbon_per= x*100 # in %\n",
      "hydrogen_per= 100-carbon_per # in %\n",
      "print \"The fuel consists of\",round(carbon_per,1),\"%% carbon and\",round(hydrogen_per,1),\"%% hydrogen.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The fuel consists of 83.5 %% carbon and 16.5 %% hydrogen.\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.15 - Page No :  278"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "H2 = 50 # in %\n",
      "CO = 5 # in %\n",
      "CH4 = 35 # in %\n",
      "V = ((0.5*(H2+CO))+(2*CH4))/21 # in m**3\n",
      "print \"Quantity of air required for complete combustion of 1m**3 of gas = %0.2f m**3\" %V"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Quantity of air required for complete combustion of 1m**3 of gas = 4.64 m**3\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.16 - Page No :  279"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "H2= 0.4 # in m**3\n",
      "CH= 0.425 # in m**3\n",
      "C2H4= 0.0253 # in m**3\n",
      "C4H8= 0.0127 # in m**3\n",
      "CO= 0.075 # in m**3\n",
      "O2_vol= 0.5*H2 + 2*CH + 3*C2H4 + 6*C4H8 + 0.5*CO # in m**3\n",
      "Air_vol= O2_vol/0.21 # in m**3\n",
      "print \"The volume of air required for complete combustion = %0.1f m**3 \" %Air_vol\n",
      "actualAirSupplied= 1.3*Air_vol # in m**3\n",
      "print \"The actual quantity of air supplied = %0.2f m**3  \" %actualAirSupplied"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The volume of air required for complete combustion = 5.9 m**3 \n",
        "The actual quantity of air supplied = 7.67 m**3  \n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.17 - Page No :  280"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "V_H2= 0.15 # in m**3\n",
      "V_CH4= 0.02 # in m**3\n",
      "V_CO= 0.20 # in m**3\n",
      "V_CO2= 0.06 # in m**3\n",
      "V_O2= 0.03 # in m**3\n",
      "V_N2= 0.54 # in m**3\n",
      "V1= 0.5*V_H2 # quantity of O2 required for complete combustion of H2\n",
      "V2= 2*V_CH4 # in m**3\n",
      "V3= 0.5*V_CO # in m**3\n",
      "V= V1+V2+V3 # total oxygen required in m**3\n",
      "O2_supp= V-V_O2 # O2 to be supplied by air in m**3\n",
      "Air_req_min= O2_supp/0.21 # minimum quantity of air required in m**3\n",
      "Actual_Air_Supp= 1.5*Air_req_min # m**3 of air\n",
      "print \"The volume of air supplied  = %0.2f m**3\" %Actual_Air_Supp\n",
      "Vol_Carbondioxide_inFlue= V_CO2+V_CH4+V_CO #total volume of carbon dioxide\n",
      "Vol_O2_inFlue= (Actual_Air_Supp-Air_req_min)*0.21 # in m**3\n",
      "N2_from_air_Supp= 0.79*Actual_Air_Supp # in m**3\n",
      "Vol_N2_inFlue= N2_from_air_Supp+V_N2 # in m**3\n",
      "total= Vol_Carbondioxide_inFlue+Vol_O2_inFlue+Vol_N2_inFlue # in m**3\n",
      "Per_CarbonDioxide= Vol_Carbondioxide_inFlue/total*100 # in %\n",
      "Per_Oxygen= Vol_O2_inFlue/total*100 # in %\n",
      "Per_Nitrogen= Vol_N2_inFlue/total*100 # in %\n",
      "print \"%% Carbon dioxide is : %0.1f %%\" %Per_CarbonDioxide\n",
      "print \"%% Carbon dioxide is : %0.2f %%\" %Per_Oxygen\n",
      "print \"%% Carbon dioxide is : %0.2f %%\" %Per_Nitrogen"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The volume of air supplied  = 1.32 m**3\n",
        "% Carbon dioxide is : 14.3 %\n",
        "% Carbon dioxide is : 4.73 %\n",
        "% Carbon dioxide is : 80.96 %\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.18 - Page No :  281"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "V_CH4= 0.14 # in m**3\n",
      "V_CO= 0.35 # in m**3\n",
      "V_CO2= 0.06 # in m**3\n",
      "V_N2= 0.03 # in m**3\n",
      "V_H2= 0.42 # in m**3\n",
      "a= V_CH4+V_CO2+V_CO \n",
      "b= 2*V_CH4+V_H2 \n",
      "# a+0.5*b+c= V_CO2+V_CO/2+0.21*5\n",
      "c= V_CO2+V_CO/2+0.21*5-a-0.5*b \n",
      "d=V_N2+5*0.79 \n",
      "total= a+c+d \n",
      "Vol_per_CO2= a/total*100 # in %\n",
      "Vol_per_O2= c/total*100 # in %\n",
      "Vol_per_N2= d/total*100 # in %\n",
      "print \"Volume percentage of CO2 is : %0.2f\" %Vol_per_CO2\n",
      "print \"Volume percentage of O2 is  : %0.2f\" %Vol_per_O2\n",
      "print \"Volume percentage of N2 is  : %0.2f\" %Vol_per_N2\n",
      "m_CO2= 44 # molecular mass\n",
      "m_O2= 32 # molecular mass\n",
      "m_N2=28 # molecular mass\n",
      "mass_ratio_CO2= Vol_per_CO2/m_CO2 \n",
      "mass_ratio_O2= Vol_per_O2/m_O2 \n",
      "mass_ratio_N2= Vol_per_N2/m_N2 \n",
      "total_mass_ratio= mass_ratio_CO2+mass_ratio_O2+mass_ratio_N2 \n",
      "mass_per_CO2= mass_ratio_CO2/total_mass_ratio*100 \n",
      "mass_per_O2= mass_ratio_O2/total_mass_ratio*100 \n",
      "mass_per_N2= mass_ratio_N2/total_mass_ratio*100 \n",
      "print \"Mass percentage of CO2 is : %0.2f\" %mass_per_CO2\n",
      "print \"Mass percentage of O2 is  : %0.2f\" %mass_per_O2\n",
      "print \"Mass percentage of N2 is  : %0.2f\"%mass_per_N2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volume percentage of CO2 is : 11.19\n",
        "Volume percentage of O2 is  : 7.83\n",
        "Volume percentage of N2 is  : 80.98\n",
        "Mass percentage of CO2 is : 7.50\n",
        "Mass percentage of O2 is  : 7.22\n",
        "Mass percentage of N2 is  : 85.28\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.19 - Page No :  283"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "GCR= 110 # gas consumption rate in m**3/hour\n",
      "rpm= 300 # round per minute\n",
      "Vs= 0.1 # swept volume of engine in m**3\n",
      "V_H2=0.50 # in m**3\n",
      "V_CO= 0.05 # in m**3\n",
      "V_CH4=0.25 # in m**3\n",
      "V_CO2= 0.10 # in m**3\n",
      "V_N2= 0.10 # in m**3\n",
      "V_O2= 5.8 # in m**3\n",
      "AirRequired= (0.5*(V_H2+V_CO)+2*V_CH4)/0.21 # in m**3\n",
      "CO2_formed= V_CO+V_CH4 # in m**3\n",
      "total_CO2= CO2_formed+V_CO2 # in m**3\n",
      "N2_of_air= 0.79*AirRequired # in m**3\n",
      "total_N2= N2_of_air+V_N2 # in m**3\n",
      "TotalVolume= total_N2+total_CO2 # in m**3\n",
      "V= TotalVolume # in m**3\n",
      "ExcessAirSupplied= (V_O2*V)/(21-V_O2) # in m**3\n",
      "TotalAirSupplied= ExcessAirSupplied+AirRequired # in m**3\n",
      "AirFuel_ratio= round(TotalAirSupplied)/1 \n",
      "print \"Air fuel ratio by volume is : %0.0f\" % AirFuel_ratio\n",
      "# Let V1= Volume of air + gas aspirated per hour\n",
      "V1= GCR*6 # in m**3\n",
      "Vs_out= Vs*rpm/2*60 # in m**3\n",
      "Ratio= V1/Vs_out \n",
      "print \"The value of Ratio i.e.\"\n",
      "print \"(Volume of air + gas aspirted per hour)/Volume swept out by piston per hour = %0.4f\" %Ratio"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Air fuel ratio by volume is : 5\n",
        "The value of Ratio i.e.\n",
        "(Volume of air + gas aspirted per hour)/Volume swept out by piston per hour = 0.7333\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  8.20 - Page No :  291"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "CO2= 9.9 # in %\n",
      "CO= 7.2 # in %\n",
      "H2= 3.3 # in %\n",
      "CH4= 0.3 # in %\n",
      "N2= 79.3 # in %\n",
      "O2= N2*21/79 # in %\n",
      "print \"Method 1 : By Carbon balance :- \"\n",
      "Z= (CO2+CO+CH4)/8 \n",
      "x= 8*Z \n",
      "measured_air_fuel_ratio= 11.3 \n",
      "mm1= 29 # molecular mass of air\n",
      "mm2= 12*8+17 # molecular mass of C8H17\n",
      "massOf_air= (O2+N2)*mm1 \n",
      "massOf_fuel= Z*mm2 \n",
      "air_fuel_ratio= massOf_air/massOf_fuel \n",
      "print \"The air fuel ratio by mass is : %0.2f\" %air_fuel_ratio\n",
      "Per_error= (air_fuel_ratio - measured_air_fuel_ratio)/measured_air_fuel_ratio*100 \n",
      "print \"Percentage error is : %0.3f %%\" %Per_error\n",
      "print \"Method 2 : By Hydrogen balance : \"\n",
      "X= (O2-CO2-CO/2)*2 \n",
      "Z= (4*CH4+2*H2+X*2)/17 \n",
      "massOf_air= (O2+N2)*mm1 \n",
      "massOf_fuel= Z*mm2 \n",
      "air_fuel_ratio= massOf_air/massOf_fuel \n",
      "print \"The air fuel ratio by mass is : %0.2f\" %air_fuel_ratio\n",
      "Per_error= (air_fuel_ratio - measured_air_fuel_ratio)/measured_air_fuel_ratio*100 \n",
      "print \"Percentage error is : %0.2f %%\" %Per_error\n",
      "print \"Method 3 : By Carbon-Hydrogen balance : \"\n",
      "y= (4*CH4+2*H2+X*2) \n",
      "massOf_air= (O2+N2)*mm1 \n",
      "massOf_fuel= x*12+y \n",
      "air_fuel_ratio= massOf_air/massOf_fuel \n",
      "print \"The air fuel ratio by mass is : %0.2f\" %air_fuel_ratio\n",
      "Per_error= (air_fuel_ratio - measured_air_fuel_ratio)/measured_air_fuel_ratio*100 \n",
      "print \"Percentage error is : %0.2f %%\" %Per_error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Method 1 : By Carbon balance :- \n",
        "The air fuel ratio by mass is : 11.84\n",
        "Percentage error is : 4.816 %\n",
        "Method 2 : By Hydrogen balance : \n",
        "The air fuel ratio by mass is : 11.49\n",
        "Percentage error is : 1.67 %\n",
        "Method 3 : By Carbon-Hydrogen balance : \n",
        "The air fuel ratio by mass is : 11.79\n",
        "Percentage error is : 4.33 %\n"
       ]
      }
     ],
     "prompt_number": 20
    }
   ],
   "metadata": {}
  }
 ]
}