{
 "metadata": {
  "name": "",
  "signature": "sha256:f6da3400e962f069ab8b21139258f5f7cf61e5a3c236ae304fff64bfb1520423"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 18 - Refrigeration"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 347"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the cop, hp required, work of compression and expansion\n",
      "#Initialization of variables\n",
      "Ta=500. #R\n",
      "Tr=540. #R\n",
      "#calculations\n",
      "cop=Ta/(Tr-Ta)\n",
      "hp=4.71/cop\n",
      "print '%s' %(\"From steam tables,\")\n",
      "ha=48.02\n",
      "hb=46.6\n",
      "hc=824.1\n",
      "hd=886.9\n",
      "Wc=-(hd-hc)\n",
      "We=-(hb-ha)\n",
      "#results\n",
      "print '%s %.1f' %(\"Coefficient of performance =\",cop)\n",
      "print '%s %.3f %s' %(\"\\n horsepower required per ton of refrigeration =\",hp,\" hp/ton refrigeration\")\n",
      "print '%s %.1f %s' %(\"\\n Work of compression =\",Wc,\" Btu/lbm\")\n",
      "print '%s %.2f %s' %(\"\\n Work of expansion =\",We,\"Btu/lbm\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From steam tables,\n",
        "Coefficient of performance = 12.5\n",
        "\n",
        " horsepower required per ton of refrigeration = 0.377  hp/ton refrigeration\n",
        "\n",
        " Work of compression = -62.8  Btu/lbm\n",
        "\n",
        " Work of expansion = 1.42 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 349"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the cop\n",
      "#Initialization of variables\n",
      "x=0.8\n",
      "he=26.28 #Btu/lbm\n",
      "hb=26.28 #Btu/lbm\n",
      "pe=98.76 #psia\n",
      "pc=51.68 #psia\n",
      "hc=82.71 #Btu/lbm\n",
      "hf=86.80+0.95\n",
      "#calculations\n",
      "dwisen=-(hf-hc)\n",
      "dwact=dwisen/x\n",
      "hd=hc-dwact\n",
      "cop=(hc-hb)/(hd-hc)\n",
      "#results\n",
      "print '%s %.2f' %(\"Coefficient of performance = \",cop)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coefficient of performance =  8.96\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 351"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the work done, hp required, relative efficiency and mass flow rate, Compressor capacity\n",
      "#Initialization of variables\n",
      "hc=613.3#btu/lbm\n",
      "hb=138.9#btu/lbm\n",
      "ha=138.9#btu/lbm\n",
      "hd=713.4 #btu/lbm\n",
      "ta=464.7 #R\n",
      "t0=545.7 #R\n",
      "v=8.150 #ft^3/lbm\n",
      "#calculations\n",
      "Qa=hc-hb\n",
      "Qr=ha-hd\n",
      "Wcd=Qa+Qr\n",
      "cop=abs(Qa/Wcd)\n",
      "hp=abs(4.71/cop)\n",
      "carnot=abs(ta/(t0-ta))\n",
      "rel=abs(cop/carnot)\n",
      "mass=200/Qa\n",
      "C=mass*v\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Work done =\",Wcd,\"Btu/lbm\")\n",
      "print '%s %.3f %s' %(\"\\n horsepower required per ton of refrigeration =\",hp,\" hp/ton refrigeration\")\n",
      "print '%s %.2f' %(\"\\n Coefficient of performance actual = \",cop)\n",
      "print '%s %.3f' %(\"\\n Ideal cop = \",carnot)\n",
      "print '%s %.3f' %(\"\\n relative efficiency =\",rel)\n",
      "print '%s %.3f %s' %(\"\\n Mass flow rate =\",mass,\"lbm/min ton\")\n",
      "print '%s %.2f %s' %(\"\\n Compressor capacity =\",C,\"cfm/ton\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work done = -100.1 Btu/lbm\n",
        "\n",
        " horsepower required per ton of refrigeration = 0.994  hp/ton refrigeration\n",
        "\n",
        " Coefficient of performance actual =  4.74\n",
        "\n",
        " Ideal cop =  5.737\n",
        "\n",
        " relative efficiency = 0.826\n",
        "\n",
        " Mass flow rate = 0.422 lbm/min ton\n",
        "\n",
        " Compressor capacity = 3.44 cfm/ton\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - Pg 355"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Pressure ratio, Heat, Water make up required and Volume of vapor entering ejector\n",
      "#Initialization of variables\n",
      "pc=0.6982 #psia\n",
      "pe=0.1217 #psia\n",
      "m=200 #gal/min\n",
      "qual=0.98\n",
      "h1=23.07 #Btu/lbm\n",
      "h2=8.05  #Btu/lbm\n",
      "hw=1071.3\n",
      "#calculations\n",
      "rp=pc/pe\n",
      "m2=m/0.01602 *0.1388 #Conversion of units \n",
      "m2=1670\n",
      "dh=15.02\n",
      "Qa=m2*(h1-h2)\n",
      "h3=h2 + qual*hw\n",
      "m3=Qa/(h3-h1)\n",
      "v=0.016+ qual*2444\n",
      "C=m3*v\n",
      "#results\n",
      "print '%s %.2f' %(\"Pressure ratio =\",rp)\n",
      "print '%s %d %s' %(\"\\n Heat =\",Qa,\"Btu/min\")\n",
      "print '%s %.2f %s' %(\"\\n Water make up required =\",m3,\"lbm/min\")\n",
      "print '%s %d %s' %(\"\\n Volume of vapor entering ejector =\",C,\"cfm\")\n",
      "print '%s' %(\"The answers are a bit different due to rounding off error in textbook\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Pressure ratio = 5.74\n",
        "\n",
        " Heat = 25083 Btu/min\n",
        "\n",
        " Water make up required = 24.24 lbm/min\n",
        "\n",
        " Volume of vapor entering ejector = 58054 cfm\n",
        "The answers are a bit different due to rounding off error in textbook\n"
       ]
      }
     ],
     "prompt_number": 1
    }
   ],
   "metadata": {}
  }
 ]
}