{
 "metadata": {
  "name": "",
  "signature": "sha256:c355c4a09cb727ae470d8c2a8976dd565a7b3a32c7e15c6af67fafe7f2f45dd6"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter18-Non-ideal solutions"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example2-pg 507"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#what is saturation pressure\n",
      "##initialisation of variables\n",
      "T= 80. ##C\n",
      "p= 30. ##percent\n",
      "pw= 47.39 ##kPa\n",
      "psat= 36 ##kPa\n",
      "##RESULTS\n",
      "print'%s %.1f %s'%(' Saturation pressure=',psat,'kPa')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Saturation pressure= 36.0 kPa\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example3-pg 507"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#what is temperature of pure water and saturation pressure\n",
      "##initialisation of variables\n",
      "T= 120. ##C\n",
      "p= 30. ##percent\n",
      "T2= 80. ##C\n",
      "psat= 36. ##kPa\n",
      "Tw= 73. ##C\n",
      "##RESULTS\n",
      "print'%s %.1f %s'% ('Temperature of pure water=',Tw,'C')\n",
      "print'%s %.1f %s'% ('Saturation pressure=',psat,'kPa')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Temperature of pure water= 73.0 C\n",
        "Saturation pressure= 36.0 kPa\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example5-pg 511"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate enthalpys at 4 point and maximum temperature and new enthalpy\n",
      "##initialisation of variables\n",
      "p= 10. ##bar\n",
      "P= 40. ##percent\n",
      "x= 0.4\n",
      "H1= 16. ##kcal/kg\n",
      "H2= 31. ##kcal/kg\n",
      "H3= 64. ##kcal/kg\n",
      "H4= 140. ##kcal/kg\n",
      "T= 157. ##C\n",
      "He= 580. ##kcal/kg\n",
      "##RESULTS\n",
      "print'%s %.f %s'% ('Enthalpy=',H1,'kcal/kg')\n",
      "print'%s %.f %s'% ('Enthalpy=',H2,'kcal/kg')\n",
      "print'%s %.f %s'%  ('Enthalpy=',H3,'kcal/kg')\n",
      "print'%s %.f %s'% ('Enthalpy=',H4,'kcal/kg')\n",
      "print'%s %.f %s'% ('Maximum temperature=',T,'C')\n",
      "print'%s %.f %s'% ('Enthalpy =',He,'kcal/kg')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Enthalpy= 16 kcal/kg\n",
        "Enthalpy= 31 kcal/kg\n",
        "Enthalpy= 64 kcal/kg\n",
        "Enthalpy= 140 kcal/kg\n",
        "Maximum temperature= 157 C\n",
        "Enthalpy = 580 kcal/kg\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example6-pg 517"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#what is enthalpy and circulation ratio and COP and COPcarnot\n",
      "##initialisation of variables\n",
      "v= 0.0011 ##m^3\n",
      "P1= 1200 ##Mpa\n",
      "P2= 140 ##Mpa\n",
      "h5= -103 ##kJ/kg\n",
      "x4= 0.860\n",
      "x7= 0.253\n",
      "x5= 0.337\n",
      "h1= 1658.1 ##kJ/kg\n",
      "h7= 343.7 ##kJ/kg\n",
      "h6= -1008 ##kJ/kg\n",
      "h4= 639. ##kJ/kg\n",
      "h3= 40. ##kJ/kg\n",
      "Tc= -10. ##C\n",
      "Th= 125. ##C\n",
      "Ta= 25. ##C\n",
      "m1= 1. ##kg/s\n",
      "m7= 6.23 ##kg/s\n",
      "m6= 7.23 ##kg/s\n",
      "##CALCULATIONS\n",
      "h6= h5+v*(P1-P2)\n",
      "cr= (x4-x7)/(x5-x7)\n",
      "Qhbym= h1+(m7/m1)*h7-(m6/m1)*h6\n",
      "Qcbym= h4-h3\n",
      "COP= Qcbym/Qhbym\n",
      "COPcarnot= ((273.15+Tc)/(273.15+Th))*((Th-Ta)/(Ta-Tc))\n",
      "##RESULTS\n",
      "print'%s %.1f %s'% (' Enthalpy=',h6,'kJ/kg')\n",
      "print'%s %.3f %s'% (' circulation ratio=',cr,'')\n",
      "print'%s %.3f %s'% (' COP=',COP,'')\n",
      "print'%s %.3f %s'%  (' COP carnot=',COPcarnot,'')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Enthalpy= -101.8 kJ/kg\n",
        " circulation ratio= 7.226 \n",
        " COP= 0.132 \n",
        " COP carnot= 1.888 \n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}