diff options
Diffstat (limited to 'Thermodynamics_Demystified/Chapter7.ipynb')
-rwxr-xr-x | Thermodynamics_Demystified/Chapter7.ipynb | 624 |
1 files changed, 624 insertions, 0 deletions
diff --git a/Thermodynamics_Demystified/Chapter7.ipynb b/Thermodynamics_Demystified/Chapter7.ipynb new file mode 100755 index 00000000..0c094e5b --- /dev/null +++ b/Thermodynamics_Demystified/Chapter7.ipynb @@ -0,0 +1,624 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:af523f2f43fc72634028758c968b85e1c9f7441276d72a4c6af9da09cd0eee6e"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 7:Power and Refrigeration Gas Cycles"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.1:PG-175"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "r=12 # compression ratio\n",
+ "k=1.4 # polytropic index for air\n",
+ "p1=200.0 # pressure at state 1 in kPa\n",
+ "p3=10000.0 # pressure at state 3 in kPa\n",
+ "\n",
+ "c=100/(r-1) # clearance in percentage\n",
+ "print \"The percent clearance is\",round(c,2),\"% \\n\"\n",
+ "v3=100.0 # let us assume v3=100 m^3 for calculations\n",
+ "p2=p1*(r**k) # polytopic process pressure relation\n",
+ "p4=p3*(1/(r**k))# polytropic process pressure relation\n",
+ "w34=v3*(r*p4-p3)/(1-k) # polytropic work done in process 3 to 4\n",
+ "v2=v3 # constant volume process\n",
+ "w12=v2*(p2-r*p1)/(1-k)\n",
+ "wcycle=w12+w34 # total work in cycle\n",
+ " # now equating the polytropic work calculated to work by MEP\n",
+ "MEP=wcycle/(r*v2-v2) # as work = pressure*change in volume\n",
+ "print \"The MEP is\",round(MEP),\" kPa\" \n",
+ "# The solution is wrong in textbook as calculation for P2 is wrong \n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The percent clearance is 9.0 % \n",
+ "\n",
+ "The MEP is 503.0 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.2:PG-179"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "r=10.0 # compression ratio\n",
+ "k=1.4 # polytropic index for air\n",
+ "R=0.287 # specific gas constant for air\n",
+ "Cv=0.717 # specific heat at constant volume\n",
+ "Wnet=1000 # net work output in kJ/kg\n",
+ "T1=227+273.0 # low air temperaure in kelvin\n",
+ "p1=200.0 # low pressure in kPa\n",
+ "\n",
+ "effi=1-(1/r**(k-1)) # thermal efficeiency \n",
+ "print \"The maximum possible thermal efficiency is\",round(effi*100,1),\"% \\n\"\n",
+ "\n",
+ "T2=T1*(r)**(k-1) # isentropic process temperature relation\n",
+ "\n",
+ "T4=((Wnet/Cv)+T2-T1)/((r**(k-1))-1) # using expression for work\n",
+ "\n",
+ "T3=T4*(r)**(k-1)\n",
+ "\n",
+ "efficarnot=1-T1/T3\n",
+ "print \"The carnot efficiency is\",round(efficarnot*100),\"%\"\n",
+ "\n",
+ "v1=R*T1/p1 # initial volume \n",
+ "v2=v1/r # from compression ratio\n",
+ "\n",
+ "MEP=Wnet/(v1-v2) # mean effective pressure equation\n",
+ "\n",
+ "print \"The MEP is\",round(MEP),\" kPa\"\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The maximum possible thermal efficiency is 60.2 % \n",
+ "\n",
+ "The carnot efficiency is 86.0 %\n",
+ "The MEP is 1549.0 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.3:PG-182"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "\n",
+ "r=18 # compression ratio\n",
+ "k=1.4 # polytropic index for air\n",
+ "R=0.287 # specific gas constant for air\n",
+ "Cv=0.717 # specific heat at constant volume\n",
+ "Cp=1.0 # specific heat at constant pressure\n",
+ "T1=200+273 # lower temperaure in kelvin\n",
+ "P1=200.0 # low pressure in kPa\n",
+ "T3=2000 # higher temperature of cycle in kelvin\n",
+ "\n",
+ "v1=R*T1/P1 # specific volume at state 1 in m^3\n",
+ "v2=v1/r # specific volume after compression in m^3\n",
+ "\n",
+ "T2=T1*(v1/v2)**(k-1) # temperature after compression\n",
+ "P2=P1*(v1/v2)**k # pressure after compression\n",
+ "P3=P2 # diesel cycle\n",
+ "v3=R*T3/P3 # volume at state 3\n",
+ "\n",
+ "rc=v3/v2 # cutoff ratio\n",
+ "\n",
+ "effi=1-((rc**k)-1)/(r**(k-1)*k*(rc-1))\n",
+ "\n",
+ "\n",
+ "print \"The thermal efficiency is\",round(effi*100,1),\"%\"\n",
+ "\n",
+ "v4=v1 # diesel cycle\n",
+ "T4=T3*(v3/v4)**(k-1) # adiabatic process\n",
+ "\n",
+ "qin=Cp*(T3-T2) # using first law \n",
+ "qout=Cv*(T4-T1) # heat rejected \n",
+ "\n",
+ "Wnet=qin-qout # net work\n",
+ "MEP=Wnet/(v1-v2) # expression of mean effective pressure in terms of work\n",
+ "\n",
+ "print \"The MEP is\",round(MEP),\" kPa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The thermal efficiency is 66.6 %\n",
+ "The MEP is 515.0 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.4:PG-183"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "r=18 # compression ratio\n",
+ "k=1.4 # polytropic index for air\n",
+ "R=0.287 # specific gas constant for air\n",
+ "T1=200+273 # lower temperaure in kelvin\n",
+ "P1=200.0 # low pressure in kPa\n",
+ "T3=2000.0 # higher temperature of cycle in kelvin \n",
+ "\n",
+ "v1=R*T1/P1 # specific volume at state 1 in m^3\n",
+ "#using table E.1\n",
+ "u1=340.0 # specific internal energy in kJ/kg\n",
+ "vr1=198.1 # in m^3/kg\n",
+ "\n",
+ "vr2=vr1*(1/r) # as r=v1/v2\n",
+ "\n",
+ "# now finding corresponding values from table E.1\n",
+ "T2=1310.0 # temperature in kelvin\n",
+ "Pr2=34.0 # pressure in kPa\n",
+ "h2=1408.0 # specific entropy in kJ/kg\n",
+ "v2=v1/18 # volume at state 2\n",
+ "P2=R*T2/v2 # pressure at state 2\n",
+ "\n",
+ "h3=2252.1 # specific enthalpy in kJ/kg from table E.1\n",
+ "vr3=2.776 \n",
+ "P3=P2 # diesel cycle\n",
+ "v3=R*T3/P3 # after compression volume\n",
+ "v4=v1 # isochoric process\n",
+ "vr4=vr3*v4/v3 # isentropic process\n",
+ "# now using Vr4 we read corresponding value from table E.1\n",
+ "T4=915 # final temperature in kelvin\n",
+ "u4=687.5 # specific internal energy at state 4\n",
+ "\n",
+ "qin=h3-h2 # using first law \n",
+ "qout=u4-u1 # heat rejected \n",
+ "\n",
+ "Wnet=qin-qout # net work\n",
+ "effi=100*Wnet/qin # thermal efficiency\n",
+ "print\" The thermal efficiency is\",round(effi,1),\"%\"\n",
+ "\n",
+ "MEP=Wnet/(v1-v2) # expression of mean effective pressure in terms of work\n",
+ "\n",
+ "print \" The MEP is\",round(MEP),\" kPa\"\n",
+ "\n",
+ "erroreffi=(66.6-effi)*100/effi # error in efficiency\n",
+ "errorMEP=(515-MEP)*100/MEP # error in MEP\n",
+ "\n",
+ "print \" The % error in efficiency is\",round(erroreffi,1),\"%\"\n",
+ "print \" The % error MEP is\",round(errorMEP,1),\"% \\n\"\n",
+ "\n",
+ "# the answers are slight different due to approximation in textbook ... here answers are precise\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The thermal efficiency is 58.8 %\n",
+ " The MEP is 775.0 kPa\n",
+ " The % error in efficiency is 13.2 %\n",
+ " The % error MEP is -33.5 % \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.5:PG-186"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "Cp=1.0 # specific heat at constant pressure\n",
+ "k=1.4 # polytropic index for air\n",
+ "T1=25+273.0 # temperature at compressor inlet\n",
+ "T3=850+273.0 # maximum temperature in kelvin\n",
+ "\n",
+ "r=5.0 # pressure ratio=P2/P1 & P4/P3\n",
+ "\n",
+ "T2=T1*(r)**((k-1)/k) # temperature after compression\n",
+ "\n",
+ "T4=T3*(1/r)**((k-1.0)/k) # final temperature\n",
+ "\n",
+ "Wcomp=Cp*(T2-T1) # compressor work\n",
+ "Wturb=Cp*(T3-T4) # turbine work\n",
+ "\n",
+ "BWR=Wcomp/Wturb # back work ratio\n",
+ "\n",
+ "print \" The BWR is\",round(BWR*100,1),\"%\\n\" \n",
+ "\n",
+ "Effi=1-r**((1-k)/k) # thermal efficiency\n",
+ "\n",
+ "print\" The thermal efficiency is\",round(Effi*100,1),\"%\"\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The BWR is 42.0 %\n",
+ " The thermal efficiency is 36.9 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.6:PG-186"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "Cp=1.0 # specific heat at constant pressure\n",
+ "k=1.4 # polytropic index for air\n",
+ "T1=25+273.0 # temperature at compressor inlet\n",
+ "T3=850+273.0 # maximum temperature in kelvin\n",
+ "\n",
+ "r=5.0 # pressure ratio=P2/P1 & P4/P3\n",
+ "efficomp=0.75 # efficiency of compressor\n",
+ "effiturb=0.75 # efficiency of turbine\n",
+ "\n",
+ "T2dash=T1*(r)**((k-1)/k) # temperature after compression\n",
+ "Wcomp=Cp*(T2dash-T1)/efficomp # compressor work\n",
+ "\n",
+ "T4dash=T3*(1/r)**((k-1)/k) # final temperature\n",
+ "Wturb=Cp*(T3-T4dash)*effiturb # turbine work\n",
+ "\n",
+ "BWR=100*Wcomp/Wturb # back work ratio\n",
+ "\n",
+ "print \" The BWR is\",round(BWR,1),\"%\\n\"\n",
+ "\n",
+ "T2=(Wcomp/Cp)+T1 # actual temperature of state 2\n",
+ "\n",
+ "qin=Cp*(T3-T2) # using first law \n",
+ "\n",
+ "Wnet=(Wturb-Wcomp) # net work\n",
+ "\n",
+ "effi=100*Wnet/qin # thermal efficiency\n",
+ "print\" The thermal efficiency is\",round(effi,1),\"%\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The BWR is 74.7 %\n",
+ " The thermal efficiency is 13.2 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.7:PG-191"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "Cp=1.0 # specific heat at constant pressure\n",
+ "k=1.4 # polytropic index for air\n",
+ "T1=25+273.0 # temperature at compressor inlet\n",
+ "T3=850+273.0 # maximum temperature in kelvin\n",
+ "\n",
+ "r=5.0 # pressure ratio=P2/P1 & P4/P3\n",
+ "\n",
+ "T2=T1*(r)**((k-1)/k) # temperature after compression\n",
+ "\n",
+ "T4=T3*(1/r)**((k-1)/k) # final temperature\n",
+ "\n",
+ "Wcomp=Cp*(T2-T1) # compressor work\n",
+ "Wturb=Cp*(T3-T4) # turbine work\n",
+ "\n",
+ "BWR=Wcomp/Wturb # back work ratio\n",
+ "\n",
+ "print \" The BWR is\",round(BWR,2),\"\\n\"\n",
+ "\n",
+ "effi=(1-((T1/T4)*(r**((k-1)/k))))# efficiency\n",
+ "print\" The thermal efficiency is\",round(effi*100,1),\"%\"\n",
+ "# The solution in textbook is incorrect due to wrong value of T4 (temperature at state 4)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The BWR is 0.42 \n",
+ "\n",
+ " The thermal efficiency is 33.4 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 41
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.8:PG-193"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "#REFER TO FIG.:7.8\n",
+ "\n",
+ "Cp=1 # specific constant at constant pressure\n",
+ "k=1.4 # polytropic constant for air\n",
+ "T5=25+273.0 # temperature at state 5 in kelvin\n",
+ "T7=850+273.0 # temperature at state 4 in kelvin\n",
+ "T9=350 # exit temperature of water from bolier in kelvin\n",
+ "WdotST=100000.0 # power from steam turbine in Watt\n",
+ "r=5.0 # pressure ratio=P2/P1 & P4/P3\n",
+ "\n",
+ "h1=192.0 # specific enthalpy at 10 Kpa from steam table\n",
+ "h2=h1 # isenthalpic process\n",
+ "h3=3214.0 # specific enthalpy at 4 Mpa and 400 degree celsius from steam table\n",
+ "s3=6.769 # specific entropy at 4 Mpa and 400 degree celsius from steam table\n",
+ "\n",
+ "s4=s3 # isentropic process\n",
+ "sf=0.6491 # specific entropy of saturated liquid at 10 kPa and 45 degree celsiusfrom table C.2\n",
+ "sg=8.1510 # specific entropy of saturated liquid at 10 kPa and 45 degree celsiusfrom table C.2\n",
+ "x4=(s4-sf)/(sg-sf) # quality of steam\n",
+ "\n",
+ "hf=h1 # specific enthalpy of saturated liquid @ 10 Kpa \n",
+ "hg=2584.6\n",
+ "h4=hf+x4*(hg-hf) # specific entropy at state 4\n",
+ "\n",
+ "mdots=WdotST/(h3-h4) # steam mass flow rate from turbine output\n",
+ "\n",
+ "T6=T5*(r**((k-1)/k)) # adiabatic process relation\n",
+ "T8=T7*(1/r**((k-1)/k)) # adiabatic process relation\n",
+ "\n",
+ "# Now using energy balance in boiler\n",
+ "mdota=mdots*(h3-h2)/(Cp*(T8-T9)) # mass flow rate of water\n",
+ "\n",
+ "Wdotturb=mdota*Cp*(T7-T8) # power produced by turbine\n",
+ "\n",
+ "Wdotcomp=mdota*Cp*(T6-T5) # energy needed by compressor\n",
+ "\n",
+ "WdotGT=Wdotturb-Wdotcomp # net turbine work\n",
+ "\n",
+ "Qdotin=mdota*Cp*(T7-T6) # energy input by combustor\n",
+ "\n",
+ "effi=100*(WdotST+WdotGT)/Qdotin # combined efficiency\n",
+ "\n",
+ "print \"The thermal efficiency of the combined cycle is\",round(effi,1),\"%\"\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The thermal efficiency of the combined cycle is 56.4 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 45
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.9:PG-196"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "Cp=1 # specific constant at constant pressure\n",
+ "k=1.4 # polytropic constant for air\n",
+ "r=10.0\n",
+ "T2=-10+273 # temperature at entry of compressor\n",
+ "T4=30+273 # temperature at entry of turbine\n",
+ "\n",
+ "T3=T2*(r**((k-1)/k)) # temperature at state 3 in kelvin\n",
+ "T1=T4*(1/r**((k-1)/k)) # temperature at state 1 in degree celsius\n",
+ "print \"The minimum temperature is\",round(T1-273),\"degree celsius \\n\"\n",
+ "\n",
+ "qin=Cp*(T2-T1) # heat input\n",
+ "Wcomp=Cp*(T3-T2)# compressor work\n",
+ "Wturb=Cp*(T4-T1) # turbine work\n",
+ "\n",
+ "COP=qin/(Wcomp-Wturb) # COP of refrigeration\n",
+ "print\" The COP is\",round(COP,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The minimum temperature is -116.0 degree celsius \n",
+ "\n",
+ " The COP is 1.07\n"
+ ]
+ }
+ ],
+ "prompt_number": 48
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.10:PG-196"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#solution\n",
+ "# initialization of variables\n",
+ "\n",
+ "Cp=1.0 # specific constant at constant pressure\n",
+ "k=1.4 # polytropic constant for air\n",
+ "r=10.0\n",
+ "T3=-10+273 # temperature at entry of compressor\n",
+ "T6=-40+273 # temperature at entry of turbine\n",
+ "\n",
+ "T5=T3 # heat exchanger\n",
+ "T2=T6 # heat exchanger\n",
+ "\n",
+ "T4=T3*(r**((k-1)/k)) # temperature after compression\n",
+ "T1=T6*(1/r**((k-1)/k)) # temperature after exit from turbine\n",
+ "\n",
+ "print \"The minimum temperature is\",round(T1-273),\"degree celsius \\n\"\n",
+ "\n",
+ "qin=Cp*(T2-T1) # heat input\n",
+ "Wcomp=Cp*(T4-T3)# compressor work\n",
+ "Wturb=Cp*(T6-T1) # turbine work\n",
+ "\n",
+ "COP=qin/(Wcomp-Wturb) # COP of refrigeration\n",
+ "\n",
+ "print\" The COP is\",round(COP,3)\n",
+ "\n",
+ "# the answer is correct within given limits\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The minimum temperature is -152.0 degree celsius \n",
+ "\n",
+ " The COP is 0.848\n"
+ ]
+ }
+ ],
+ "prompt_number": 51
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |