{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 16 - Combustion"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 448"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the molecule \n",
      "#Initialization of variables\n",
      "per=85.\n",
      "#calculations\n",
      "a=per/12.\n",
      "b=100-per\n",
      "ad=1.13*a\n",
      "bd=1.13*b\n",
      "#results\n",
      "print '%s %d %s %d' %(\"Molecule is C\",ad, \"H\",bd+1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Molecule is C 8 H 17\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 448"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Oxygen and Nitrogen compositions and also the molecule\n",
      "#Initialization of variables\n",
      "per=0.071\n",
      "#calculations\n",
      "O2=8.74\n",
      "N2=per/2. + 3.76*O2\n",
      "Nin=32.85\n",
      "CO2=7.333\n",
      "H2o=3\n",
      "So2=0.0312\n",
      "#results\n",
      "print '%s %.2f %s %.2f'%(\"Oxygen =\",O2,\" and Nitrogen =\",N2)\n",
      "print '%s %.3f %s %d %s %.2f %s %.2f %s %.3f %s %d %s %.5f %s %.2f %s' %(\"\\n Equation is C\",CO2, \"H\",2*H2o,\"+\",O2,\" O2 +\",Nin,\"  N2 = \",CO2,\"CO2 +\",H2o,\"H2O +\",So2,\" SO2 +\",N2,\"N2\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Oxygen = 8.74  and Nitrogen = 32.90\n",
        "\n",
        " Equation is C 7.333 H 6 + 8.74  O2 + 32.85   N2 =  7.333 CO2 + 3 H2O + 0.03120  SO2 + 32.90 N2\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - Pg 451"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the air fuel ratio\n",
      "#Initialization of variables\n",
      "N2=78.1\n",
      "M=29\n",
      "co2=8.7\n",
      "co=8.9\n",
      "x4=0.3\n",
      "x5=3.7\n",
      "x6=14.7\n",
      "#calculations\n",
      "O2=N2/3.76\n",
      "Z=(co2+co+x4)/8.\n",
      "AF=(O2+N2)*M/(Z*113.)\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Air fuel ratio =\",AF,\"lbm air/lbm fuel\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Air fuel ratio = 11.3 lbm air/lbm fuel\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5 - Pg 452"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the air fuel ratio\n",
      "#Initialization of variables\n",
      "N2=78.1\n",
      "M=29\n",
      "ba=2.12\n",
      "x4=0.3\n",
      "x5=3.7\n",
      "x6=14.7\n",
      "#calculations\n",
      "O2=N2/3.76\n",
      "O2=N2/3.76\n",
      "Z=(x4*4+x5*2+x6*2)/17.\n",
      "AF=(O2+N2)*M/(Z*113.)\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Air fuel ratio =\",AF,\"lbm air/lbm fuel\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Air fuel ratio = 11.4 lbm air/lbm fuel\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6 - Pg 452"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the air fuel ratio\n",
      "#Initialization of variables\n",
      "N2=78.1\n",
      "M=29\n",
      "ba=2.12\n",
      "x4=0.3\n",
      "x5=3.7\n",
      "x6=14.7\n",
      "#calculations\n",
      "O2=N2/3.76\n",
      "c=14.7\n",
      "b= x4*4 + x5*2 + x6*2\n",
      "a=b/ba\n",
      "AF=(O2+N2)*M/(a*12 + b)\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Air fuel ratio =\",AF,\"lbm air/lbm fuel\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Air fuel ratio = 11.3 lbm air/lbm fuel\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7 - Pg 453"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the air fuel ratio\n",
      "#Initialization of variables\n",
      "N2=78.1\n",
      "M=29\n",
      "ba=2.12\n",
      "co2=8.7\n",
      "co=8.9\n",
      "x4=0.3\n",
      "x5=3.7\n",
      "x6=14.7\n",
      "#calculations\n",
      "O2=N2/3.76\n",
      "c=14.7\n",
      "Z=2.238\n",
      "X=(Z*17-x4*4-x5*2)/2\n",
      "a=co2+co/2+x4+x6/2\n",
      "b=3.764*a\n",
      "AF=(O2+N2)*M/(Z*113)\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Air fuel ratio =\",AF,\"lbm air/lbm fuel\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Air fuel ratio = 11.3 lbm air/lbm fuel\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8 - Pg 454"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the air fuel ratio\n",
      "#Initialization of variables\n",
      "x1=8.7\n",
      "x2=8.9\n",
      "x3=0.3\n",
      "N=78.1\n",
      "z=113\n",
      "M=29\n",
      "#calculations\n",
      "co2=(x1+x2+x3)*100/(N+x1+x2+x3)\n",
      "a=2.325\n",
      "AF=103*M/(a*z)\n",
      "#results\n",
      "print '%s %.2f %s' %(\"Air fuel ratio =\",AF,\"lbm air/lbm fuel\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Air fuel ratio = 11.37 lbm air/lbm fuel\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9 - Pg 457"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the higher heating value\n",
      "#Initialization of variables\n",
      "dH=-2369859. #Btu\n",
      "r=1.986\n",
      "dn=5.5\n",
      "T=536.7 #R\n",
      "#calculations\n",
      "dQ=dH+dn*r*T\n",
      "#results\n",
      "print '%s %d %s' %(\"Higher heating value =\",dQ,\"Btu\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Higher heating value = -2363996 Btu\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10 - Pg 457"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the lower heating value\n",
      "#Initialization of variables\n",
      "y=13.\n",
      "x=12.\n",
      "M2=18.\n",
      "M=170.\n",
      "p=0.4593\n",
      "vfg=694.9\n",
      "J=778.2\n",
      "m=9*18\n",
      "u1=-2363996 #Btu\n",
      "#calculations\n",
      "z=y*M2/M\n",
      "hfg=1050.4 #Btu/lbm\n",
      "ufg= hfg- p*vfg*144/J\n",
      "dU=ufg*m \n",
      "Lhv=u1+dU\n",
      "#results\n",
      "print '%s %d %s' %(\"Lower heating value =\",Lhv,\" Btu/lbm\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Lower heating value = -2203398  Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11 - Pg 457"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the heat of reaction\n",
      "#Initialization of variables\n",
      "n1=8.\n",
      "n2=9.\n",
      "n3=1.\n",
      "n4=12.5\n",
      "U11=3852.\n",
      "U12=115.\n",
      "U21=3009.\n",
      "U22=101.\n",
      "U31=24773.\n",
      "U32=640.\n",
      "U41=2539.\n",
      "U42=83.\n",
      "H=-2203389.\n",
      "#calculations\n",
      "dU1=n1*(U11-U12)+n2*(U21-U22)\n",
      "dU2=n3*(U31-U32)+n4*(U41-U42)\n",
      "Q=H+dU1-dU2\n",
      "#results\n",
      "print '%s %d %s' %(\"Heat of reaction =\",Q,\"Btu\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat of reaction = -2202154 Btu\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12 - Pg 459"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the final temperature\n",
      "#Initialization of variables\n",
      "n1=8\n",
      "n2=9\n",
      "n3=47\n",
      "h1=118\n",
      "h2=104\n",
      "h3=82.5\n",
      "Q=2203279 #Btu\n",
      "#calculations\n",
      "U11=n1*h1+n2*h2+n3*h3\n",
      "U12=U11+Q\n",
      "T2=5271 #R\n",
      "#results\n",
      "print '%s %d %s' %(\"Upon interpolating, T2 =\",T2,\" R\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Upon interpolating, T2 = 5271  R\n"
       ]
      }
     ],
     "prompt_number": 11
    }
   ],
   "metadata": {}
  }
 ]
}