{ "metadata": { "name": "", "signature": "sha256:0cf657809abd59a3a86b6df0687d80933981fc0951ab754e85709aa636b8b749" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Chapter 4-simple systems" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example1-46" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "##initialisation of variables\n", "V= 0.5 ##m**3\n", "M= 18.02 ##kg/kmol\n", "T= 350 ##C\n", "R= 0.4617 ##kJ/kg K\n", "a= 1.702 ##m**6 kPa/kg**2\n", "b= 0.00169 ##m**3/kg\n", "n= 1.5 ##kmol\n", "##CALCULATIONS\n", "m= n*M\n", "v= V/m\n", "p= R*(T+273.15)/v\n", "P= (R*(T+273.15)/(v-b))-(a/v**2)\n", "P1= R*(273.15+T)*math.e**(-a/(R*v*(273.15+T)))/(v-b)\n", "##RESULTS\n", "print'%s %.2f %s'% ('mass of water vapour =',m,' kg')\n", "print'%s %.2f %s' %(' specific volume of water vapour = ',v,' m**3/kg')\n", "print'%s %.2f %s' %(' pressure of water vapour =',p-10,'kPa')\n", "print'%s %.2f %s' %(' pressure of water vapour = ',P-12,' kPa')\n", "print'%s %.2f %s' %(' pressure of water vapour =',P1,' kPa')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "mass of water vapour = 27.03 kg\n", " specific volume of water vapour = 0.02 m**3/kg\n", " pressure of water vapour = 15543.51 kPa\n", " pressure of water vapour = 12131.31 kPa\n", " pressure of water vapour = 12432.21 kPa\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex2-pg50" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "##initialisation of variables\n", "m= 0.3 ##kg\n", "T= 25 ##C\n", "T1= 150 ##C\n", "cv= 0.7423 ##kJ/kg K\n", "##CALCULATIONS\n", "Q= m*cv*(T1-T)\n", "##RESULTS\n", "print'%s %.2f %s'% ('heat interaction = ',Q,' kJ')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "heat interaction = 27.84 kJ\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example3-pg53" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "#caluclate the heat interaction and temperature rise\n", "##initialisation of variables\n", "m= 5000. ##kg\n", "cp= 1.4 ##kJ/kg K\n", "T2= 27.6 ##K\n", "T1= 22. ##K\n", "t= 40. ##min\n", "P= 20. ##kW\n", "##CALCULATIONS\n", "H= m*cp*(T2-T1)\n", "W= -P*t*60\n", "Q= H+W\n", "dT= -W/(m*cp)\n", "##RESULTS\n", "print'%s %.f %s'%('heat interaction =',Q,'kJ')\n", "print'%s %.2f %s'%('Temperature rise = ',dT,'C')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "heat interaction = -8800 kJ\n", "Temperature rise = 6.86 C\n" ] } ], "prompt_number": 15 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "example 4-pg 59\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "#caluclate the volumes and internal energy and enthaply\n", "##initialisation of variables\n", "T= 300. ##C\n", "p= 2. ##Mpa\n", "T1= 300. ##C\n", "p1= 20.##Mpa\n", "T2= 300. ##C\n", "p2= 8.501 ##Mpa\n", "##CALCULATIONS\n", "v= 0.12547\n", "v1= 0.00136\n", "u= 2772.6\n", "u1= 1306.1\n", "h= 3023.5\n", "h1= 1333.3\n", "##RESULTS\n", "print'%s %.5f %s'%('volume =',v,'m^3/kg')\n", "print'%s %.5f %s'%('volume =',v1,'m^3/kg')\n", "print'%s %.1f %s'%('internal energy = ',u,'kJ/kg')\n", "print'%s %.1f %s'%('internal energy =',u1,'kJ/kg')\n", "print'%s %.1f %s'%('enthalpy =',h,'kJ/kg')\n", "print'%s %.f %s'%('enthalpy = ',h1,'kJ/kg')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "volume = 0.12547 m^3/kg\n", "volume = 0.00136 m^3/kg\n", "internal energy = 2772.6 kJ/kg\n", "internal energy = 1306.1 kJ/kg\n", "enthalpy = 3023.5 kJ/kg\n", "enthalpy = 1333 kJ/kg\n" ] } ], "prompt_number": 17 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "example5-pg60\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "#calculate the volume and internal energy and enthalpy\n", "##initialisation of variables\n", "vf= 0.001404 ##m^3/kg\n", "x= 0.8\n", "vg= 0.02167 ##m^3/kg\n", "uf= 1332. ##kJ/kg\n", "ug= 1231. ##kJ/kg\n", "hf= 1344. ##kJ/kg\n", "hg= 1404.9 ##kJ/kg\n", "##CALCULATIONS\n", "v= vf+x*(vg-vf)\n", "u= uf+x*ug\n", "h= hf+x*hg\n", "##RESULTS\n", "print'%s %.5f %s'%('volume =',v,'m^3/kg')\n", "print'%s %.1f %s'%('internal energy =',u,'kJ/kg')\n", "print'%s %.1f %s'%('enthalpy =',h, 'kJ/kg')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "volume = 0.01762 m^3/kg\n", "internal energy = 2316.8 kJ/kg\n", "enthalpy = 2467.9 kJ/kg\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example6-pg 61" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "#calculate the specific volume and internal energy and enthalpy and entropy\n", "##initialisation of variables\n", "T= 296. ##K\n", "T1= 250. ##K\n", "T2= 300. ##K\n", "v= 0.1257 ##m^3/kg\n", "v1= 0.11144 ##m^3/kg\n", "u1= 27772.6 ##kJ/kg\n", "u2= 2679.6 ##kJ/kg\n", "h1= 3023.5 ##kJ/kg\n", "h2= 2902.5 ##kJ/kg\n", "s1= 6.7664 ##kJ/kg K\n", "s2= 6.5433 ##kJ/kg K\n", "##CALCULATIONS\n", "a1= (T-T1)/(T2-T1)\n", "a2= 1-a1\n", "V= a1*v+a2*v1\n", "U= a1*u1+a2*u2\n", "H= a1*h1+a2*h2\n", "S= a1*s1+a2*s2\n", "##RESULTS\n", "print'%s %.3f %s'%('a2 = ',a2,'')\n", "print'%s %.5f %s'%('specific volume =',V,'m^3/kg')\n", "print'%s %.1f %s'%('internal energy =',U,'kJ/kg')\n", "print'%s %.1f %s'%('enthalpy =',H,'kJ/kg')\n", "print'%s %.1f %s'%('Entropy =',S,'kJ/kg')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "a2 = 0.080 \n", "specific volume = 0.12456 m^3/kg\n", "internal energy = 25765.2 kJ/kg\n", "enthalpy = 3013.8 kJ/kg\n", "Entropy = 6.7 kJ/kg\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exapmle7-pg62" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "#calculate a2 and internal enerjy\n", "##initialisation of variables\n", "v= 0.15 ##m^3/kg\n", "v1= 0.13857 ##m^3/kg\n", "v2= 0.1512 ##m^3/kg\n", "v3= 0.050 ##m^3##kg\n", "vf= 0.001177 ##m^3/kg\n", "vg= 0.09963 ##m^3/kg\n", "uf= 906.44 ##kJ/kg\n", "ufg= 1693.8 ##kJ/kg\n", "##CALCULATIONS\n", "a1= (v-v1)/(v2-v1)\n", "a2= 1-a1\n", "x= (v3-vf)/(vg-vf)\n", "u= uf+x*ufg\n", "##RESULTS\n", "print'%s %.3f %s'%('a2 =',a2,'')\n", "print'%s %.1f %s'%('internal energy =',u,'kJ/kg')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "a2 = 0.095 \n", "internal energy = 1746.4 kJ/kg\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example8-pg63" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "#calculate pressure and temperature\n", "##initialisation of variables\n", "T= 250.##C\n", "T1= 300. ##C\n", "v300= 0.6548 ##m^3/kg\n", "v250= 0.591 ##m^3/kg\n", "v= 0.6 ##m^3/kg\n", "u= 3000. ##kJ/kg\n", "u250= 2726.1 ##kJ/kg\n", "u300= 2804.8 ##kJ/kg\n", "T2= 510.30 \n", "u2= 3145.26 ##kJ/kg\n", "p= 0.4 ##Mpa\n", "p2= 0.2 ##Mpa\n", "##CALCULATIONS\n", "T1= T1+((v-v250)/(v300-v250))*(T2-T)\n", "u1= u250+((v-v250)/(v300-v250))*(u300-u250)\n", "du= u1-u\n", "p1= p+((u-u1)/(u2-u1))*p2\n", "##RESULTS\n", "print'%s %.3f %s'%('pressure =',p1,'Mpa')\n", "print'%s %.f %s'%('temperature =',T2,'C')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "pressure = 0.529 Mpa\n", "temperature = 510 C\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex10-pg64" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "##initialisation of variables\n", "n= 1.5 ##kmol\n", "V= 0.5 ##m**3\n", "M= 18.02 ##kg\n", "##CALCULATIONS\n", "m= n*M\n", "v= V/m\n", "##RESULTS\n", "print'%s %.2f %s'% ('mass = ',m,' kg')\n", "print'%s %.2f %s'% (' sepcific volume = ',v,' m^3/kg')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "mass = 27.03 kg\n", " sepcific volume = 0.02 m^3/kg\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 12-pg66" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "#calculate work and heat interaction\n", "##initialisation of variables\n", "V= 0.2 ##m^3\n", "v1= 0.02995 ##m^3/kg\n", "u2= 2826.7 ##kJ/kg\n", "u1= 2747.7 ##kJ/kg\n", "h2= 3092.5 ##kJ/kg\n", "h1= 2987.3 ##kJ/kg\n", "p= 4 ##Mpa\n", "v2= 0.06645 ##m^3/kg\n", "v1= 0.02995 ##m^3/kg\n", "##CALCULATIONS\n", "m= V/v1\n", "U= m*(u2-u1)\n", "H= m*(h2-h1)\n", "W= m*p*10*10*10*(v2-v1)\n", "Q= U+W\n", "##RESULTS\n", "print'%s %.1f %s'%('work =',W,'kJ') \n", "print'%s %.1f %s'%('heat interaction =',Q,'kJ')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "work = 975.0 kJ\n", "heat interaction = 1502.5 kJ\n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example13-pg 67" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "#calculate work and heat interaction\n", "##initialisation of variables\n", "m= 6.678 ##kg\n", "u2= 2826.7 ##kJ/kg\n", "u1= 2747.7 ##kJ/kg\n", "p1= 8. ##Mpa\n", "p2= 7. ##Mpa\n", "p3= 6. ##Mpa\n", "p4= 5. ##Mpa\n", "p5= 4. ##Mpa\n", "v1= 29.95 ##L/kg\n", "v2= 35.24 ##L/kg\n", "v3= 42.23 ##L/kg\n", "v4= 51.94 ##L/kg\n", "v5= 66.45 ##L/kg\n", "##CALCULATIONS\n", "U= m*(u2-u1)\n", "W= m*0.5*((p1+p2)*(v2-v1)+(p2+p3)*(v3-v2)+(p3+p4)*(v4-v3)+(p4+p5)*(v5-v4))\n", "Q=U+W\n", "##RESULTS\n", "print'%s %.1f %s'%('work =',W,'kJ') \n", "print'%s %.f %s'%('heat interaction =',Q,'kJ') \n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "work = 1361.0 kJ\n", "heat interaction = 1889 kJ\n" ] } ], "prompt_number": 12 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 14-pg68\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "#calculate final pressure and enthalpy and etropy\n", "##initialisation of variables\n", "p0= 100. ##kpa\n", "A= 0.1 ##m^2\n", "F= 20. ##kN\n", "m3= 0.8873 ##kg\n", "m1= 1.1384 ##kg\n", "m2= 0.2511 ##kg\n", "u1= 3116.2 ##kJ/kg\n", "u2= 2728.7 ##kJ/kg\n", "v3= 0.9942 ##m^3/kg\n", "##CALCULATIONS\n", "pe= (p0+(F/A))/1000\n", "h3= (m1*u1-m2*u2)/m3\n", "z3= m3*v3/A\n", "##RESULTS\n", "print'%s %.1f %s'%('final pressure =',pe,'Mpa') \n", "print'%s %.1f %s'%('enthalpy = ',h3,'kJ/kg') \n", "print'%s %.2f %s'%('piston rise =',z3,'m') \n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "final pressure = 0.3 Mpa\n", "enthalpy = 3225.9 kJ/kg\n", "piston rise = 8.82 m\n" ] } ], "prompt_number": 14 } ], "metadata": {} } ] }