{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 21 - Gas Compression" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1 - Pg 387" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the work done and the net heat transferred\n", "#initialization of varaibles\n", "import math\n", "R=53.34\n", "T1=540 #R\n", "n=1.4\n", "g=n\n", "n2=1.3\n", "P2=90. #psia\n", "P1=15. #psia\n", "cv=0.171\n", "cp=0.24\n", "#calculations\n", "pv=R*T1\n", "Wk=n*R*T1*(math.pow((P2/P1),((g-1)/g)) -1) /(n-1)\n", "Wn=n2*R*T1*(math.pow((P2/P1),((n2-1)/n2)) -1) /(n2-1)\n", "Wt=R*T1*math.log(P2/P1)\n", "Q=cv*(n-n2)*778*T1*(math.pow((P2/P1),((n2-1)/n2)) -1) /(1-n2)*0.001305\n", "#0.001305 is the conversion factor\n", "#results\n", "print '%s %d %s' %(\"\\n Work in case 1 =\",Wk,\"ft lb/lb\")\n", "print '%s %d %s' %(\"\\n Work in case 2 =\",Wn,\"ft lb/lb\")\n", "print '%s %d %s' %(\"\\n Work in case 3 =\",Wt,\"ft lb/lb\")\n", "print '%s %.1f %s' %(\"\\n Heat transferred =\",Q,\"B/lb\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", " Work in case 1 = 67394 ft lb/lb\n", "\n", " Work in case 2 = 63914 ft lb/lb\n", "\n", " Work in case 3 = 51609 ft lb/lb\n", "\n", " Heat transferred = -16.0 B/lb\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2 - Pg 389" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Calculate the adiabatic and isothermal efficiencies\n", "#initialization of varaibles\n", "import math\n", "R=53.34\n", "T1=540 #R\n", "n=1.4 #gamma\n", "g=n\n", "n2=1.3 #gamma\n", "P2=90. #psia\n", "P1=15. #psia\n", "cv=0.171\n", "#calculations\n", "pv=R*T1\n", "Wk=n*R*T1*(math.pow((P2/P1),((g-1)/g)) -1) /(n-1)\n", "Wn=n2*R*T1*(math.pow((P2/P1),((n2-1)/n2)) -1) /(n2-1)\n", "Wt=R*T1*math.log(P2/P1)\n", "eta1=Wt/Wn\n", "eta2=Wk/Wn\n", "#results\n", "print '%s %.2f' %(\"Adiabatic efficiency = \",eta2)\n", "print '%s %.2f' %(\"\\n Isothermal efficiency = \",eta1)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Adiabatic efficiency = 1.05\n", "\n", " Isothermal efficiency = 0.81\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3 - Pg 389" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the heat transferred\n", "#initialization of varaibles\n", "import math\n", "R=53.34\n", "T1=540 #R\n", "n=1.4 #gamma\n", "g=n\n", "n2=1.3 #gamma\n", "P2=90 #psia\n", "P1=15 #psia\n", "cv=0.171\n", "eta=0.95\n", "cp=0.24\n", "#calculations\n", "pv=R*T1\n", "Wk=n*R*T1*(math.pow((P2/P1),((g-1)/g)) -1) /(n-1)\n", "Wn=n2*R*T1*(math.pow((P2/P1),((n2-1)/n2)) -1) /(n2-1)\n", "Wt=R*T1*math.log(P2/P1)\n", "Wx=-Wk/eta\n", "dh=cp*T1*(1.52 - 1)\n", "Q=dh+Wx/778.\n", "#results\n", "print '%s %.1f %s' %(\"Heat transferred =\",Q,\"B/lb\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Heat transferred = -23.8 B/lb\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4 - Pg 395" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the volumetric efficiency\n", "#initialization of varaibles\n", "import math\n", "n=1.3\n", "P1=15. #psia\n", "P2=75. #psia\n", "eta=0.5\n", "eta2=0\n", "#calculations\n", "Pr=math.pow((P2/P1),(1/n))\n", "Cl=(1-eta)/(Pr-1)\n", "Cl2=(1-eta2)/(Pr-1)\n", "#results\n", "print '%s %.3f' %(\"For volumetric efficiency to be 0.5, Clearance = \",Cl)\n", "print '%s %.3f' %(\"\\n For volumetric efficiency to be 0, Clearance = \",Cl2)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "For volumetric efficiency to be 0.5, Clearance = 0.204\n", "\n", " For volumetric efficiency to be 0, Clearance = 0.408\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5 - Pg 398" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Calculate the single stage and two stage efficiencies\n", "#initialization of varaibles\n", "import math\n", "P1=5 #psia\n", "P2=83.5 #psia\n", "n=1.25\n", "per=0.03\n", "#calculations\n", "nv1=1- per*(math.pow((P2/P1),(1/n)) -1)\n", "nv2=1-per*(math.pow((math.sqrt(P2/P1)),(1/n)) -1)\n", "#results\n", "print '%s %.3f' %(\"For single stage machine = \",nv1)\n", "print '%s %.3f' %(\"\\n For Two stage machine = \",nv2)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "For single stage machine = 0.745\n", "\n", " For Two stage machine = 0.937\n" ] } ], "prompt_number": 6 } ], "metadata": {} } ] }