{
 "metadata": {
  "name": "",
  "signature": "sha256:211206a262b62c2debc3feb25be2afbc621e4825b9e890da1c402d32830cf7cd"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8 : Air compressors"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.1 pg : 15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "P1 = 100.;\n",
      "T1 = 300.;\n",
      "P2 = 650.;\n",
      "n = 1.25;\n",
      "r = 0.05;\n",
      "\n",
      "# Calculations\n",
      "Ev = 1-(r*(((P2/P1)**(1./n))-1));\n",
      "\n",
      "# Results\n",
      "print 'Volumetric Efficiency =  %2.2f Percent'%(Ev*100);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volumetric Efficiency =  82.65 Percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.2 pg : 15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "D = 0.24;\n",
      "LN = 5./6;\n",
      "P1 = 100.;\n",
      "P2 = 1000.;\n",
      "n = 1.35;\n",
      "\n",
      "# Calculations\n",
      "A = (22./7)*(1./4)*D*D;\n",
      "IP = (n/(n-1))*(P1*A*LN)*(((P2/P1)**((n-1)/n))-1);\n",
      "\n",
      "# Results\n",
      "print 'Indicated Power =  %2.2f kW'%(IP);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Indicated Power =  11.88 kW\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.3 pg : 15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "N = 300.;\n",
      "D = 0.2;\n",
      "L = 0.24;\n",
      "P1 = 1.01325;\n",
      "P2 = 8*1.01325;\n",
      "n = 1.35;\n",
      "Et = 0.96;\n",
      "Em = 0.85;\n",
      "Vs = (22./7)*(1./4)*D*D*L;\n",
      "\n",
      "# Calculations and Results\n",
      "IP = (n/(n-1))*(P1*Vs)*(N/60)*(((P2/P1)**((n-1)/n))-1);\n",
      "print 'Indicated Power =  %2.1f kW'%(IP*100);\n",
      "\n",
      "\n",
      "BP = IP/(Et*Em);\n",
      "print 'Brake Power =  %2.2f kW'%(BP*100);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Indicated Power =  10.5 kW\n",
        "Brake Power =  12.91 kW\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.4 pg : 16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "n = 1.35;\n",
      "P1 = 1.013;\n",
      "V1 = 1./60;\n",
      "P2 = 7;\n",
      "Et = 0.85;\n",
      "Em = 0.9;\n",
      "\n",
      "# Calculations and Results\n",
      "IP = (n/(n-1))*(P1*100*V1)*(((P2/P1)**((n-1)/n))-1);\n",
      "print 'Indicated Power =  %2.1f kW'%(IP);\n",
      "\n",
      "\n",
      "BP = IP/(Et*Em);\n",
      "print 'Brake Power =  %2.2f kW'%(BP);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Indicated Power =  4.2 kW\n",
        "Brake Power =  5.54 kW\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.5 pg : 16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "n = 1.2;\n",
      "P1 = 1;\n",
      "P2 = 6;\n",
      "Vs = 1.5/60;\n",
      "\n",
      "# Calculations and Results\n",
      "IP = (n/(n-1))*(P1*100*Vs)*(((P2/P1)**((n-1)/n))-1);\n",
      "print 'Indicated Power =  %2.1f kW'%(IP);\n",
      "\n",
      "MP = 6.55;\n",
      "Em = IP/MP;\n",
      "print 'Mechanical Efficiency =  %2.1f Percent'%(Em*100);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Indicated Power =  5.2 kW\n",
        "Mechanical Efficiency =  79.7 Percent\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.6 pg : 17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "N = 300.;\n",
      "V14 = 14/(2*N);\n",
      "Vs = 0.023/(1.05-0.22);\n",
      "n = 1.3;\n",
      "P1 = 1.013;\n",
      "P2 = 7.;\n",
      "IP = (n/(n-1))*(P1*100*V14)*(((P2/P1)**((n-1)/n))-1)*(2*N/60);\n",
      "print 'Indicated Power =  %2.1f kW'%(IP);\n",
      "\n",
      "\n",
      "T1 = 288;\n",
      "T2 = T1*((P2/P1)**((n-1)/n));\n",
      "print 'Delivery Temperature =  %2.0f K'%(T2);\n",
      "\n",
      "\n",
      "print 'Swept Volume =  %2.4f m**3'%(Vs);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Indicated Power =  57.6 kW\n",
        "Delivery Temperature =  450 K\n",
        "Swept Volume =  0.0277 m**3\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.7 pg : 18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "P1 = 1.;\n",
      "P2 = 10.;\n",
      "Vs = 0.015;\n",
      "FAD = 3.;\n",
      "Vc = Vs*0.06;\n",
      "n = 1.3;\n",
      "T1 = 20.+273;\n",
      "\n",
      "# Calculations and Results\n",
      "IP = (n/(n-1))*(P1*100*3)*(((P2/P1)**((n-1)/n))-1);\n",
      "print 'Indicated Power =  %2.1f kW'%(IP/60);\n",
      "\n",
      "\n",
      "V4 = Vc*((P2/P1)**(1./n));\n",
      "V1 = Vs+Vc;\n",
      "V14 = 0.0107;\n",
      "RS = 3/V14;\n",
      "print 'Rotation Speed =  %2.0f RPM'%(RS);\n",
      "\n",
      "Tf = 288;\n",
      "Pf = 101.325;\n",
      "Vf = (P1*100*(FAD)*Tf)/(T1*Pf);\n",
      "print 'Vf =  %2.4f m**3/min'%(Vf);\n",
      "\n",
      "\n",
      "Mcd = V1/(V14);\n",
      "print 'Mcd =  %2.1f '%(Mcd);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Indicated Power =  15.2 kW\n",
        "Rotation Speed =  280 RPM\n",
        "Vf =  2.9102 m**3/min\n",
        "Mcd =  1.5 \n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.8 pg : 19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "P1 = 1.;\n",
      "P2 = 10.;\n",
      "Vs = 0.014;\n",
      "n = 1.3;\n",
      "V1 = 3.;\n",
      "FAD = 3.;\n",
      "\n",
      "# Calculations and Results\n",
      "W = (n/(n-1))*(P1*100*V1/60)*(((P2/P1)**((n-1)/n))-1);\n",
      "print 'Power required =  %2.1f kW'%(W);\n",
      "\n",
      "\n",
      "RPM = FAD/Vs;\n",
      "print 'Rotational Speed =  %2.0f rpm'%(RPM);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power required =  15.2 kW\n",
        "Rotational Speed =  214 rpm\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.9 pg : 19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Vs = 5.665/600;\n",
      "Vc = 0.04*Vs;\n",
      "V3 = Vc;\n",
      "n = 1.3;\n",
      "P3 = 5.6;\n",
      "P2 = 0.97;\n",
      "V4 = V3*((P3/P2)**(1./n));\n",
      "V1 = Vs+Vc;\n",
      "Vd = V1-V4;\n",
      "T1 = 300;\n",
      "Tf = 288;\n",
      "P1 = 0.96;\n",
      "Pf = 1.01325;\n",
      "\n",
      "# Calculations and Results\n",
      "Vf = (Tf*P1*Vd)/(Pf*T1);\n",
      "Mcd = V1/(Vd);\n",
      "print 'Vf =  %.1e m**3/cycle'%(Vf);\n",
      "\n",
      "print 'Mc/Md =  %2.2f '%(Mcd);\n",
      "\n",
      "\n",
      "N = 600;\n",
      "W = (n/(n-1))*(P1*100*Vd)*(((P3/P1)**((n-1)/n))-1);\n",
      "IP = W*N/60;\n",
      "print 'Indicated Power =  %2.2f kW'%(IP);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vf =  7.6e-03 m**3/cycle\n",
        "Mc/Md =  1.17 \n",
        "Indicated Power =  17.48 kW\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.10 pg: 20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "IP = 15.;\n",
      "n = 1.2;\n",
      "P1 = 100.;\n",
      "P2 = 700.;\n",
      "\n",
      "# Calculations\n",
      "x = ((P2/P1)**((n-1)/n))-1;\n",
      "V1N = (IP*(n-1)*60)/(n*P1*x*2);\n",
      "LN = 150/2;\n",
      "D2 = V1N*4/((22./7)*LN);\n",
      "D = D2**0.5;\n",
      "L = D*1.5;\n",
      "\n",
      "# Results\n",
      "print 'D =  %2.0f mm'%(D*1000);\n",
      "print 'L =  %2.0f mm'%(L*1000);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "D =  182 mm\n",
        "L =  273 mm\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.11 pg : 21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "P1 = 1.;\n",
      "P2 = 16.;\n",
      "n = 1.3;\n",
      "LN = 100.;\n",
      "N = 350.;\n",
      "IP = 30.;\n",
      "Ev = 0.95;\n",
      "\n",
      "# Calculations\n",
      "L = LN/N;\n",
      "x = (((P2/P1)**((n-1)/n))-1);\n",
      "V14 = (IP*(n-1)*60)/(n*P1*100*x*N);\n",
      "Vs = V14/Ev;\n",
      "D2 = Vs*4/((22./7)*L);\n",
      "D = D2**0.5;\n",
      "\n",
      "# Results\n",
      "print 'D =  %2.0f mm'%(D*1000);\n",
      "print 'L =  %2.0f mm'%(L*1000);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "D =  249 mm\n",
        "L =  286 mm\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.12 pg : 22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "D = 0.2;\n",
      "L = 0.3;\n",
      "Vs = (22./7)*(1./4)*D*D*L;\n",
      "Vc = 0.04*Vs;\n",
      "\n",
      "V3 = Vc;\n",
      "P2 = 9;\n",
      "P1 = 1;\n",
      "n = 1.3;\n",
      "V4 = V3*((P2/P1)**(1./n));\n",
      "\n",
      "# Calculations and Results\n",
      "V1 = Vs+Vc;\n",
      "W = (n/(n-1))*(P1*100)*(V1-V4)*(((P2/P1)**((n-1)/n))-1);\n",
      "R = 0.287;\n",
      "T1 = 15+273;\n",
      "Md = (P1*(V1-V4)*100)/(R*T1);\n",
      "Wpkg = W/Md;\n",
      "print 'Word done per kg: %3.2f kJ/kg of air'%(Wpkg);\n",
      "\n",
      "\n",
      "T2 = T1*((P2/P1)**((n-1)/n));\n",
      "G = 1.4;\n",
      "Q = ((G-n)/(G-1))*((R*(T1-T2))/(n-1));\n",
      "print 'Heat Transfereed: %3.2f kJ/kg'%(Q);\n",
      "\n",
      "\n",
      "Pm = W/Vs;\n",
      "print 'Mean Effective Pressure: %3.2f kPa'%(Pm);\n",
      "\n",
      "\n",
      "Mac = V1/(V1-V4);\n",
      "print 'Mass of air compressed to delivered: %3.2f '%(Mac);\n",
      "\n",
      "\n",
      "Tf = T1;\n",
      "Pf = 101.325;\n",
      "Vf = (P1*100*(V1-V4)*Tf)/(Pf*T1);\n",
      "RPM = 500;\n",
      "Vf = Vf*RPM;\n",
      "print 'FAD at standand condition: %3.2f m**3/min'%(Vf);\n",
      "\n",
      "\n",
      "IP = (W*RPM)/60;\n",
      "Etrans = 0.92;\n",
      "Emech = 0.85;\n",
      "Emotor = 0.75;\n",
      "MP = IP/(Etrans*Emech*Emotor);\n",
      "print 'Motor Power: %3.2f kW'%(MP);\n",
      "\n",
      "\n",
      "MAC = Md*RPM;\n",
      "print 'Mass of air compressed: %3.2f kg/min'%(MAC);\n",
      "\n",
      "\n",
      "ACC = MAC*Mac;\n",
      "print 'Air compressed in cylinder: %3.2f kg/min'%(ACC);\n",
      "\n",
      "\n",
      "print 'End Temperature: %3.2f K'%(T2);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Word done per kg: 236.54 kJ/kg of air\n",
        "Heat Transfereed: -45.49 kJ/kg\n",
        "Mean Effective Pressure: 235.57 kPa\n",
        "Mass of air compressed to delivered: 1.26 \n",
        "FAD at standand condition: 3.83 m**3/min\n",
        "Motor Power: 31.56 kW\n",
        "Mass of air compressed: 4.70 kg/min\n",
        "Air compressed in cylinder: 5.93 kg/min\n",
        "End Temperature: 478.19 K\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.13 pg : 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Vs = 0.015;\n",
      "Vc = 0.06*Vs;\n",
      "V3 = Vc;\n",
      "n = 1.3;\n",
      "P2 = 10.;\n",
      "P1 = 1.;\n",
      "N = 280.;\n",
      "\n",
      "# Calculations and Results\n",
      "V4 = V3*((P2/P1)**(1./n));\n",
      "print 'V4: %3.4f m**3/cycle'%(V4);\n",
      "\n",
      "print 'V3: %3.4f m**3/cycle'%(V3);\n",
      "\n",
      "\n",
      "V1 = Vs+Vc;\n",
      "print 'V1: %3.4f m**3/cycle'%(V1);\n",
      "\n",
      "\n",
      "V14 = V1-V4;      #Suction Volume\n",
      "V2 = V1*((P1/P2)**(1./n));\n",
      "IP = (n/(n-1))*(P1*100*(V14))*(((P2/P1)**((n-1)/n))-1)*(N/60);\n",
      "print 'IP: %3.0f kW'%(IP);\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "V4: 0.0053 m**3/cycle\n",
        "V3: 0.0009 m**3/cycle\n",
        "V1: 0.0159 m**3/cycle\n",
        "IP:  15 kW\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.14 pg : 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "P2 = 6;\n",
      "P1 = 0.96;\n",
      "n = 1.3;\n",
      "CV = 0.04;\n",
      "\n",
      "# Calculations and Results\n",
      "Ev = (1-(CV*(((P2/P1)**(1./n))-1)))*100;\n",
      "print 'Clearance Volumetric Efficiency: %3.1f Percent'%(Ev);\n",
      "\n",
      "\n",
      "D = 0.09;\n",
      "L = 0.1;\n",
      "Vs = (22./7)*(1./4)*(D*D*L);\n",
      "Vc = 0.04*Vs;\n",
      "V4 = Vc*((P2/P1)**(1./n));\n",
      "V1 = Vc+Vs;\n",
      "EDV = V1-V4;\n",
      "print 'Effective Displacement Volume: %.3e m**3'%(EDV);\n",
      "\n",
      "\n",
      "T1 = 313;\n",
      "Tf = 293;\n",
      "Pf = 1;\n",
      "Vf = ((P1*(EDV)*Tf))/(T1*Pf);\n",
      "N = 410;\n",
      "FAD = Vf*N*2*60;\n",
      "print 'Free air delivered: %3.2f m**3'%(FAD);\n",
      "\n",
      "\n",
      "W = (n/(n-1))*(P1*100*(V1-V4))*(((P2/P1)**((n-1)/n))-1);\n",
      "IP = W*2*N/60;\n",
      "print 'Indicated Power: %3.2f kW'%(IP);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Clearance Volumetric Efficiency: 87.6 Percent\n",
        "Effective Displacement Volume: 5.576e-04 m**3\n",
        "Free air delivered: 24.66 m**3\n",
        "Indicated Power: 1.67 kW\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.15 pg : 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "P1 = 1.;\n",
      "P2 = 5.;\n",
      "T1 = 27.+273;\n",
      "m = 1.;\n",
      "R = 0.287;\n",
      "\n",
      "# Calculations and Results\n",
      "W1 = m*R*T1*(math.log(P2/P1));\n",
      "print 'Work in isothermal process: %3.1f kJ'%(W1);\n",
      "\n",
      "\n",
      "G = 1.4;\n",
      "W2 = (G/(G-1))*(m*R*T1)*(((P2/P1)**((G-1)/G))-1);\n",
      "print 'Work in isentropic process: %3.0f kJ'%(W2);\n",
      "\n",
      "\n",
      "n = 1.25;\n",
      "W3 = (n/(n-1))*(m*R*T1)*(((P2/P1)**((n-1)/n))-1);\n",
      "print 'Work in polytropic process: %3.1f kJ'%(W3);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work in isothermal process: 138.6 kJ\n",
        "Work in isentropic process: 176 kJ\n",
        "Work in polytropic process: 163.5 kJ\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.16 pg : 27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "IP = 41.;\n",
      "P1 = 1.;\n",
      "T1 = 17.+273;\n",
      "P2 = 7.;\n",
      "N = 100.;\n",
      "n = 1.2;\n",
      "\n",
      "# Calculations\n",
      "L = 150/(2*N);\n",
      "V1 = (22./7)*(1./4)*(L);        #Along with D**2\n",
      "W = (n/(n-1))*(P1*100*V1)*(((P2/P1)**((n-1)/n))-1);\n",
      "D2 = (IP*60)/(W*2*N);\n",
      "D = math.sqrt(D2);\n",
      "\n",
      "# Results\n",
      "print 'D: %3.3f m'%(D);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "D: 0.301 m\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.17 pg : 27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "D = 0.15;\n",
      "L = 0.2;\n",
      "P1 = 1.;\n",
      "T1 = 17.+273;\n",
      "P2 = 7.;\n",
      "N = 100.;\n",
      "R = 0.287;\n",
      "V1 = (22./7)*(1./4)*D*D*L;\n",
      "m = (P1*100*V1)/(R*T1);\n",
      "Mpm = m*N;\n",
      "n = 1.25;\n",
      "\n",
      "# Calculations and Results\n",
      "IP = (n/(n-1))*(P1*100*V1)*(((P2/P1)**((n-1)/n))-1)*(N/60);\n",
      "print 'Mass/min: %3.1f Mpm'%(Mpm);\n",
      "\n",
      "\n",
      "print 'Indicated Power: %3.1f kW'%(IP);\n",
      "\n",
      "\n",
      "T2 = T1*((P2/P1)**((n-1)/n));\n",
      "print 'T2: %3.1f K'%(T2);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass/min: 0.4 Mpm\n",
        "Indicated Power: 1.4 kW\n",
        "T2: 428.0 K\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.18 pg : 28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "D = 0.15;\n",
      "N = 100.;\n",
      "L = 0.2;\n",
      "P1 = 1.;\n",
      "T1 = 27.+273;\n",
      "P2 = 6.;\n",
      "n = 1.25;\n",
      "\n",
      "Vs = (22./7)*(1./4)*D*D*L;\n",
      "Vc = 0.05*Vs;\n",
      "V1 = Vs+Vc;\n",
      "V4 = Vc*((P2/P1)**(1./n));\n",
      "\n",
      "# Calculations and Results\n",
      "IP = (n/(n-1))*(P1*100*(V1-V4))*(((P2/P1)**((n-1)/n))-1);\n",
      "IPf = IP**(N/60)\n",
      "print 'IP: %3.2f kJ'%(IPf);\n",
      "\n",
      "\n",
      "Pm = IP/Vs;\n",
      "print 'Mean Effective Pressure: %3.2f kN/m**2'%(Pm);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "IP: 0.48 kJ\n",
        "Mean Effective Pressure: 181.08 kN/m**2\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.19 pg : 29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "n = 1.2;\n",
      "m = 5.;\n",
      "R = 0.287;\n",
      "T2 = 107.+273;\n",
      "T1 = 27.+273;\n",
      "\n",
      "# Calculations and Results\n",
      "IP = (n/(n-1))*(m/60)*(R*(T2-T1));\n",
      "print 'Air Power: %3.2f kW'%(IP);\n",
      "\n",
      "\n",
      "BP = 14;\n",
      "Em = IP*100/BP;\n",
      "print 'Mechanical Efficiency: %3.0f Percent'%(Em);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Air Power: 11.48 kW\n",
        "Mechanical Efficiency:  82 Percent\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.20 pg : 30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "V1 = 50.;\n",
      "P1 = 1.;\n",
      "P2 = 5.5;\n",
      "n = 1.3;\n",
      "Em = 0.82;\n",
      "\n",
      "# Calculations and Results\n",
      "IP = (n/(n-1))*(P1*100*V1)*(((P2/P1)**((n-1)/n))-1)*(1./60);\n",
      "BP = IP/Em;\n",
      "\n",
      "print 'IP: %3.1f kW'%(IP);\n",
      "print 'BP: %3.1f kW'%(BP);\n",
      "\n",
      "\n",
      "IsoP = P1*100*V1*(math.log(P2/P1))*(100./60);\n",
      "Eo = IsoP/BP;\n",
      "print 'Isothermal Efficiecy: %3.1f Percent'%(Eo);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "IP: 174.1 kW\n",
        "BP: 212.3 kW\n",
        "Isothermal Efficiecy: 66.9 Percent\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.21 pg : 30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "P1 = 1.;\n",
      "P2 = 5.5;\n",
      "T1 = 27.+273;\n",
      "Pa = 1.01325;\n",
      "Ta = 17.+273;\n",
      "C = 0.06;\n",
      "n = 1.3;\n",
      "\n",
      "# Calculations\n",
      "Ev = ((P1*Ta)/(Pa*T1))*(1+C-(C*((P2/P1)**(1./n))));\n",
      "\n",
      "# Results\n",
      "print 'Volumetric Efficiency: %3.0f Percent'%(Ev*100);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volumetric Efficiency:  80 Percent\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.22 pg : 31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "V14 = 7.5;\n",
      "P1 = 1.;\n",
      "T1 = 27.+273;\n",
      "P2 = 5.5;\n",
      "n = 1.3;\n",
      "C = 0.06;\n",
      "\n",
      "# Calculations and Results\n",
      "T2 = T1*((P2/P1)**((n-1)/n));\n",
      "print 'T2: %3.1f K'%(T2);\n",
      "\n",
      "\n",
      "Ev = 1+C-(C*((P2/P1)**((1./n))));\n",
      "print 'Vol Eff: %3.1f Percent'%(Ev*100);\n",
      "\n",
      "\n",
      "AP = (n/(n-1))*(P1*100*V14/60)*(((P2/P1)**((n-1)/n))-1);\n",
      "print 'Air Power: %3.1f kW'%(AP);\n",
      "\n",
      "\n",
      "Em = 0.9;\n",
      "BP = AP/Em;\n",
      "print 'BP: %3.1f kW'%(BP);\n",
      "\n",
      "\n",
      "Emot = 0.96;\n",
      "EMC = BP/Emot;\n",
      "print 'Electric Motor Capacity: %3.1f kW'%(EMC);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "T2: 444.6 K\n",
        "Vol Eff: 83.7 Percent\n",
        "Air Power: 26.1 kW\n",
        "BP: 29.0 kW\n",
        "Electric Motor Capacity: 30.2 kW\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.23 pg : 31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "V1 = 5.;\n",
      "P1 = 1.;\n",
      "P2 = 5.;\n",
      "n = 1.25;\n",
      "Em = 0.9;\n",
      "\n",
      "# Calculations and Results\n",
      "IP = (n/(n-1))*(P1*100*V1/60)*(((P2/P1)**((n-1)/n))-1);\n",
      "SP = IP/Em;\n",
      "print 'Shaft Power: %3.1f kW'%(SP);\n",
      "\n",
      "\n",
      "IsoP = P1*100*V1*(math.log(P2/P1))*(1./60);\n",
      "Eo = IsoP/SP;\n",
      "print 'Overall Efficiency: %3.0f Percent'%(Eo*100);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Shaft Power: 17.6 kW\n",
        "Overall Efficiency:  76 Percent\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.24 pg : 32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "V1 = 25.;\n",
      "P1 = 1.;\n",
      "P2 = 7.;\n",
      "N = 460.;\n",
      "Em = 0.8;\n",
      "Ev = 0.76;\n",
      "Ei = 0.81;\n",
      "\n",
      "# Calculations\n",
      "IsoP = P1*100*V1*(math.log(P2/P1));\n",
      "IndP = IsoP/Ei;\n",
      "Vs = V1/Ev;\n",
      "Pm = IndP/Vs;\n",
      "BP = IndP/(3600*Em);\n",
      "\n",
      "# Results\n",
      "print 'Mean Effective Pressure: %3.2f bar'%(Pm/100);\n",
      "print 'BP: %3.2f kW'%(BP);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mean Effective Pressure: 1.83 bar\n",
        "BP: 2.09 kW\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.25 pg : 33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Va = 3.;\n",
      "Pa = 1.;\n",
      "Ta = 17.+273;\n",
      "P2 = 8.2;\n",
      "N = 300.;\n",
      "n = 1.35\n",
      "LD = 1.2;\n",
      "Em = 0.9;\n",
      "C = 0.05;\n",
      "\n",
      "# Calculations and Results\n",
      "P1 = Pa-0.05;\n",
      "T1 = Ta+10;\n",
      "V14 = (Pa*Va*T1)/(P1*Ta);\n",
      "\n",
      "IP = (n/(n-1))*(P1*100*V14/60)*(((P2/P1)**((n-1)/n))-1);\n",
      "BP = IP/Em;\n",
      "print 'BP: %3.1f kW'%(BP);\n",
      "\n",
      "\n",
      "Ev = 1+C-(C*((P2/P1)**(1./n)));\n",
      "print 'Volumetric Efficiency: %3.1f Percent'%(Ev*100);\n",
      "\n",
      "\n",
      "Vs = (22./7)*(1./4)*LD;\n",
      "VsMin = Vs*2*N;\n",
      "D3 = V14/(VsMin*Ev);\n",
      "D = D3**(1./3);\n",
      "print 'Cylinder Diameter: %3.0f mm'%(D*1000);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "BP: 16.6 kW\n",
        "Volumetric Efficiency: 80.3 Percent\n",
        "Cylinder Diameter: 193 mm\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.26 pg : 34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "V1 = 1.;\n",
      "P1 = 1.013;\n",
      "T1 = 15.+273;\n",
      "P2 = 7.;\n",
      "R = 0.287;\n",
      "n = 1.35;\n",
      "\n",
      "# Calculations and Results\n",
      "m = (P1*100*V1)/(R*T1);\n",
      "print 'Mass of air per minute: %3.1f kg'%(m);\n",
      "\n",
      "\n",
      "T2 = T1*(((P2/P1)**((n-1)/n)));\n",
      "print 'T2: %3.1f K'%(T2);\n",
      "\n",
      "\n",
      "IP = (n/(n-1))*(P1*100*V1/60)*(((P2/P1)**((n-1)/n))-1);\n",
      "print 'IP: %3.1f kW'%(IP);\n",
      "\n",
      "\n",
      "IsoP = P1*100*V1*(1./60)*math.log(P2/P1);\n",
      "Ei = IsoP/IP;\n",
      "print 'Isothermal Efficiency: %3.0f Percent'%(Ei*100);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass of air per minute: 1.2 kg\n",
        "T2: 475.4 K\n",
        "IP: 4.2 kW\n",
        "Isothermal Efficiency:  77 Percent\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.27 pg : 36"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "P1 = 1.013;\n",
      "T1 = 15.+273;\n",
      "P2 = 7.;\n",
      "FAD = 0.3;\n",
      "G = 1.4;\n",
      "\n",
      "# Calculations and Results\n",
      "IP = (G/(G-1))*(P1*100*FAD/60)*(((P2/P1)**((G-1)/G))-1);\n",
      "print 'For Isentropic process ';\n",
      "print 'IP: %3.1f kW'%(IP);\n",
      "\n",
      "\n",
      "T2 = T1*((P2/P1)**((G-1)/G));\n",
      "print 'T2: %3.0f K'%(T2);\n",
      "\n",
      "\n",
      "print 'For Reversible Isothermal process ';\n",
      "IP = P1*100*FAD*(1./60)*(math.log(P2/P1));\n",
      "print 'IP: %3.3f kW'%(IP);\n",
      "\n",
      "\n",
      "T2 = T1;\n",
      "print 'T2: %3.0f K'%(T2);\n",
      "\n",
      "\n",
      "print 'For Polytropic process ';\n",
      "n = 1.25\n",
      "IP = (n/(n-1))*(P1*100*FAD/60)*(((P2/P1)**((n-1)/n))-1);\n",
      "print 'IP: %3.3f kW'%(IP);\n",
      "\n",
      "\n",
      "T2 = T1*((P2/P1)**((n-1)/n));\n",
      "print 'T2: %3.2f K'%(T2);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For Isentropic process \n",
        "IP: 1.3 kW\n",
        "T2: 500 K\n",
        "For Reversible Isothermal process \n",
        "IP: 0.979 kW\n",
        "T2: 288 K\n",
        "For Polytropic process \n",
        "IP: 1.195 kW\n",
        "T2: 423.93 K\n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.28 pg : 37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "V1 = 94.;\n",
      "P1 = 1.;\n",
      "T1 = 25.+273;\n",
      "P2 = 9.;\n",
      "\n",
      "# Calculations and Results\n",
      "print 'For isothermal process ';\n",
      "T2 = T1;\n",
      "print 'T2: %3.0f K'%(T2);\n",
      "\n",
      "\n",
      "P = P1*100*V1*math.log(P2/P1);\n",
      "print 'Power required: %3.0f kW'%(P/60);\n",
      "\n",
      "\n",
      "Q = P;\n",
      "print 'Heat Rejected: %3.0f KW'%(Q/60);\n",
      "\n",
      "\n",
      "print ' For adiabatic process ';\n",
      "G = 1.4;\n",
      "T2 = T1*((P2/P1)**((G-1)/G));\n",
      "print 'T2: %3.0f K'%(T2);\n",
      "\n",
      "\n",
      "P = (G/(G-1))*(P1*100*V1/60)*(((P2/P1)**((G-1)/G))-1);\n",
      "print 'Power required: %3.0f kW'%(P);\n",
      "\n",
      "\n",
      "Q = 0;\n",
      "print 'Heat Rejected: %3.0f kW'%(Q);\n",
      "\n",
      "\n",
      "print ' For adiabatic process ';\n",
      "n = 1.25;\n",
      "T2 = T1*((P2/P1)**((n-1)/n));\n",
      "print 'T2: %3.0f K'%(T2);\n",
      "\n",
      "\n",
      "P = (n/(n-1))*(P1*100*V1/60)*(((P2/P1)**((n-1)/n))-1);\n",
      "print 'Power required: %3.0f kW'%(P);\n",
      "\n",
      "\n",
      "R = 0.287;\n",
      "Cp = 1.005;\n",
      "\n",
      "m = (P1*100*V1)/(R*T1);\n",
      "H = m*(1./60)*Cp*(T2-T1);\n",
      "Q = H-P;\n",
      "print 'Heat Rejected: %3.0f kW'%(Q);\n",
      "\n",
      "# note: rounding off error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For isothermal process \n",
        "T2: 298 K\n",
        "Power required: 344 kW\n",
        "Heat Rejected: 344 KW\n",
        " For adiabatic process \n",
        "T2: 558 K\n",
        "Power required: 479 kW\n",
        "Heat Rejected:   0 kW\n",
        " For adiabatic process \n",
        "T2: 462 K\n",
        "Power required: 432 kW\n",
        "Heat Rejected: -130 kW\n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.29 pg : 39"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "P1 = 1.;\n",
      "P2 = 12.;\n",
      "n = 1.3;\n",
      "N = 350.;\n",
      "L = 180./(2*N);\n",
      "IP = 30.;\n",
      "Ev = 0.92;\n",
      "\n",
      "# Calculations\n",
      "W = (n/(n-1))*(P1*100)*(((P2/P1)**((n-1)/n))-1);   #with (V1-V4)\n",
      "V14 = (IP*60)/(N*W);\n",
      "Vs = V14/Ev;\n",
      "D2 = Vs*4/((22./7)*L);\n",
      "D = math.sqrt(D2);\n",
      "\n",
      "# Results\n",
      "print 'D: %3.3f m'%(D);\n",
      "print 'L: %3.3f m'%(L);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "D: 0.287 m\n",
        "L: 0.257 m\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.30 pg : 40"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "m = 1.;\n",
      "P1 = 1.;\n",
      "P2 = 5.;\n",
      "T1 = 27.+273;\n",
      "n = 1.25;\n",
      "R = 0.287;\n",
      "\n",
      "# Calculations and Results\n",
      "W = m*R*T1*math.log(P2/P1);\n",
      "print 'Work Done for Isothermal Process: %3.2f kJ/kg '%(W);\n",
      "\n",
      "\n",
      "G = 1.4;\n",
      "W = (G/(G-1))*(m*R*T1)*(((P2/P1)**((G-1)/G))-1);\n",
      "print 'Work Done for Isentropic Process: %3.2f kJ/kg '%(W);\n",
      "\n",
      "\n",
      "W = (n/(n-1))*(m*R*T1)*(((P2/P1)**((n-1)/n))-1);\n",
      "print 'Work Done for Polytropic Process: %3.2f kJ/kg '%(W);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work Done for Isothermal Process: 138.57 kJ/kg \n",
        "Work Done for Isentropic Process: 175.93 kJ/kg \n",
        "Work Done for Polytropic Process: 163.47 kJ/kg \n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.31 pg : 41"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "D = 0.15;\n",
      "L = 0.3;\n",
      "P1 = 1.;\n",
      "T1 = 27.+273;\n",
      "P2 = 8.;\n",
      "N = 120.;\n",
      "G = 1.4;\n",
      "R = 0.287;\n",
      "Vs = (22./7)*(1./4)*D*D*L;\n",
      "\n",
      "# Calculations and Results\n",
      "m = (P1*100*Vs)/(R*T1);\n",
      "print 'Mass of air compressed per cycle: %3.4f kJ/cycle '%(m);\n",
      "\n",
      "\n",
      "W = (G/(G-1))*(P1*100*Vs)*(((P2/P1)**((G-1)/G))-1);\n",
      "print 'Work required per cycle: %3.3f kJ/cycle '%(W);\n",
      "\n",
      "\n",
      "P = (W*N)/60;\n",
      "print 'Power required to drive compressor: %3.2f kJ/cycle '%(P);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass of air compressed per cycle: 0.0062 kJ/cycle \n",
        "Work required per cycle: 1.506 kJ/cycle \n",
        "Power required to drive compressor: 3.01 kJ/cycle \n"
       ]
      }
     ],
     "prompt_number": 43
    }
   ],
   "metadata": {}
  }
 ]
}