{
 "metadata": {
  "name": "",
  "signature": "sha256:59b1fc8c8d34f6daf41da52caf7a93f8b68598a246de207d874cbeb5751e9b6d"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 18: Introduction to Refrigeration and Airconditioning"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1, page no. 838"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable Declaration: \n",
      "Q1 = 500 #Heat extracted by carnot cycle(in kJ/min):\n",
      "T1 = -16+273 #Temperature of refrigerated space(in K):\n",
      "T2 = 27+273 #Atmospheric temperature(in K):\n",
      "\n",
      "#Calculations:\n",
      "Q2 = Q1*(T2/T1) #Heat rejected(in kJ/min):\n",
      "W = Q2-Q1 #Work input required(in kJ/min):\n",
      "\n",
      "#Results: \n",
      "print \"Work input: \",round(W,2),\"kJ/min\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work input:  83.66 kJ/min\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2, page no. 838"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable Declaration: \n",
      "T1 = -5+273 #Operating temperature(in K):\n",
      "T2 = 27+273\n",
      "Cpw = 4.18 #Specific heats(in kJ/kg.K):\n",
      "L = 335 #Latent heat(in kJ/kg):\n",
      "C = 800 #Capacity(in tons):\n",
      "\n",
      "#Calculations:\n",
      "q = C*3.5 #Heat extraction rate(in kJ/s):\n",
      "q1 = Cpw*(27-0)+L #Heat to be removed per kg of water(in kJ/kg):\n",
      "m = q/q1 #Ice formation rate(in kg/s):\n",
      "COP = (T1/(T2-T1)) #COP:\n",
      "W = q/COP/0.7457 #Work done(in hp):\n",
      "\n",
      "\n",
      "print \"Mass rate of ice formation: \",round(m,2),\"kg/s\"\n",
      "print \"HP required: \",round(W,2),\"hp\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass rate of ice formation:  6.25 kg/s\n",
        "HP required:  448.34 hp\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3, page no. 839"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "  \n",
      "#Variable Declaration: \n",
      "W = 3 #Work done(in hp):\n",
      "T1 = -27+273 #Temperature to be maintained(in K):\n",
      "\n",
      "#Calculations:\n",
      "COP = 1*3.5/(W*0.7457)#COP:\n",
      "T2 = T1+T1/COP #Temperature of surroundings(in K):\n",
      "\n",
      "#Results: \n",
      "print \"COP: \",round(COP,2)\n",
      "print \"Temperature of surroundings: \",round(T2,2),\"K\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "COP:  1.56\n",
        "Temperature of surroundings:  403.24 K\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4, page no. 839"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable Declaration: \n",
      "r1 = 8 #Pressure ratio:\n",
      "T1 = -33+273 #Operating temperatures(in K)\n",
      "T3 = 27+273\n",
      "nic = 0.85 #Isentropic efficiency of compression:\n",
      "nie = 0.90 #Isentropic efficiency of expansion:\n",
      "Cp = 1.005 #Specific heat(in kJ/kg):\n",
      "r = 1.4 #Adiabatic index of compression:\n",
      "m = 1  #Air flow rate(in kg/s):\n",
      "\n",
      "#Calculations:\n",
      "T2a = T1*(r1)**((r-1)/r) #Temperature at state 2'(in K):\n",
      "T2 = (T2a-T1)/nic+T1 #Temperature at state 2(in K):\n",
      "T4a = T3*(1/r1)**((r-1)/r) #Temperature at state 4'(in K):\n",
      "T4 = T3-(T3-T4a)*nie #Temperature at state 2'(in K):\n",
      "Wc = Cp*(T2-T1) #Work during compression(in kJ/s):\n",
      "Wt = Cp*(T3-T4) #Work during expansion(in kJ/s):\n",
      "Qref = Cp*(T1-T4) #Refrigeration effect(in kJ/s):\n",
      "W = Wc-Wt #Net work required(in kJ/s):\n",
      "COP = Qref/W #COP:\n",
      "\n",
      "#Results: \n",
      "print \"Refrigeration capacity: \",round(Qref,2),\"kJ/s\"\n",
      "print \"COP: \",round(COP,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Refrigeration capacity:  61.25 kJ/s\n",
        "COP:  0.56\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5, page no. 840"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "   \n",
      "\n",
      "#Variable Declaration: \n",
      "T1 = 7+273 #Operating temperatures(in K)\n",
      "T3 = 27+273\n",
      "p1 = 1 #Pressures(in bar):\n",
      "p2 = 5\n",
      "r = 1.4 #Adiabatic index of compression:\n",
      "Cp = 1.005 #Specific heat(in kJ/kg):\n",
      "T2 = T1*(p2/p1)**((r-1)/r) #Temperature at state 2(in K):\n",
      "T4 = T3/((p2/p1)**((r-1)/r)) #Temperature at state 4(in K):\n",
      "Q23 = Cp*(T2-T3) #Heat rejected in process 2-3(in kJ/kg):\n",
      "Q41 = Cp*(T1-T4) #Heat picked during process 4-1(in kJ/kg):\n",
      "W = Q23-Q41 #Net work(in kJ/kg):\n",
      "COP = Q41/W #COP:\n",
      "\n",
      "#Results: \n",
      "print \"COP: \",round(COP,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "COP:  1.71\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6, page no. 841"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "   \n",
      "\n",
      "#Variable Declaration: \n",
      "p1 = 1 #Pressure(in bar):\n",
      "p2 = 5.5\n",
      "T1 = -10+273 #Operating temperatures(in K):\n",
      "T3 = 27+273\n",
      "m = 0.8 #Air flow rate(in kg/s):\n",
      "Cp = 1.005 #Specific heat(in kJ/kg):\n",
      "r = 1.4 #Adiabatic index of compression:\n",
      "R = 0.287 #Gas constant(in kJ/kg.K):\n",
      "\n",
      "#Calculations:\n",
      "T2 = T1*(p2/p1)**((r-1)/r) #Temperature at state 2(in K):\n",
      "T4 = T3/((p2/p1)**((r-1)/r)) #Temperature at state 4(in K):\n",
      "C = m*Cp*(T1-T4) #Refrigeration capacity(in kJ/s):\n",
      "Wc = m*r/(r-1)*R*(T2-T1) #Work required to run the comoressor(in kJ/s):\n",
      "W = m*Cp*((T2-T3)-(T1-T4)) #Net work input(in kJ/s):\n",
      "COP = C/W #COP:\n",
      "\n",
      "#Results: \n",
      "print \"Refrigeration capacity: \",round(C,2),\"kJ/s\"\n",
      "print \"HP required to run compressor: \",round(Wc/0.7457,2),\"hp\"\n",
      "print \"COP: \",round(COP,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Refrigeration capacity:  63.25 kJ/s\n",
        "HP required to run compressor:  177.86 hp\n",
        "COP:  1.59\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7, page no. 843"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      " \n",
      "\n",
      "#Variable Declaration: \n",
      "p1 = 1.2 #Pressure(in bar):\n",
      "p6 = p1\n",
      "p3 = 4\n",
      "p2 = p3\n",
      "p4 = 1\n",
      "p7 = 0.9\n",
      "T1 = 288 #Temperatures(in K):\n",
      "T6 = T1\n",
      "T5 = 25+273\n",
      "T3 = 323\n",
      "T8 = 30+273\n",
      "n = 1.45\n",
      "n1 = 1.3\n",
      "T2 = T1*(p2/p1)**((n-1)/n) #Temperature at state 2(in K):\n",
      "T2 = 418.47\n",
      "Cp = 1.005\n",
      "\n",
      "#Calculations:    \n",
      "T4 = T3*(p4/p3)**((n1-1)/n1) #Temperature at state 4(in K):\n",
      "T4 = 234.57\n",
      "m = 10*3.5/(Cp*(T5-T4)) #Refrigeration effect(in kg/s):\n",
      "T7 = T6*(p7/p6)**((n1-1)/n1) #Temperature at state 7(in K):\n",
      "rm = m*(T2-T3)/(T8-T7)+m #Ram air mass flow rate(in kg/s):\n",
      "W = m*Cp*(T2-T1) #Work input to the compressor(in kJ/s):\n",
      "COP = 10*3.5/W #COP:\n",
      "\n",
      "#Results: \n",
      "print \"Air mass flow rate in cabin: \",round(m,2),\"kg/s\"\n",
      "print \"Ram air mass flow rate: \",round(rm,2),\"kg/s\"\n",
      "print \"COP: \",round(COP,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Air mass flow rate in cabin:  0.55 kg/s\n",
        "Ram air mass flow rate:  2.11 kg/s\n",
        "COP:  0.486\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8, page no. 844"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable Declaration: \n",
      "p0 = 0.9 #Pressures(in bar):\n",
      "p1 = 1\n",
      "p2 = 4\n",
      "p3 = p2\n",
      "p4 = p3\n",
      "p5 = 1.03\n",
      "T6 = 298 #Temperatures(in K):\n",
      "T0 = 276\n",
      "Cp = 1.005 #Specific heat(in kJ/kg):\n",
      "r = 1.4 #Adiabatic index of compression:\n",
      "C = 15  #Refrigeration capacity:\n",
      "nic = 0.9 #Isentropic efficiency for compressor:\n",
      "nit = 0.8 #Isentropic efficiency for turbine:\n",
      "\n",
      "#Calculations:\n",
      "T1 = T0*(p1/p0)**((r-1)/r) #Temperature at state 1(in K):\n",
      "T2a = T1*(p2/p1)**((r-1)/r) #Temperature at state 2'(in K):\n",
      "T2 = T1+(T2a-T1)/nic #Temperature at state 2(in K):\n",
      "T3 = 0.34*T2 #Temperature at state 3(in K):\n",
      "T4 = T3-10 #Temperature at state 4(in K):\n",
      "T5a = T4*(p5/p4)**((r-1)/r) #Temperature at state 5'(in K):\n",
      "T5 = T4-(T4-T5a)*nit #Temperature at state 5(in K):\n",
      "m = C*3.5/(Cp*(T6-T5)) #Mass flow rate(in kg/s):\n",
      "W = m*Cp*(T2-T1) #Work input(in kJ/s):\n",
      "COP = C*3.5/W #COP:\n",
      "\n",
      "#Results: \n",
      "print \"COP: \",round(COP,2)\n",
      "print \"HP required: \",round(W/0.7457,2),\"hp\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "COP:  1.27\n",
        "HP required:  55.51 hp\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9, page no. 846"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "\n",
      "#Variable Declaration: \n",
      "T1 = -15+273\t\t #Operating temperatures(in K):\n",
      "T2 = 25+273\n",
      "h2 = 1317.95            #kJ/kg  \n",
      "s2 = 4.4809             #kJ/kg.K\n",
      "h3 = 99.94              #kJ/kg\n",
      "s3 = 0.3386             #kJ/kg.K\n",
      "h9 = -54.51             #kJ/kg\n",
      "s9 = -0.2132            #kJ/kg.K\n",
      "s4 = 0.3855             #kJ/kg.K\n",
      "\n",
      "#Calculations:\n",
      "h4 = h3\n",
      "s8 = s3\n",
      "s1 = s2\n",
      "C = T1*(s1-s4)\t\t\t\t      #Refrigeration effect(in kJ/kg):\n",
      "W = h3-h9-T1*(s3-s9)+(T2-T1)*(s1-s8)\t#Work done(in kJ/kg):\n",
      "COP = C/W\t\t\t\t           #COP:\n",
      "\n",
      "#Results: \n",
      "print \"COP: \",round(COP,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "COP:  5.94\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10, page no. 848"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from math import e\n",
      "\n",
      "#Variable Declaration: \n",
      "T1 = -20+273\t\t\t#Operating temperature(in K):\n",
      "T3 = 40+273\n",
      "p2 = 9.61\t\t\t\t#Pressures(in bar):\n",
      "p1 = 1.51\n",
      "n = 1.13\n",
      "N = 1200\t\t\t\t#Speed(in rpm):\n",
      "h1 = 178.61                 #kJ/kg\n",
      "h3 = 73.53                  #kJ/kg\n",
      "h4 = h3\n",
      "s1 = 0.7082                 #kJ/kg.K\n",
      "s2 = s1\n",
      "sg = 0.682                  #kJ/kg.K\n",
      "Cpg = 0.747                 #kJ/kg.K\n",
      "hg = 203.05                 #kJ/kg\n",
      "vg = 0.1088                 #m**3/kg\n",
      "m1 = 2.86                   #ton\n",
      "C = 0.02\t\t\t     #Clearance volume:\n",
      "\n",
      "#Calculations:\n",
      "T2 = T3*(e)**((s1-sg)/Cpg)\t#Temperature of state 2(in K):\n",
      "h2 = hg+Cpg*(T2-T3)\t\t#Enthalpy after compression(in kJ/kg):\n",
      "Wc = h2-h1\t\t\t\t#Compression work(in kJ/kg):\n",
      "r = h1-h4\t\t\t\t#Refrigeration effect(in kJ/kg):\n",
      "m = m1*3.5/r\t\t\t#Mass flow rate(in kg/s):\n",
      "COP = r/Wc\t\t\t\t#COP:\n",
      "nv = 1+C-C*(p2/p1)**(1/n)\t\t\t\t#Volumetric efficiency:\n",
      "V = m*60*vg/(nv*N)\t\t\t\t#Piston printlacement(in m**3):\n",
      "\n",
      "#Results: \n",
      "print \"COP: \",round(COP,3)\n",
      "print \"Piston printlacement: \",round(V*10**6,2),\"cm**3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "COP:  3.205\n",
        "Piston printlacement:  565.05 cm**3\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11, page no. 850"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      " \n",
      "\n",
      "#Variable Declaration: \n",
      "#From steam tables:\n",
      "h1 = 322.28                 #kJ/kg\t\t\t\t\n",
      "h2 = 342.32                 #kJ/kg\n",
      "s2 = 1.1937                 #kJ/kg.K\n",
      "x1 = 0.961\n",
      "h1 = 312.08                 #kJ/kg\n",
      "h3 = 144.11                 #kJ/kg\n",
      "h4 = 115.22                 #kJ/kg\n",
      "m1 = 2\t\t\t\t#Refrigeration effect(in kW):\n",
      "\n",
      "#Calculations:\n",
      "s1 = s2\n",
      "h5 = h4\n",
      "r = h1-h5\t\t\t\t#Refrigeration effect(in kJ/kg):\n",
      "m = m1/r\t\t\t\t#Refrigerant flow rate(in kg/s):\n",
      "Wc = h2-h1\t\t\t\t#Compressor work(in kJ/kg):\n",
      "COP = r/Wc\t\t\t\t#COP:\n",
      "\n",
      "#Results: \n",
      "print \"COP: \",round(COP,2)\n",
      "print \"Mass flow rate: \",round(m,4),\"kg/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "COP:  6.51\n",
        "Mass flow rate:  0.0102 kg/s\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12, page no. 851"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "\n",
      "#Variable Declaration: \n",
      "w = 0.016\t\t\t\t#Specific humidity(in gm/kg):\n",
      "pvsat = 0.03098\t\t\t#Saturated partial pressure of vapour(in bar):\n",
      "pv = w/0.622*1.013/(1+w/0.622)#Partial pressure of vapour(in bar):\n",
      "r = pv/pvsat*100\t\t\t#Relative humidity:\n",
      "\n",
      "#Calculations:\n",
      "print \"Partial pressure of vapour: \",round(pv,4)\n",
      "print \"Relative humidity: \",round(r,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Partial pressure of vapour:  0.0254\n",
        "Relative humidity:  82.0 %\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13, page no. 852"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "\n",
      "\n",
      "#Variable Declaration: \n",
      "r = 0.6\t\t\t\t#Relavite humidity\n",
      "pvsat = 0.0425\t\t\t#Saturation pressure(in bar):\n",
      "R = 0.287\t\t\t\t#Gas constant(in kJ/kg.K):\n",
      "Ta = 303\t\t\t\t#Surrounding temperature(in K):\n",
      "hg = 2504.1                 #kJ/kg\n",
      "Cp = 1.005\t\t\t\t#Specific heat(in kJ/kg.K):\n",
      "T = 21.4 \t\t\t\t#Dew point temperature(in C) from steam table:\n",
      "pv = 0.0255                #partial pressure of vapour(bar)  from steam table:\n",
      "#Calculations:\n",
      "pa = 1.013-r*pvsat\t\t#Partial pressure of air(in bar):\n",
      "w = 0.622*(pv/(1.013-pv))\t#Humidity ratio:\n",
      "d = 1.013*10**2*(1+w)/(R*Ta)\t#Density of mixture(in kg/m**3):\n",
      "h = Cp*30+w*(hg+1.860*(30-T))#Enthalpy of mixture(in kJ/kg of dry air):\n",
      "\n",
      "#Results: \n",
      "print \"Partial pressure of air: \",round(pa,4),\"bar\"\n",
      "print \"Humidity ratio: \",round(w,5),\"jg/kg of dry air\"\n",
      "print \"Dew point temperature: \",round(T,1),\"\u00b0C\"\n",
      "print \"Density: \",round(d,4),\"kg/m**3\"\n",
      "print \"Enthalpy of mixture: \",round(h,1),\"kJ/kg of air\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Partial pressure of air:  0.9875 bar\n",
        "Humidity ratio:  0.01606 jg/kg of dry air\n",
        "Dew point temperature:  21.4 \u00b0C\n",
        "Density:  1.1836 kg/m**3\n",
        "Enthalpy of mixture:  70.6 kJ/kg of air\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14, page no. 852"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "\n",
      "\n",
      "#Variable Declaration: \n",
      "r = 0.80\t\t\t\t#Relavite humidity\n",
      "#From pyschometric chart:\n",
      "w1 = 0.0086                 #kg/kg of air\t\t\t\t\n",
      "w2 = 0.01                   #kg/kg of air\n",
      "h1 = 37                     #kJ/kg\n",
      "h2 = 50                     #kJ/kg\n",
      "v2 = 0.854                  #m**3/kg\n",
      "\n",
      "#Calculations:\n",
      "m = w2-w1\t\t\t\t#Mass of water added between states 1 and 2:\n",
      "ma = r/v2\t\t\t\t#Mass flow rate:\n",
      "m1 = m*ma\t\t\t\t#Total mass of water added(in kg/s):\n",
      "q = ma*(h2-h1)\t\t\t\t#Heat transferred(in kJ/s):\n",
      "\n",
      "#Results: \n",
      "print \"Mass of water added: \",round(m1,6),\"kg/s\"\n",
      "print \"Heat transferred: \",round(q,2),\"kJ/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass of water added:  0.001311 kg/s\n",
        "Heat transferred:  12.18 kJ/s\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15, page no. 853"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "\n",
      "#Variable Declaration: \n",
      "m1 = 3\t\t\t\t#Mass flow rate(in kg/s):\n",
      "m2 = 2\n",
      "Cp = 1.005\t\t\t\t#Specific heat(in kJ/kg.K):\n",
      "Cps = 1.86\t\t\t\t#Specofoc heat of stream(in kJ/kg.K):\n",
      "r1 = 0.30\t\t\t\t#Relative humidity:\n",
      "r2 = 0.85\n",
      "#From psychometric chart:\n",
      "pvsat1 = 0.04246             #bar\t\t\t\t\n",
      "pvsat2 = 0.005628\n",
      "hg1 = 2520.7                 #kJ/kg\n",
      "hg2 = 2559.9                 #kJ/kg\n",
      "T1 = 30                      #\u00b0C\n",
      "Tdp1 = 10.5\n",
      "T2 = 35 \n",
      "Tdp2 = 32\n",
      "\n",
      "#Calculations:\n",
      "pv1 = pvsat1*r1\t\t\t\t#Partial pressure of vapour at 1(in bar):\n",
      "w1 = 0.622*pv1/(1.013-pv1)\t\t#Specific humidity:\n",
      "h1 = Cp*T1+w1*(hg1-Cps*(T1-Tdp1))\t#Enthalpy at state 1(in kJ/kg):\n",
      "pv2 = pvsat2*r2\t\t\t\t#Partial pressure at state 2(in bar):\n",
      "w2 = 0.622*pv2/(1.013-pv2)\t\t#Specific humidity:\n",
      "h1 = Cp*T2+w2*(hg2-Cps*(T2-Tdp2))\t#Enthalpy at state 1(in kJ/kg):\n",
      "mmix = 1/(m1+m2)*(w1*m1/(1+w1)+w2*m2/(1+w2))\t#Mass of vapour:\n",
      "wmix = mmix/(1-mmix)\t\t\t#Specific humidity of mixture:\n",
      "pv = 1.013*wmix/0.622/(1+w1/0.622)\t#Partial pressure of water vapour(in bar):\n",
      "\n",
      "#Results: \n",
      "print \"Specific humidity of mixture: \",round(wmix,5),\"kg/kg of dry air\"\n",
      "print \"Partial pressure of water vapour in mixture: \",round(pv,5),\"bar\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Specific humidity of mixture:  0.00593 kg/kg of dry air\n",
        "Partial pressure of water vapour in mixture:  0.00953 bar\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16, page no. 855"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "\n",
      "\n",
      "#Variable Declaration: \n",
      "r = 3\t\t\t\t#Rate at which air enters(in m**3/s):\n",
      "h1 = 36.4 #kJ/kg\t\t\t\t#From steam tables:\n",
      "h2 = 52 #kJ/kg\n",
      "v1 = 0.825 #m**3/kg\n",
      "\n",
      "#Calculations:\n",
      "m = 3/v1\t\t\t\t#Mass of air(in kg/s):\n",
      "q = m*(h2-h1)\t\t\t\t#Amount of heat added(in kJ/s):\n",
      "\n",
      "#Results: \n",
      "print \"Heat added: \",round(q,2),\"kJ/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat added:  56.73 kJ/s\n"
       ]
      }
     ],
     "prompt_number": 35
    }
   ],
   "metadata": {}
  }
 ]
}