{
 "metadata": {
  "name": "",
  "signature": "sha256:faffd56df5ff320ba3aaf8ef0438e5c3fd03dbfd20ea0e30132ca53319ffe641"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8: Engine Cycles"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.1, page no. 154"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialization\n",
      "ratio = 7.0\n",
      "Q = 300.0                       #B/lbm\n",
      "T1 = 60+460.0                   #R\n",
      "P1 = 14.7                       #lb/in^2\n",
      "cv = 0.1715                     #B/lvm F\n",
      "g = 1.4\n",
      "\n",
      "#calculation\n",
      "Tratio = (ratio)**(g-1)\n",
      "T2 = Tratio*T1\n",
      "T3 = T2+Q/cv\n",
      "eta = round(1- 1/Tratio,2)\n",
      "WbyJ = eta*Q\n",
      "print WbyJ*778\n",
      "W = 778*WbyJ\n",
      "\n",
      "#result\n",
      "print \"Final temperature  =  %d R\" %T3\n",
      "print \"Thermal efficiency  =  %.3f\" %eta\n",
      "print \"Work done  =  %d ft-lb/lbm\" %W\n",
      "#difference in answer due to internal rounding off in Python"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "126036.0\n",
        "Final temperature  =  2881 R\n",
        "Thermal efficiency  =  0.540\n",
        "Work done  =  126036 ft-lb/lbm\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.2, page no. 157"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#initialization\n",
      "cydia = 3.0                     #in\n",
      "crdia = 5.0                     #in\n",
      "ratio = 7.0\n",
      "rpm = 3000.0                    #rpm\n",
      "hp = 50.0                       #hp\n",
      "w = 24.2                        #lbm\n",
      "Q = 18000.0                     #B/lbm\n",
      "P1 = 14.7                       #lb/in^2\n",
      "T1 = 60+460.0                   #R\n",
      "g = 1.4\n",
      "cv = 0.1715\n",
      "\n",
      "#calculation\n",
      "eta = hp*550*3600/(778*w*Q)\n",
      "vol = math.pi*(cydia/12)**2 *(crdia/12)*6/4\n",
      "vdot = vol*rpm/(60*2)\n",
      "v1 = 53.3*T1/(144*P1)\n",
      "wdot = vdot/v1\n",
      "Qdot = w*Q/3600\n",
      "Qdash = Qdot/wdot\n",
      "T2 = T1*(ratio)**(g-1)\n",
      "T3 = T2+Qdash/cv\n",
      "eta2 = 1- 1/(ratio)**(g-1)\n",
      "WbyJ = eta2*Qdot\n",
      "Wdot = WbyJ*778/550.0\n",
      "\n",
      "#result\n",
      "\n",
      "print \"Part a\"\n",
      "print \"Thermal efficiency  =  %.3f \" %eta\n",
      "\n",
      "print \"part b\"\n",
      "print \"Temperature at the end of compression  =  %d R\" %T2\n",
      "print \"Power developed  =  %.1f hp\" %Wdot"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part a\n",
        "Thermal efficiency  =  0.292 \n",
        "part b\n",
        "Temperature at the end of compression  =  1132 R\n",
        "Power developed  =  92.6 hp\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.3, page no. 161"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialization\n",
      "Pi = 14.0                       #lb/in^2\n",
      "T1 = 70+460.0                   #F\n",
      "ratio = 13.0\n",
      "T3 = 2500+460.0                 #F\n",
      "cv = 0.171\n",
      "cp = 0.23\n",
      "R = 53.3\n",
      "g = 1.4\n",
      "\n",
      "#calculation\n",
      "T2 = T1*(ratio)**(g-1)\n",
      "v3ratio = T3/T2\n",
      "cutoff =  (v3ratio-1)/(ratio-1)\n",
      "v1ratio = ratio/v3ratio\n",
      "T4 = T3*(1/v1ratio)**(g-1)\n",
      "eta = 1.0- cv*(T4-T1)/(T3-T2)/cp\n",
      "percent = eta*100\n",
      "\n",
      "#result\n",
      "print \"cut off ratio  =  %.4f\" %cutoff\n",
      "print \"T end expansion  =  %d R\" %T4\n",
      "print \"Thermal efficiency  =  %.1f\" %percent, \"%\"\n",
      "#difference in % due to internal rounding off in Python"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "0.563104145624\n",
        "cut off ratio  =  0.0835\n",
        "T end expansion  =  1400 R\n",
        "Thermal efficiency  =  56.3 %\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.4, page no. 167"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialization\n",
      "Pratio = 6.0\n",
      "P = 14.7                        #lb/in^2\n",
      "Tt1 = 60+460.0                  #R\n",
      "Tt3 = 1600+460.0                #R\n",
      "w = 60.0                        #lb/sec\n",
      "cp = 0.24                       #B/lbm F\n",
      "g = 1.4\n",
      "R = 53.3                        #ft-lb/lbm R\n",
      "\n",
      "#calculation\n",
      "Tt2 = Tt1*(Pratio)**((g-1)/g)\n",
      "Tratio = Tt2/Tt1\n",
      "Q = cp*(Tt3-Tt2)\n",
      "eta = 1- 1/Tratio\n",
      "W = eta*778*Q\n",
      "Wdot = w*W/550.0\n",
      "\n",
      "#result\n",
      "print \"Thermal efficiency  =  %.3f\" %eta\n",
      "print \"Horsepower output  =  %d hp\" %Wdot"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thermal efficiency  =  0.401\n",
        "Horsepower output  =  9731 hp\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.5, page no. 169"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialization\n",
      "P  =  14.7        #lb/in^2\n",
      "T  =  60+460      #R\n",
      "e1  =  0.8\n",
      "P2  =  3          #lb/in^2\n",
      "T2  =  1600+460   #R\n",
      "Pt4  =  15.6      #lb/in^2\n",
      "w  =  60          #lbm/sec\n",
      "e2  =  0.85\n",
      "\n",
      "#calculation\n",
      "# from table 6, initial conditions are\n",
      "ht1  =  124.3\n",
      "Prt1  =  1.215\n",
      "Prt2s  =  6*Prt1\n",
      "ht2s  =  207.6\n",
      "ht2 = ht1+(ht2s-ht1)/e1\n",
      "dht1 = round((ht2s-ht1)/e1, 1)\n",
      "ht3 = 521.4\n",
      "Prt3 = 196.2\n",
      "Pt3 = 6*P-P2\n",
      "Pratio = Pt3/Pt4\n",
      "Prt4s = Prt3/Pratio\n",
      "ht4 = 326.5\n",
      "dht3 = round(e2*(ht3-ht4), 1)\n",
      "W = 778*(dht3-dht1)\n",
      "Q = ht3-ht2\n",
      "etaf = W/778.0/Q\n",
      "Wdot = w*W/550.0\n",
      "\n",
      "#result\n",
      "print \"Thermal efficiency  =  %.3f\" %(round(W))\n",
      "print \"Horsepower output  =  %d hp\" %Wdot\n",
      "#difference due to internal rounding off in Python."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thermal efficiency  =  47925.000\n",
        "Horsepower output  =  5228 hp\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exmaple 8.6, page no. 172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialization\n",
      "g  =  1.4\n",
      "Tt4  =  2060                      #R\n",
      "cp  =  0.24\n",
      "\n",
      "#calculation\n",
      "Tt5  =  Tt4/1.67\n",
      "Tt2  =  868                       #R\n",
      "Tt3s  =  1234\n",
      "dTt3  =  (Tt3s-Tt2)/2.0\n",
      "Tt3  =  Tt2+dTt3\n",
      "Q  =  cp*(Tt4-Tt3)\n",
      "eta  =  286*0.401/Q\n",
      "\n",
      "#result\n",
      "\n",
      "print \"Heat Added is \", round(Q),\"B/lbm\"\n",
      "print \"eta is \", round(eta, 3)\n",
      "print \"Improvement is around 6.2 percent in overall efficiency\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat Added is  242.0 B/lbm\n",
        "eta is  0.474\n",
        "Improvement is around 6.2 percent in overall efficiency\n"
       ]
      }
     ],
     "prompt_number": 1
    }
   ],
   "metadata": {}
  }
 ]
}