summaryrefslogtreecommitdiff
path: root/Thermodynamics:_From_concepts_to_applications/Chapter11.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Thermodynamics:_From_concepts_to_applications/Chapter11.ipynb')
-rwxr-xr-xThermodynamics:_From_concepts_to_applications/Chapter11.ipynb468
1 files changed, 468 insertions, 0 deletions
diff --git a/Thermodynamics:_From_concepts_to_applications/Chapter11.ipynb b/Thermodynamics:_From_concepts_to_applications/Chapter11.ipynb
new file mode 100755
index 00000000..35f097c3
--- /dev/null
+++ b/Thermodynamics:_From_concepts_to_applications/Chapter11.ipynb
@@ -0,0 +1,468 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:a15297e2995d0ee44a3db61bf50b4aac4f8b03ecce59bf2a69c1f32113289b28"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter11-power and refrigeration cycles"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1-pg 203"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate enthalpy and effieceny and carnot efficency\n",
+ "##initialisation of variables\n",
+ "h1= 251.4 ##kJ/kg\n",
+ "v= 0.001017 ##m^3/kg\n",
+ "p2= 2000. ##Mpa\n",
+ "p1= 20. ##Mpa\n",
+ "h2= 253.4\n",
+ "h3= 3247.6 ##kJ/kg\n",
+ "h4= 2349.3 ##kJ/kg\n",
+ "Tc= 60.06 ##C\n",
+ "Th= 400. ##C\n",
+ "##CALCULATIONS\n",
+ "h2= h1+v*(2-p1)\n",
+ "q12= 0.\n",
+ "w12= h1-h2\n",
+ "q23= h3-h2\n",
+ "w23= 0.\n",
+ "q34= 0.\n",
+ "w34= h3-h4\n",
+ "q41= h1-h4\n",
+ "qnet= q12+q23+q34+q41\n",
+ "wnet= w12+w23+w34\n",
+ "n= wnet/q23\n",
+ "ncarnot= 1-((273.15+Tc)/(273.15+Th))\n",
+ "##RESULTS\n",
+ "print'%s %.1f %s'%('enthalpy=',h2,'kJ/kg')\n",
+ "print'%s %.3f %s'%('efficiency=',n,'')\n",
+ "print'%s %.3f %s'%('carnot efficiency=',ncarnot,'')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "enthalpy= 251.4 kJ/kg\n",
+ "efficiency= 0.300 \n",
+ "carnot efficiency= 0.505 \n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2-pg206"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate work and heat and effiecency and steam mass flow rate\n",
+ "##initialisation of variables\n",
+ "h3= 3247.4 ##kJ/kg\n",
+ "h4= 2439.1 ##kJ/kg\n",
+ "h1= 251.4 ##kJ/kg\n",
+ "h2= 253.9 ##kJ/kg\n",
+ "P= 100000 ##kW\n",
+ "##CALCULATIONS\n",
+ "wnet= h3-h4+h1-h2\n",
+ "qh= h3-h2\n",
+ "qc= h1-h4\n",
+ "n= wnet/qh\n",
+ "m= P/wnet\n",
+ "##RESULTS\n",
+ "print'%s %.f %s'%('work=',wnet,'kJ/kg')\n",
+ "print'%s %.1f %s'% ('heat=',qh,'kJ/kg')\n",
+ "print'%s %.1f %s'%('heat=',qc,'kJ/kg')\n",
+ "print'%s %.4f %s'%('efficiency=',n,'')\n",
+ "print'%s %.2f %s'%('steam mass flow rate=',m,'kg/s')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "work= 806 kJ/kg\n",
+ "heat= 2993.5 kJ/kg\n",
+ "heat= -2187.7 kJ/kg\n",
+ "efficiency= 0.2692 \n",
+ "steam mass flow rate= 124.10 kg/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3-pg 208"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate qualitys and efficiency and mass flow rate and diameter\n",
+ "##initialisation of variables\n",
+ "h11= 2786.2 ##kJ/kg\n",
+ "h12= 340.5 ##kJ/kg\n",
+ "h7= 327.9 ##kJ/kg\n",
+ "h6= 169.0 ##kJ/kg\n",
+ "h10= 756.7 ##kJ/kg\n",
+ "h9= 480.9 ##kJkg\n",
+ "h14= 2818 ##kJ.kg\n",
+ "h15= 762.8 ##kJ/kg\n",
+ "h8= 462.7 ##kJ/kg\n",
+ "h13= 2974.5 ##kJ/kg\n",
+ "h5= 168.8 ##kJ/kg\n",
+ "P= 150. ##kW\n",
+ "v1= 0.02293 ##m^3/kg\n",
+ "v= 40. ##m/s\n",
+ "h1= 3448.6 ##kJ/kg\n",
+ "h3= 3478.5 ##kJ/kg\n",
+ "h2= 2818 ##kJ/kg\n",
+ "h4= 2527.1 ##kJ/kg\n",
+ "##CALCULATIONS\n",
+ "y1= (h10-h9)/(h14-h15)\n",
+ "y2= ((h8-h7)-y1*(h15-h7))/(h13-h7)\n",
+ "y3= (h7-h6)*(1-y1-y2)/(h11-h12)\n",
+ "qin= h1-h10+(1-y1)*(h3-h2)\n",
+ "qout= (h5-h4)*(1-y1-y2)+y3*(h4-h12)\n",
+ "wnet= qin+qout\n",
+ "n= wnet*100/qin\n",
+ "m1= P*1000/wnet\n",
+ "A1= m1*v1/v\n",
+ "D= math.sqrt(4*A1/math.pi)\n",
+ "##RESULTS\n",
+ "print'%s %.4f %s'%(' quality=',y1,'')\n",
+ "print'%s %.4f %s'%('quality=',y2,'')\n",
+ "print'%s %.4f %s'%('quality=',y3,'')\n",
+ "print'%s %.2f %s'%('efficiency=',n,'percent')\n",
+ "print'%s %.2f %s'%('mass flow rate=',m1,'kg/s')\n",
+ "print'%s %.3f %s'%(' diameter=',D,'m')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " quality= 0.1342 \n",
+ "quality= 0.0289 \n",
+ "quality= 0.0544 \n",
+ "efficiency= 43.17 percent\n",
+ "mass flow rate= 106.46 kg/s\n",
+ " diameter= 0.279 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4-pg 213"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate effieciency and power and temperature at the exist\n",
+ "##initialisation of variables\n",
+ "T= 300. ##K\n",
+ "P= 100. ##kPa\n",
+ "r= 4.\n",
+ "T1= 1200. ##K\n",
+ "m= 5. ##kg/s\n",
+ "k= 1.4\n",
+ "R= 8.314 ##jmol K\n",
+ "M= 29. ##gms\n",
+ "##CALCULATIONS\n",
+ "T2= T*math.pow(r,(k-1)/k)\n",
+ "T4= T1/math.pow(r,(k-1)/k)\n",
+ "n= 1-(T/T2)\n",
+ "wnet= (k*R/((k-1)*M))*(T1-T4+T-T2)\n",
+ "P= m*wnet\n",
+ "e= math.sqrt((T2-T)/(T1-T4))\n",
+ "T5= T+((T2-T)/e)\n",
+ "T6= T1+e*(T4-T1)\n",
+ "##RESULTS\n",
+ "print'%s %.4f %s'%('efficiency=',n,'')\n",
+ "print'%s %.f %s'%('power=',P,'kW')\n",
+ "print'%s %.4f %s'%('efficiency=',e,'')\n",
+ "print'%s %.1f %s'%('temperature at the exit=',T6,'K')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "efficiency= 0.3270 \n",
+ "power= 1238 kW\n",
+ "efficiency= 0.6095 \n",
+ "temperature at the exit= 960.8 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5-pg217"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "##initialisation of variables\n",
+ "v= 810. ##km/h\n",
+ "v1= 40. ##m/sec\n",
+ "cp= 1003. ##J/k mol\n",
+ "T0= 300. ##K\n",
+ "ec= 0.88\n",
+ "k= 1.4\n",
+ "T3= 1473.15 ##K\n",
+ "p3= 600. ##kPa\n",
+ "p0= 26.4 ##kPa\n",
+ "e= 0.9\n",
+ "m= 90. ##kg\n",
+ "cp1= 1.003 ##J/mol K\n",
+ "##CALCULATIONS\n",
+ "v0= v*1000/3600.\n",
+ "T1= T0+((v0**2-v1**2)/(2*cp))\n",
+ "T1s= T0+ec*(T0-T1)\n",
+ "p1= 36.79 #kPa\n",
+ "p2= 600 #kPa\n",
+ "T2s= T1*(p2/p1)**((k-1)/k)\n",
+ "T2= T1+((T2s-T1)/ec)\n",
+ "T21= T1+(T2s-T1)/ec\n",
+ "T4= T3+T0-T21\n",
+ "T4s= T3+(T4-T3)/ec\n",
+ "p4= p3*(T4s/T3)\n",
+ "T5s= p4+(p0-p4)*e\n",
+ "W34= m*cp1*(T3-T4)\n",
+ "v5= math.sqrt(v1**2+2*cp*(T4-T5s))\n",
+ "F= m*(v5-v0)\n",
+ "##RESULTS\n",
+ "print'%s %.2f %s'% ('T5=',T4s,'K ')\n",
+ "print'%s %.f %s'% ('Work=',W34,'kW ')\n",
+ "print'%s %.1f %s'% ('nozzle velocity=',v5,'m/s')\n",
+ "print'%s %.f %s'% ('thrust force=',F,'N')\n",
+ "\n",
+ "##ANSWERS GIVEN IN THE TEXTBOOK ARE WRONG\n",
+ "\n",
+ "##RESULTS\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "T5= 934.14 K \n",
+ "Work= 42818 kW \n",
+ "nozzle velocity= 1371.6 m/s\n",
+ "thrust force= 103193 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6-pg225"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate COP and power and COP at given enthalpy\n",
+ "##initialisation of variables\n",
+ "h1= 182.07 ##kJ/kg\n",
+ "h4= 76.26 ##kJ/kg\n",
+ "h2= 217.97 ##kJ/kg\n",
+ "Q= math.pow(10,6) ##kJ/h\n",
+ "Tc= -5 ##C\n",
+ "Th= 32 ##C\n",
+ "##CALCULATIONS\n",
+ "COP= (h1-h4)/(h2-h1)\n",
+ "W= Q/(COP*3600)\n",
+ "COPcarnot= (273.15+Tc)/(Th-Tc)\n",
+ "##RESULTS\n",
+ "print'%s %.3f %s'% ('COP= ',COP,'')\n",
+ "print'%s %.3f %s'% ('power=',W,'KW')\n",
+ "print'%s %.3f %s'% ('COP=',COPcarnot,'')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "COP= 2.947 \n",
+ "power= 94.247 KW\n",
+ "COP= 7.247 \n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7-pg227"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate COPs and WORK at given variable\n",
+ "##initialisation of variables\n",
+ "h1= 183.12 ##kJ/kg\n",
+ "h4= 75.588 ##kJ/kg\n",
+ "h2= 218.697 ##kJ/kg\n",
+ "nm=0.94\n",
+ "Qc= 6 ##kW\n",
+ "h4a= 45.343 ##kJ/kg\n",
+ "h2a= 257.283 ##kJ/kg\n",
+ "h1a= 213.427 ##kJ/kg \n",
+ "##CALCULATIONS\n",
+ "COP= (h1-h4)*nm/(h2-h1)\n",
+ "W= Qc/COP\n",
+ "COP1= (h1-h4a)*nm/(h2a-h1a)\n",
+ "W1= Qc/COP1\n",
+ "##RESULTS\n",
+ "print'%s %.3f %s'% ('COP=',COP,'')\n",
+ "print'%s %.3f %s'% ('COP=',COP1,'')\n",
+ "print'%s %.3f %s'% ('Work=',W,'kW')\n",
+ "print'%s %.3f %s'% ('Work=',W1,'kW')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "COP= 2.841 \n",
+ "COP= 2.953 \n",
+ "Work= 2.112 kW\n",
+ "Work= 2.032 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example8-pg228"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate COP and W\n",
+ "##initialisation of variables\n",
+ "h1= 1404.6 ##kJ/kg\n",
+ "h2s= 1748.9 ##kJ/kg\n",
+ "ec= 0.8\n",
+ "h4= 322.9 ##kJ/kg\n",
+ "h2= 1835 ##kJ/kg\n",
+ "Q= 100 ##kW\n",
+ "h21= 1649.2 ##kJ/kg\n",
+ "h22= 1515 ##kJ/kg\n",
+ "h23= 1678.8 ##kJ/kg\n",
+ "##CALCULATIONS\n",
+ "h2= h1+((h2s-h1)/ec)\n",
+ "COP= (h1-h4)/(h2-h1)\n",
+ "W= Q/COP\n",
+ "COP1= (h1-h4)/(h21-h1+h23-h22)\n",
+ "W1= Q/COP1\n",
+ "##RESULTS\n",
+ "print'%s %.3f %s'% (' COP=',COP,'')\n",
+ "print'%s %.3f %s'% ('COP=',COP1,'')\n",
+ "print'%s %.1f %s'% ('W= ',W,'kW')\n",
+ "print'%s %.1f %s'% ('W=',W1,'kW')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " COP= 2.513 \n",
+ "COP= 2.649 \n",
+ "W= 39.8 kW\n",
+ "W= 37.8 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file