{
 "metadata": {
  "name": "",
  "signature": "sha256:a053f39727ace41fe9dd23fd039f18e2237a3b4848b2ddbeb10075aa5411107c"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 10 : Compressor"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.1  Page No : 168"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#Given\n",
      "V1 = 2.7;#flow rate of CO2 in cubic meter/min\n",
      "T1 = 273-51;#temperature in K\n",
      "P1 = 1.0;#initial pressure in Kgf/sq cm\n",
      "P2 = 10.0;#final pressure in Kgf/sq cm\n",
      "y = 1.3;#gamma\n",
      "v1 = 0.41;#specific volume in cubic meter/Kg\n",
      "H1 = 158.7;# initial enthalpy in Kcal/Kg\n",
      "H2 = 188.7;#final enthalpy in Kcal/Kg\n",
      "\n",
      "#process is isentropic\n",
      "#To calculate the horsepower required\n",
      "\n",
      "#(i)Assuming ideal gas behaviour\n",
      "#From equation 10.3 (page no 189)\n",
      "W = (y/(y-1))*(P1*1.03*10**4*V1)*(1-(P2/P1)**((y-1)/y));#work in m Kgf/min\n",
      "W1 = W/4500.0;\n",
      "print \"i)The horsepower required is %f hp\"%(W1);\n",
      "\n",
      "#(ii)Umath.sing the given data for CO2\n",
      "#From equation 10.2 (page no 189)\n",
      "W = -(H2 - H1);#work in Kcal/Kg\n",
      "M = V1/v1;#Mass rate of gas in Kg/min\n",
      "W1 = W*M*(427/4500.0);\n",
      "print \" ii)Compressor work is %f hp\"%(W1);\n",
      "#end\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i)The horsepower required is -18.779590 hp\n",
        " ii)Compressor work is -18.746341 hp\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.2  Page No : 171"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "P1 = 1.0;#Initial pressure in atm\n",
      "P2 = 29.0;#Final pressure in atm\n",
      "C = 0.05;#Clearance\n",
      "y = 1.4;#gamma of air\n",
      "\n",
      "#To calculate the volumetric efficiency and the maximum possible pressure that can be attained in a math.single stage\n",
      "#(i)Calulation of volumetric efficiency\n",
      "#From equation 10.11 (page no 194)\n",
      "V_E = 1+C-C*(P2/P1)**(1/y);\n",
      "print \"i)Volumetric efficiency is %f percent\"%(V_E*100);\n",
      "\n",
      "#(ii)Calculation of maximum pressure \n",
      "V_E = 0;#Minimum efficiency\n",
      "P2 = P1*(((1+C-V_E)/C)**y);\n",
      "print \" ii)The maximum  possible pressure attained is %f atm\"%(P2);\n",
      "#end\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i)Volumetric efficiency is 49.596143 percent\n",
        " ii)The maximum  possible pressure attained is 70.975263 atm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.3  Page No : 174"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "V_d = 5.15;#print lacement volume in cubic meter/min\n",
      "P1 = 1.0;#initial pressure in Kgf/sq cm\n",
      "P2 = 8.5;#final pressure in Kgf/sq cm\n",
      "C = 0.06;#Clearance\n",
      "M_E = 0.8;#Mechenical efficiency\n",
      "y = 1.31;#gamma\n",
      "\n",
      "#To calculate the capacity and the actual horse power of the compressor\n",
      "v1 = V_d*(1+C-(C*((P2/P1)**(1/y))));\n",
      "print \"The capacity of the copressor is %f cubic meter/min\"%(v1);\n",
      "#From equation 10.6 (page no 192)\n",
      "W = (y/(y-1))*(P1*1*10**4*v1)*(1-(P2/P1)**((y-1)/y));#work in Kgf/min\n",
      "W1 = W/4500.0;#work in hp\n",
      "W2 = W1/M_E;\n",
      "print \" The actual horse power of the compressor is %f hp\"%(W2);\n",
      "#end\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The capacity of the copressor is 3.876154 cubic meter/min\n",
        " The actual horse power of the compressor is -30.000346 hp\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.4  Page No : 177"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "P1 = 1.0;#Initial pressure in Kgf/sq cm\n",
      "Pn = 13.0;#Final pressure in Kgf/sq cm\n",
      "V1 =27.0;#flow rate of gas in cubic meter/min\n",
      "y = 1.6;#gamma of the gas\n",
      "n = [1.0,2.0,3.0,4.0,7.0,10.0];#number of stages\n",
      "print \"No of stages             Horse power in hp\";\n",
      "#To Calculate the theoretical horse power required\n",
      "W = []\n",
      "for i in range(0,6):\n",
      "    W.append(n[i]*(y/(y-1))*((P1*10**4)/4500)*V1*(1-(Pn/P1)**((y-1)/(n[i]*y))));\n",
      "    print \"  %d\"%(n[i]),\n",
      "    print \"                       %f\"%(-1*W[i])\n",
      "#end\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "No of stages             Horse power in hp\n",
        "  1                        258.647729\n",
        "  2                        197.623943\n",
        "  3                        181.430407\n",
        "  4                        173.977056\n",
        "  7                        164.971690\n",
        "  10                        161.541416\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.5  Page No : 180"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "P1 = 1.0;#Initial pressure in Kgf/sq cm\n",
      "P4 = 200.0;#Final pressure in Kgf/sq cm\n",
      "n = 4.0;#no of stages\n",
      "\n",
      "#To find out the presure between stages\n",
      "r = (P4/P1)**(1/n);#Compression ratio\n",
      "P2 = r*P1;\n",
      "print \"The pressure after 1st stage is %f Kgf/sq cm\"%(P2);\n",
      "P3 = r*P2;\n",
      "print \" The pressure after 2nd stage is %f Kgf/sq cm\"%(P3);\n",
      "P4 = r*P3;\n",
      "print \" The pressure after 3rd stage is %f Kgf/sq cm\"%(P4);\n",
      "#end\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The pressure after 1st stage is 3.760603 Kgf/sq cm\n",
        " The pressure after 2nd stage is 14.142136 Kgf/sq cm\n",
        " The pressure after 3rd stage is 53.182959 Kgf/sq cm\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}