{
 "metadata": {
  "name": "",
  "signature": "sha256:4ce5546be38472485072968c27d4c6ae7f7b124c1af2a44e7388dbd36c855f4b"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 22 - Refrigeration"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 476"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the refrigerator and heat pump cp values in both cases\n",
      "#Initalization of variables\n",
      "t1=45+460. #R\n",
      "th=70+460. #R\n",
      "t2=-200+460. #R\n",
      "th2=100+460. #R\n",
      "#calculations\n",
      "cp1=t1/(th-t1)\n",
      "cp2=th/(th-t1)\n",
      "cp3=t2/(th2-t2)\n",
      "cp4=th2/(th2-t2)\n",
      "#results\n",
      "print '%s %.1f' %(\"In case 1, Refrigerator cp = \",cp1)\n",
      "print '%s %.1f' %(\"\\n In case 1, Heat pump cp = \",cp2)\n",
      "print '%s %.3f' %(\"\\n In case 2, Refrigerator cp = \",cp3)\n",
      "print '%s %.3f' %(\"\\n In case 2, Heat pump cp = \",cp4)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "In case 1, Refrigerator cp =  20.2\n",
        "\n",
        " In case 1, Heat pump cp =  21.2\n",
        "\n",
        " In case 2, Refrigerator cp =  0.867\n",
        "\n",
        " In case 2, Heat pump cp =  1.867\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 479"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the coefficient of performance in wet and dry compression\n",
      "#Initalization of variables\n",
      "h3=85.282 #Btu/lb\n",
      "s2=0.16392\n",
      "sf=0.16798\n",
      "#calculations\n",
      "sfg=sf-0.023954\n",
      "x3=-(s2-sf)/sfg\n",
      "h2=78.335 - x3*67.651\n",
      "h4=26.365 #Btu/lb\n",
      "h1=h4\n",
      "ref=h2-h1\n",
      "work=h3-h2\n",
      "cp1=ref/work\n",
      "h2d=78.355\n",
      "h1d=26.365 #Btu/lb\n",
      "h3d=87.495 #Btu/lb\n",
      "ref2=h2d-h1d\n",
      "work2=h3d-h2d\n",
      "cp2=ref2/work2\n",
      "#results\n",
      "print '%s %.3f' %(\"\\n Coefficient of performance in wet compression = \",cp1)\n",
      "print '%s %.3f' %(\"\\n Coefficient of performance in dry compression = \",cp2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " Coefficient of performance in wet compression =  5.654\n",
        "\n",
        " Coefficient of performance in dry compression =  5.688\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 480"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the tonnage value in both cases\n",
      "#Initalization of variables\n",
      "h1=24.973 #Btu/lb\n",
      "h2=81.436 #Btu/lb\n",
      "cfm=200 #cfm\n",
      "v2=0.77357\n",
      "v3=3.8750\n",
      "h4=72.913\n",
      "#calculations\n",
      "mass=cfm/v2\n",
      "ref=h2-h1\n",
      "tonnage=mass*ref/cfm\n",
      "mass2=cfm/v3\n",
      "ref2=h4-h1\n",
      "tonnage2=mass2*ref2/cfm\n",
      "#results\n",
      "print '%s %.1f %s' %(\"In case 1,Tonnage =\",tonnage,\" tons\")\n",
      "print '%s %.2f %s' %(\"\\n In case 2,Tonnage =\",tonnage2,\" tons\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "In case 1,Tonnage = 73.0  tons\n",
        "\n",
        " In case 2,Tonnage = 12.37  tons\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - Pg 481"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the refirgeration, shaft hp and cop\n",
      "#Initalization of variables\n",
      "h2d=93.410 #Btu/lb\n",
      "h1=80.740 #Btu/lb\n",
      "x=0.75\n",
      "PD=160\n",
      "vol=0.82\n",
      "v1=1.7213\n",
      "w2=80.156\n",
      "w1=27.3\n",
      "#calculations\n",
      "twork=h2d-h1\n",
      "swork=twork/x\n",
      "flow=PD*vol/v1\n",
      "ref=flow*(w2-w1)/200.\n",
      "shp= flow*swork/42.4\n",
      "cop=(w2-w1)/swork\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Refrigeration =\",ref,\" tons\")\n",
      "print '%s %.1f %s' %(\"\\n Shaft hp=\",shp,\" hp\")\n",
      "print '%s %.2f' %(\"\\n Coefficient of performance = \",cop)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Refrigeration = 20.1  tons\n",
        "\n",
        " Shaft hp= 30.4  hp\n",
        "\n",
        " Coefficient of performance =  3.13\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5 - Pg 488"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the cop\n",
      "#Initalization of variables\n",
      "mc=3000 #lb\n",
      "hv=1080.2 #Btu/lb\n",
      "hfe=26.06 #Btu/lb\n",
      "hfp=10.05 #Btu/lb\n",
      "x=0.7\n",
      "#calculations\n",
      "mv=(mc*hfp-mc*hfe)/(hfe-hv)\n",
      "dh=145.4 #Btu/lb\n",
      "chp=dh*mv/(x*42.4)\n",
      "cop=mc*(hfe-hfp)/(chp*42.4)\n",
      "#results\n",
      "print '%s %.2f' %(\"Coefficient of performace = \",cop)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coefficient of performace =  5.07\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6 - Pg 493"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the power required\n",
      "#Initalization of variables\n",
      "loss=80000. #Btu/lb\n",
      "t=560. #R\n",
      "#calculations\n",
      "ratio=t/68.\n",
      "power=loss/(ratio*2544.)\n",
      "#results\n",
      "print '%s %.2f %s' %(\"Power = \",power,\" hp\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power =  3.82  hp\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7 - Pg 493"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the power required\n",
      "#Initalization of variables\n",
      "loss=2*80000. #Btu/lb\n",
      "tb=72. #F\n",
      "to=12. #F\n",
      "to2=42. #F\n",
      "tf=104.+460 #R\n",
      "#calculations\n",
      "ratio=tf/(tf-460.)\n",
      "power=loss/(2544.*ratio)\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Power =\",power,\" hp\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power = 11.6  hp\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}