{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 : Measured thermodynamic Properties and Other Basic Concepts"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.3  Page No : 28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "P = 1.4 ; \t\t\t# [MPa]\n",
      "T = 333. \t\t\t#[K]\n",
      "T1 = 320. \t\t\t#[K]\n",
      "T2 = 360. \t\t\t#[K]\n",
      "P_low = 1. \t\t\t#[MPa]\n",
      "P_high = 1.5\n",
      "V_cap_T1_P1 = 0.2678\n",
      "V_cap_T2_P1 = 0.2873\n",
      "V_cap_T1_P1_5 = 0.1765\n",
      "V_cap_T2_P1_5 = 0.1899\n",
      "\n",
      "# Calculations\n",
      "#At P = 1 MPa\n",
      "V_cap_T333_P1 = V_cap_T1_P1 + (V_cap_T2_P1 - V_cap_T1_P1)*((T - T1)/(T2- T1))\n",
      "\n",
      "#Similarly at P=1.5 MPa\n",
      "V_cap_T333_P1_5 = V_cap_T1_P1_5 + (V_cap_T2_P1_5 - V_cap_T1_P1_5)*((T - T1)/(T2 - T1))\n",
      "\n",
      "#At T=333*C\n",
      "V_cap_P1_5 = V_cap_T333_P1_5 ;\n",
      "V_cap_P1 = V_cap_T333_P1 ;\n",
      "V_cap_P1_4 = V_cap_P1 + (V_cap_P1_5 - V_cap_P1)*((P - P_low)/(P_high - P_low)) ; \t\t\t#[m**3/kg]\n",
      "\n",
      "# Results\n",
      "print 'Required specific volume = %.5f m**3/kg'%(V_cap_P1_4);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Required specific volume = 0.19951 m**3/kg\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.4  Page No : 29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "P = 1.4 ; \t\t\t#[MPa]\n",
      "P_low = 1 ;\t\t\t#[MPa]\n",
      "P_high = 1.5;\t\t\t#[MPa]\n",
      "\n",
      "#At T=333*C from interpolation we have\n",
      "v_cap_P1_5 = 0.18086 ;\t\t\t#[m**3/kg]\n",
      "v_cap_P1 = 0.27414 ;\t\t\t#[m**3/kg]\n",
      "\n",
      "# Calculations\n",
      "#Molar volume is inversely proportional to pressure\n",
      "v_cap_P1_4 = v_cap_P1 +(v_cap_P1_5 - v_cap_P1)*((1/P - 1/P_low)/(1/P_high - 1/P_low));\n",
      "x=(0.19951-v_cap_P1_4)/v_cap_P1_4*100 ;\n",
      "\n",
      "# Results\n",
      "print 'Specific volume m**3/kg) = %g m**3/kg'%(v_cap_P1_4);\n",
      "print 'Percentage difference = %.1f %%'%(x);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Specific volume m**3/kg) = 0.194186 m**3/kg\n",
        "Percentage difference = 2.7 %\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.5 page no : 29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables\n",
      "V1 =  1             # volume\n",
      "m1 =  2.5          # water\n",
      "Vv = 5.042         # m**3/kg\n",
      "Vt = .001023       # m**3/kg\n",
      "T_44632 = 145      # C\n",
      "T_39278 = 150        # C\n",
      "\n",
      "# Calculations\n",
      "v1 = V1/m1 \n",
      "x1 = (v1 - Vt)/(Vv - Vt)\n",
      "\n",
      "T2 = T_44632 + ( T_39278 - T_44632) * (( 0.4 - 0.44632)/(0.39278 - 0.44632))\n",
      "\n",
      "# Restuls\n",
      "print \"Approximately %.f %% of the mass of water in the vapor\"%(round(x1,2)*100)\n",
      "print \"Temperature T2 = %.1f C\"%T2\n",
      "\n",
      "# Note : Answer in book is wrong. Please calculate manually.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Approximately 8 % of the mass of water in the vapor\n",
        "Temperature T2 = 149.3 C\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}