{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 23 - Internal Combustion"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 437"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the efficiency, mean effective pressure and work per machine cycle\n",
      "#initialization of varaibles\n",
      "print '%s' %(\"from chart\")\n",
      "T6=2600 #R\n",
      "mratio=0.05\n",
      "V6d=82 #cu ft\n",
      "E6d=465 #Btu\n",
      "H6d=655 #Btu\n",
      "T6d=2480 #R\n",
      "Hs=58 #Btu\n",
      "LHV=19256\n",
      "#calculations\n",
      "H1=mratio*H6d + (1-mratio)*Hs\n",
      "dV=22-3.67\n",
      "PD=0.12\n",
      "Work=446*PD/dV\n",
      "pm=Work*778/(144.*PD)\n",
      "eta=446./((1-mratio)*(LHV*0.0665))\n",
      "#results\n",
      "print '%s %.3f' %(\"Efficiency = \",eta)\n",
      "print '%s %d %s' %(\"\\n Mean effective pressure =\",pm,\"psi\")\n",
      "print '%s %.2f %s' %(\"\\n Work per machine cycle =\",Work,\"Btu\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "from chart\n",
        "Efficiency =  0.367\n",
        "\n",
        " Mean effective pressure = 131 psi\n",
        "\n",
        " Work per machine cycle = 2.92 Btu\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 441"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the efficiency of the machine\n",
      "#initialization of varaibles\n",
      "f=0.03\n",
      "T6=1500. #R\n",
      "print '%s' %(\"from air tables,\")\n",
      "hi=131.46 #B/lb\n",
      "h6=381 #B/lb\n",
      "vratio=1/15.\n",
      "v1r=120.7\n",
      "P1=15. #psi\n",
      "T1=580. #R\n",
      "x=0.5\n",
      "Tb=520. #R\n",
      "H=18500 #B/lb\n",
      "mh=0.0345\n",
      "m3=1.065\n",
      "#calculations\n",
      "h1=f*h6+(1-f)*hi\n",
      "v2r=v1r*vratio\n",
      "T2=1615 #R\n",
      "u2=289.05 #B/lb\n",
      "P2=T2*1/vratio *P1/T1\n",
      "theo=0.069 #lb/lb of air\n",
      "m=theo*x\n",
      "h3B=0.242*Tb\n",
      "m3=1+0.03+0.0345\n",
      "h3=(638+284)/1.065 +h3B\n",
      "T3=3520 #R\n",
      "P3=626 #psi\n",
      "v3=53.34*T3/(P3*144)\n",
      "v3p=v3*m3\n",
      "v1=53.35*T1/(144*P1)\n",
      "v2=14.7/P1\n",
      "m1=1.03\n",
      "h3=992.\n",
      "h4=531.\n",
      "T3=3520. #R\n",
      "T4=2030. #R\n",
      "W12=m1*(98.9-289.05)\n",
      "W23=P2*(v3p-v2)*144/778.\n",
      "W34=m3*(h3-h4-53.4*(T3-T4)/778.)\n",
      "W=W12+W23+W34\n",
      "eta=W/(mh*H)\n",
      "#results\n",
      "print '%s %.3f' %(\"Efficiency = \",eta)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "from air tables,\n",
        "Efficiency =  0.516\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 448"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the efficiency, Air rate and back work ratio of the process\n",
      "#initialization of varaibles\n",
      "print '%s' %(\"Using air tables,\")\n",
      "h1=124.27\n",
      "pr1=1.2147\n",
      "p2byp1=6.\n",
      "p1=15.\n",
      "p4=15.\n",
      "eta=0.8\n",
      "#calculations\n",
      "pr2=p2byp1*pr1\n",
      "h2s=197.5\n",
      "h2=h1+(h2s-h1)/eta\n",
      "h2B=124.3\n",
      "dhB=-18500 #B/lb\n",
      "dh2=h2B-h2\n",
      "T3=1910 #R\n",
      "h3=479.85\n",
      "pr3=144.53\n",
      "h3B=h2B\n",
      "dh3=h3-h3B\n",
      "wratio=(-dh3-dh2)/(dh3+dhB)\n",
      "pr4=28.91\n",
      "h4s=306.9\n",
      "h4=h3-eta*(h3-h4s)\n",
      "Wt=(1+wratio)*(h3-h4)\n",
      "Wc=(h2-h2B)\n",
      "Wnet=Wt-Wc\n",
      "E=Wnet/(wratio*-dhB)\n",
      "rate=2545./Wnet\n",
      "BWratio=Wc/Wnet\n",
      "#results\n",
      "print '%s %.3f' %(\"Efficiency = \",E)\n",
      "print '%s %.1f %s' %(\"\\n Air rate =\",rate,\"lb air/hp hr\")\n",
      "print '%s %.2f' %(\"\\n Back work ratio = \",BWratio)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Using air tables,\n",
        "Efficiency =  0.182\n",
        "\n",
        " Air rate = 52.1 lb air/hp hr\n",
        "\n",
        " Back work ratio =  1.87\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - Pg 451"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the specific impulse, thrust and efficiency of the process\n",
      "#initialization of varaibles\n",
      "import math\n",
      "V1=587. #fps\n",
      "etaD=0.9\n",
      "etaC=0.8\n",
      "h1=114.69\n",
      "P1=10. #psia\n",
      "P6=P1\n",
      "P3=626 #psia\n",
      "dhB=-19100. #B/lb\n",
      "T1=480. #R\n",
      "#calculations\n",
      "h2s=etaD*V1*V1 /(778.*2*32.2) +h1\n",
      "print '%s' %(\"From tables,\")\n",
      "Pr2s=1.104\n",
      "Pr1=0.9182\n",
      "P2=P1*Pr2s/Pr1\n",
      "h2=h1+(h2s-h1)/etaD\n",
      "T2=509. #R\n",
      "Pr2=1.127\n",
      "Pr3s=Pr2*P3/P2\n",
      "Pr3s=6.76\n",
      "h3s=203.2\n",
      "h3=(h3s-h2)/etaC +h2\n",
      "T3=930. #R\n",
      "P3=6*P2\n",
      "T4=2160. #R\n",
      "h4=549.35\n",
      "Pr4=238.\n",
      "h4B=126.66\n",
      "dh4=422.7\n",
      "h3B=h4B\n",
      "dh3=h3-h3B\n",
      "cp=0.5\n",
      "Ta=480. #R\n",
      "Tb=530. #R\n",
      "dhf=cp*(Tb-Ta)\n",
      "wratio=(-dh4+dh3)/(dh4+dhf+dhB)\n",
      "h5s=425.3\n",
      "Pr5s=93.1\n",
      "P5=27.6\n",
      "T5=1801 #R\n",
      "Pr5=114.28\n",
      "Pr6s=Pr5*P6/P5\n",
      "h5=450.\n",
      "h6=351.\n",
      "V6=math.sqrt(2*32.2*778*(h5-h6))\n",
      "SI=((1+wratio)*V6 -V1)/(32.2)\n",
      "v1=53.34*T1/(P1*144.)\n",
      "wa=V1/v1\n",
      "thrust = wa*SI\n",
      "SC=wa*0.0174*3600/1840.\n",
      "eff=2545/(SC*-dhB)\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Specific impulse =\",SI,\"lb/lb per sec of air\")\n",
      "print '%s %d %s' %(\"\\n Thrust =\",thrust,\"lb\")\n",
      "print '%s %.3f' %(\"\\n Efficiency = \",eff)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From tables,\n",
        "Specific impulse = 52.1 lb/lb per sec of air\n",
        "\n",
        " Thrust = 1721 lb\n",
        "\n",
        " Efficiency =  0.119\n"
       ]
      }
     ],
     "prompt_number": 4
    }
   ],
   "metadata": {}
  }
 ]
}