{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 10 - Tabulated Properties : Steam Tables"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 155"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the work and heat of vaporization of water\n",
      "#initialization of varaibles\n",
      "P=100. #psia\n",
      "hfg=888.8 #B/lb\n",
      "#calculations\n",
      "print '%s' %(\"From steam tables,\")\n",
      "vg=4.432 #cu ft/lb\n",
      "vf=0.001774 #cu ft/lb\n",
      "W=P*(vg-vf)*144\n",
      "ufg=807.1 #B/lb\n",
      "W=hfg-ufg\n",
      "sfg=1.1286\n",
      "Q=788*sfg #Heat\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Work done = \",W,\"B/lb\")\n",
      "print '%s %d %s' %(\"\\n Heat of vaporization of water =\",Q,\"B/lb\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From steam tables,\n",
        "Work done =  81.7 B/lb\n",
        "\n",
        " Heat of vaporization of water = 889 B/lb\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 156"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#caclulate the pressure, temperature and enthalpy\n",
      "#initialization of varaibles\n",
      "s=1.6315 #B/lb R\n",
      "#calculations\n",
      "print '%s' %(\"From table 1 \")\n",
      "h=1180.6 #B/lb\n",
      "t=302.92 #F\n",
      "p=70 #psia\n",
      "#results\n",
      "print '%s %d %s' %(\"Pressure = \",p,\"psia\")\n",
      "print '%s %.2f %s' %(\"\\n Temperature =\",t,\"F\")\n",
      "print '%s %.1f %s' %(\"\\n Enthalpy =\",h,\"B/lb\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 1 \n",
        "Pressure =  70 psia\n",
        "\n",
        " Temperature = 302.92 F\n",
        "\n",
        " Enthalpy = 1180.6 B/lb\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 156"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Internal energy of the gas\n",
      "#initialization of varaibles\n",
      "T=250. #F\n",
      "print '%s' %(\"From table 1,\")\n",
      "p=29.825 #psia\n",
      "hg=1164 #B/lb\n",
      "vg=13.821 #cu ft/lb\n",
      "#calculations\n",
      "ug=hg-(p)*144*vg/778.\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Internal energy of the gas = \",ug,\"B/lb\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 1,\n",
        "Internal energy of the gas =  1087.7 B/lb\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - Pg 158"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the specific volume, Enthalpy and Entropy of the gas\n",
      "#initialization of varaibles\n",
      "x=0.4\n",
      "P=100. #psia\n",
      "#calculations\n",
      "y=1-x\n",
      "print '%s' %(\"From table 2,\")\n",
      "vf=0.01774\n",
      "vg=4.432\n",
      "vx=x*vf+y*vg\n",
      "hf=298.4\n",
      "hfg=888.8\n",
      "hx=hf+y*hfg\n",
      "sg=1.6026\n",
      "sfg=1.1286\n",
      "sx=sg-x*sfg\n",
      "#results\n",
      "print '%s %.3f %s' %(\"Specific volume = \",vx,\"cu ft/lb\")\n",
      "print '%s %.1f %s' %(\"\\n Enthalpy =\",hx,\"B/lb\")\n",
      "print '%s %.4f %s' %(\"\\n Entropy = \",sx,\"B/lb R\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 2,\n",
        "Specific volume =  2.666 cu ft/lb\n",
        "\n",
        " Enthalpy = 831.7 B/lb\n",
        "\n",
        " Entropy =  1.1512 B/lb R\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5 - Pg 158"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the enthalpy of the gas\n",
      "#initialization of varaibles\n",
      "x=0.97\n",
      "P=100. #psia\n",
      "#calculations\n",
      "print '%s' %(\"From table 2,\")\n",
      "hf=298.4\n",
      "hfg=888.8\n",
      "hx=hf+x*hfg\n",
      "hg=1187.2\n",
      "hx2=hg-(1-x)*hfg\n",
      "#results\n",
      "print '%s %d %s' %(\"\\n Enthalpy =\",hx,\"B/lb\")\n",
      "print '%s %.1f %s' %(\"\\n Accurate Enthalpy =\",hx2,\"B/lb\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 2,\n",
        "\n",
        " Enthalpy = 1160 B/lb\n",
        "\n",
        " Accurate Enthalpy = 1160.5 B/lb\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6 - Pg 159"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the specific volume and enthalpy of the process\n",
      "#initialization of varaibles\n",
      "s=1.7050 #B/lb R\n",
      "#calculations\n",
      "print '%s' %(\"From table 2,\")\n",
      "sx=1.7050\n",
      "sg=1.7549\n",
      "sfg=1.4415\n",
      "dx=(sg-sx)/sfg\n",
      "hg=1150.8\n",
      "hfg=969.7\n",
      "hx=hg-dx*hfg\n",
      "vg=26.29\n",
      "vfg=26.27\n",
      "vx=vg-dx*vfg\n",
      "#results\n",
      "print '%s %.2f %s' %(\"Specific volume = \",vx,\"cu ft/lb\")\n",
      "print '%s %.1f %s' %(\"\\n Enthalpy =\",hx,\"B/lb\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 2,\n",
        "Specific volume =  25.38 cu ft/lb\n",
        "\n",
        " Enthalpy = 1117.2 B/lb\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7 - Pg 159"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the enthalpy required\n",
      "#initialization of varaibles\n",
      "P=150 #psia\n",
      "T=400 #F\n",
      "#calculations\n",
      "print '%s' %(\"From table 3,\")\n",
      "h=1219.4 #B/lb\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Enthalpy =\",h,\"B/lb\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 3,\n",
        "Enthalpy = 1219.4 B/lb\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8 - Pg 159"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the temperature of steam\n",
      "#initialization of varaibles\n",
      "en=1303.7 #B/lb\n",
      "P=300 #psia\n",
      "#calculations\n",
      "print '%s' %(\"Given hg is less than h, steam is superheated. T=580 F\")\n",
      "T=580 #F\n",
      "#results\n",
      "print '%s %d %s' %(\"Temperature =\",T,\"F\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Given hg is less than h, steam is superheated. T=580 F\n",
        "Temperature = 580 F\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9 - Pg 160"
     ]
    },
    {
     "cell_type": "raw",
     "metadata": {},
     "source": [
      "This is a theoretical example."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10 - Pg 161"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the Enthalpy and Volume of the gas\n",
      "#initialization of varaibles\n",
      "import math\n",
      "T=100. #F\n",
      "P=1000. #psia\n",
      "#calculations\n",
      "print '%s' %(\"From table 4\")\n",
      "dvf=-5.1*math.pow(10,-5)\n",
      "dhf=2.7\n",
      "vf=0.01613\n",
      "hf=67.97\n",
      "v=vf+dvf\n",
      "h=hf+dhf\n",
      "#results\n",
      "print '%s %.2f %s' %(\"Enthalpy =\",h,\"B/lb\")\n",
      "print '%s %.5f %s' %(\"\\n Volume = \",v,\"cu ft/lb\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 4\n",
        "Enthalpy = 70.67 B/lb\n",
        "\n",
        " Volume =  0.01608 cu ft/lb\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11 - Pg 164"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Quality of steam\n",
      "#initialization of varaibles\n",
      "h1=1183.2 #B/lb\n",
      "hg=1198.4 #B/lb\n",
      "hfg=843.\n",
      "#calculations\n",
      "x=1- (hg-h1)/hfg\n",
      "#results\n",
      "print '%s %.3f' %(\"Quality =\",x)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Quality = 0.982\n"
       ]
      }
     ],
     "prompt_number": 11
    }
   ],
   "metadata": {}
  }
 ]
}