summaryrefslogtreecommitdiff
path: root/backup/Engineering_Thermodynamics_by__O._Singh_version_backup/chapter7.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'backup/Engineering_Thermodynamics_by__O._Singh_version_backup/chapter7.ipynb')
-rwxr-xr-xbackup/Engineering_Thermodynamics_by__O._Singh_version_backup/chapter7.ipynb1452
1 files changed, 1452 insertions, 0 deletions
diff --git a/backup/Engineering_Thermodynamics_by__O._Singh_version_backup/chapter7.ipynb b/backup/Engineering_Thermodynamics_by__O._Singh_version_backup/chapter7.ipynb
new file mode 100755
index 00000000..ef30a163
--- /dev/null
+++ b/backup/Engineering_Thermodynamics_by__O._Singh_version_backup/chapter7.ipynb
@@ -0,0 +1,1452 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 7:Availability and General Thermodynamic Relation"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.1;page no: 218"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.1, Page:218 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\n",
+ "let us neglect the potential energy change during the flow.\n",
+ "applying S.F.E.E,neglecting inlet velocity and change in potential energy,\n",
+ "W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\n",
+ "W_max=(h1-h2)-To*(s1-s2)-C2^2/2\n",
+ "from steam tables,\n",
+ "h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\n",
+ "given To=288 K\n",
+ "so W_max in KJ/kg= 457.1\n",
+ "maximum possible work(W_max) in KW= 1142.76\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of maximum possible work\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.1, Page:218 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 1\")\n",
+ "C2=150;#leave velocity of steam in m/s\n",
+ "m=2.5;#steam mass flow rate in kg/s\n",
+ "print(\"let us neglect the potential energy change during the flow.\")\n",
+ "print(\"applying S.F.E.E,neglecting inlet velocity and change in potential energy,\")\n",
+ "print(\"W_max=(h1-To*s1)-(h2+C2^2/2-To*s2)\")\n",
+ "print(\"W_max=(h1-h2)-To*(s1-s2)-C2^2/2\")\n",
+ "print(\"from steam tables,\")\n",
+ "print(\"h1=h_1.6Mpa_300=3034.8 KJ/kg,s1=s_1.6Mpa_300=6.8844 KJ/kg,h2=h_0.1Mpa_150=2776.4 KJ/kg,s2=s_150Mpa_150=7.6134 KJ/kg\")\n",
+ "h1=3034.8;\n",
+ "s1=6.8844;\n",
+ "h2=2776.4;\n",
+ "s2=7.6134;\n",
+ "print(\"given To=288 K\")\n",
+ "To=288;\n",
+ "W_max=(h1-h2)-To*(s1-s2)-(C2**2/2*10**-3)\n",
+ "print(\"so W_max in KJ/kg=\"),round(W_max,2)\n",
+ "W_max=m*W_max\n",
+ "print(\"maximum possible work(W_max) in KW=\"),round(W_max,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.2;page no: 219"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.2, Page:219 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\n",
+ "In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\n",
+ "BOTH THE TANKS HAVE SAME INTERNAL ENERGY\n",
+ "availability of air in tank,A\n",
+ "A=(E-Uo)+Po*(V-Vo)-To*(S-So)\n",
+ "=m*{(e-uo)+Po(v-vo)-To(s-so)}\n",
+ "m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\n",
+ "so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\n",
+ "for tank A,P in pa,so availability_A in KJ= 1.98\n",
+ "for tank B,P=3*10^5 pa,so availability_B in KJ= 30.98\n",
+ "so availability of air in tank B is more than that of tank A\n",
+ "availability of air in tank A=1.98 KJ\n",
+ "availability of air in tank B=30.98 KJ\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of availability of air in tank A,B\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "import math\n",
+ "print\"Example 7.2, Page:219 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 2\")\n",
+ "m=1.;#mass of air in kg\n",
+ "Po=1.*10**5;#atmospheric pressure in pa\n",
+ "To=(15.+273.);#temperature of atmosphere in K\n",
+ "Cv=0.717;#specific heat at constant volume in KJ/kg K\n",
+ "R=0.287;#gas constant in KJ/kg K\n",
+ "Cp=1.004;#specific heat at constant pressure in KJ/kg K\n",
+ "T=(50.+273.);#temperature of tanks A and B in K\n",
+ "print(\"In these tanks the air stored is at same temperature of 50 degree celcius.Therefore,for air behaving as perfect gas the internal energy of air in tanks shall be same as it depends upon temperature alone.But the availability shall be different.\")\n",
+ "print(\"BOTH THE TANKS HAVE SAME INTERNAL ENERGY\")\n",
+ "print(\"availability of air in tank,A\")\n",
+ "print(\"A=(E-Uo)+Po*(V-Vo)-To*(S-So)\")\n",
+ "print(\"=m*{(e-uo)+Po(v-vo)-To(s-so)}\")\n",
+ "print(\"m*{Cv*(T-To)+Po*(R*T/P-R*To/Po)-To(Cp*log(T/To)-R*log(P/Po))}\")\n",
+ "print(\"so A=m*{Cv*(T-To)+R*(Po*T/P-To)-To*Cp*log(T/To)+To*R*log(P/Po)}\")\n",
+ "P=1.*10**5;#pressure in tank A in pa\n",
+ "availability_A=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n",
+ "print(\"for tank A,P in pa,so availability_A in KJ=\"),round(availability_A,2)\n",
+ "P=3.*10**5;#pressure in tank B in pa\n",
+ "availability_B=m*(Cv*(T-To)+R*(Po*T/P-To)-To*Cp*math.log(T/To)+To*R*math.log(P/Po))\n",
+ "print(\"for tank B,P=3*10^5 pa,so availability_B in KJ=\"),round(availability_B,2)\n",
+ "print(\"so availability of air in tank B is more than that of tank A\")\n",
+ "print(\"availability of air in tank A=1.98 KJ\")\n",
+ "print(\"availability of air in tank B=30.98 KJ\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.3;page no: 221"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.3, Page:221 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\n",
+ "inlet conditions,\n",
+ "from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\n",
+ "outlet conditions,at 0.05 bar and 0.95 dryness fraction\n",
+ "from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\n",
+ "so s2= in KJ/kg K= 8.0\n",
+ "and h2= in KJ/kg= 2440.34\n",
+ "neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\n",
+ "w in KJ/kg= 598.06\n",
+ "power output in KW= 8970.97\n",
+ "maximum work for given end states,\n",
+ "w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg 850.43\n",
+ "w_max in KW 12755.7\n",
+ "so maximum power output=12755.7 KW\n",
+ "maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\n",
+ "A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\n",
+ "=(h2-ho)+V2^2/2-To(s2-so)\n",
+ "approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\n",
+ "from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\n",
+ "maximum work available from exhaust steam,A_exhaust in KJ/kg\n",
+ "A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so) 151.1\n",
+ "maximum power that could be obtained from exhaust steam in KW= 2266.5\n",
+ "so maximum power from exhaust steam=2266.5 KW\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of maximum power output and that could be obtained from exhaust steam\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.3, Page:221 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 3\")\n",
+ "m=15;#steam flow rate in kg/s\n",
+ "V2=160;#exit velocity of steam in m/s\n",
+ "To=(15+273);#pond water temperature in K\n",
+ "print(\"inlet conditions,\")\n",
+ "print(\"from steam tables,,h1=3051.2 KJ/kg,s1=7.1229 KJ/kg K\")\n",
+ "h1=3051.2;\n",
+ "s1=7.1229;\n",
+ "print(\"outlet conditions,at 0.05 bar and 0.95 dryness fraction\")\n",
+ "print(\"from steam tables,sf=0.4764 KJ/kg K,s_fg=7.9187 KJ/kg K,x=0.95,hf=137.82 KJ/kg,h_fg=2423.7 KJ/kg\")\n",
+ "sf=0.4764;\n",
+ "s_fg=7.9187;\n",
+ "x=0.95;\n",
+ "hf=137.82;\n",
+ "h_fg=2423.7;\n",
+ "s2=sf+x*s_fg\n",
+ "print(\"so s2= in KJ/kg K=\"),round(s2,2)\n",
+ "h2=hf+x*h_fg\n",
+ "print(\"and h2= in KJ/kg=\"),round(h2,2)\n",
+ "print(\"neglecting the change in potential energy and velocity at inlet to turbine,the steady flow energy equation may be written as to give work output.\")\n",
+ "w=(h1-h2)-V2**2*10**-3/2\n",
+ "print(\"w in KJ/kg=\"),round(w,2)\n",
+ "print(\"power output in KW=\"),round(m*w,2)\n",
+ "print(\"maximum work for given end states,\")\n",
+ "w_max=(h1-To*s1)-(h2+V2**2*10**-3/2-To*s2)\n",
+ "print(\"w_max=(h1-To*s1)-(h2+V2^2*10^-3/2-To*s2) in KJ/kg\"),round(w_max,2)\n",
+ "w_max=850.38;#approx.\n",
+ "w_max=m*w_max\n",
+ "print(\"w_max in KW\"),round(w_max,2)\n",
+ "print(\"so maximum power output=12755.7 KW\")\n",
+ "print(\"maximum power that could be obtained from exhaust steam shall depend upon availability with exhaust steam and the dead state.stream availability of exhaust steam,\")\n",
+ "print(\"A_exhaust=(h2+V^2/2-To*s2)-(ho-To*so)\")\n",
+ "print(\"=(h2-ho)+V2^2/2-To(s2-so)\")\n",
+ "print(\"approximately the enthalpy of water at dead state of 1 bar,15 degree celcius can be approximated to saturated liquid at 15 degree celcius\")\n",
+ "print(\"from steam tables,at 15 degree celcius,ho=62.99 KJ/kg,so=0.2245 KJ/kg K\")\n",
+ "ho=62.99;\n",
+ "so=0.2245;\n",
+ "print(\"maximum work available from exhaust steam,A_exhaust in KJ/kg\")\n",
+ "A_exhaust=(h2-ho)+V2**2*10**-3/2-To*(s2-so)\n",
+ "A_exhaust=151.1;#approx.\n",
+ "print(\"A_exhaust=(h2-ho)+V2^2*10^-3/2-To*(s2-so)\"),round(A_exhaust,2)\n",
+ "print(\"maximum power that could be obtained from exhaust steam in KW=\"),round(m*A_exhaust,2)\n",
+ "print(\"so maximum power from exhaust steam=2266.5 KW\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.4;page no: 222"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.4, Page:222 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\n",
+ "for dead state of water,\n",
+ "from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\n",
+ "for initial state of water,\n",
+ "from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\n",
+ "for final state of water,\n",
+ "from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\n",
+ "availability at any state can be given by\n",
+ "A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\n",
+ "so availability at initial state,A1 in KJ\n",
+ "A1= 2703.28\n",
+ "and availability at final state,A2 in KJ\n",
+ "A2= 1.09\n",
+ "change in availability,A2-A1 in KJ= -2702.19\n",
+ "hence availability decreases by 2702.188 KJ\n",
+ "NOTE=>In this question,due to large calculations,answers are approximately correct.\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of availability at initial,final state and also change\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.4, Page:222 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 4\")\n",
+ "m=5;#mass of steam in kg\n",
+ "z1=10;#initial elevation in m\n",
+ "V1=25;#initial velocity of steam in m/s\n",
+ "z2=2;#final elevation in m\n",
+ "V2=10;#final velocity of steam in m/s\n",
+ "Po=100;#environmental pressure in Kpa\n",
+ "To=(25+273);#environmental temperature in K\n",
+ "g=9.81;#acceleration due to gravity in m/s^2\n",
+ "print(\"for dead state of water,\")\n",
+ "print(\"from steam tables,uo=104.86 KJ/kg,vo=1.0029*10^-3 m^3/kg,so=0.3673 KJ/kg K\")\n",
+ "uo=104.86;\n",
+ "vo=1.0029*10**-3;\n",
+ "so=0.3673;\n",
+ "print(\"for initial state of water,\")\n",
+ "print(\"from steam tables,u1=2550 KJ/kg,v1=0.5089 m^3/kg,s1=6.93 KJ/kg K\")\n",
+ "u1=2550;\n",
+ "v1=0.5089;\n",
+ "s1=6.93;\n",
+ "print(\"for final state of water,\")\n",
+ "print(\"from steam tables,u2=83.94 KJ/kg,v2=1.0018*10^-3 m^3/kg,s2=0.2966 KJ/kg K\")\n",
+ "u2=83.94;\n",
+ "v2=1.0018*10**-3;\n",
+ "s2=0.2966;\n",
+ "print(\"availability at any state can be given by\")\n",
+ "print(\"A=m*((u-uo)+Po*(v-vo)-To*(s-so)+V^2/2+g*z)\")\n",
+ "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+V1**2*10**-3/2+g*z1*10**-3)\n",
+ "print(\"so availability at initial state,A1 in KJ\")\n",
+ "print(\"A1=\"),round(A1,2)\n",
+ "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+V2**2*10**-3/2+g*z2*10**-3)\n",
+ "print(\"and availability at final state,A2 in KJ\")\n",
+ "print(\"A2=\"),round(A2,2)\n",
+ "A2-A1\n",
+ "print(\"change in availability,A2-A1 in KJ=\"),round(A2-A1,2)\n",
+ "print(\"hence availability decreases by 2702.188 KJ\")\n",
+ "print(\"NOTE=>In this question,due to large calculations,answers are approximately correct.\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.5;page no: 223"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.5, Page:223 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\n",
+ "In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\n"
+ ]
+ }
+ ],
+ "source": [
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.5, Page:223 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 5\")\n",
+ "print(\"In question no. 5 expression I=To*S_gen is derived which cannot be solve using python software.\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.6;pg no: 223"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.6, Page:223 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\n",
+ "loss of available energy=irreversibility=To*deltaSc\n",
+ "deltaSc=deltaSs+deltaSe\n",
+ "change in enropy of system(deltaSs)=W/T in KJ/kg K 0.98\n",
+ "change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K -2.8\n",
+ "loss of available energy(E) in KJ/kg= -550.49\n",
+ "loss of available energy(E)= -550.49\n",
+ "ratio of lost available exhaust gas energy to engine work=E/W= 0.524\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of available energy and ratio of lost available exhaust gas energy to engine work\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.6, Page:223 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 6\")\n",
+ "To=(30.+273.);#temperature of surrounding in K\n",
+ "W=1050.;#work done in engine in KJ/kg\n",
+ "Cp=1.1;#specific heat at constant pressure in KJ/kg K\n",
+ "T=(800.+273.);#temperature of exhaust gas in K\n",
+ "print(\"loss of available energy=irreversibility=To*deltaSc\")\n",
+ "print(\"deltaSc=deltaSs+deltaSe\")\n",
+ "deltaSs=W/T\n",
+ "print(\"change in enropy of system(deltaSs)=W/T in KJ/kg K\"),round(deltaSs,2)\n",
+ "deltaSe=-Cp*(T-To)/To\n",
+ "print(\"change in entropy of surrounding(deltaSe)=-Cp*(T-To)/To in KJ/kg K\"),round(deltaSe,2)\n",
+ "E=To*(deltaSs+deltaSe)\n",
+ "print(\"loss of available energy(E) in KJ/kg=\"),round(E,2)\n",
+ "E=-E\n",
+ "print(\"loss of available energy(E)=\"),round(-E,2)\n",
+ "print(\"ratio of lost available exhaust gas energy to engine work=E/W=\"),round(E/W,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.7;pg no: 224"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.7, Page:224 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\n",
+ "let us consider velocities and elevations to be given in reference to environment.Availability is given by\n",
+ "A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\n",
+ "dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\n",
+ "for initial state of saturated vapour at 150 degree celcius\n",
+ "from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\n",
+ "for final state of saturated liquid at 20 degree celcius\n",
+ "from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\n",
+ "substituting in the expression for availability\n",
+ "initial state availability,A1 in KJ\n",
+ "A1= 5650.31\n",
+ "final state availability,A2 in KJ\n",
+ "A2= 2.58\n",
+ "change in availability,deltaA in KJ= -5647.72\n",
+ "so initial availability =5650.28 KJ\n",
+ "final availability=2.58 KJ \n",
+ "change in availability=decrease by 5647.70 KJ \n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of initial,final and change in availability\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.7, Page:224 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 7\")\n",
+ "m=10;#mass of water in kg\n",
+ "C1=25;#initial velocity in m/s\n",
+ "C2=10;#final velocity in m/s\n",
+ "Po=0.1*1000;#environmental pressure in Kpa\n",
+ "To=(25+273.15);#environmental temperature in K\n",
+ "g=9.8;#acceleration due to gravity in m/s^2\n",
+ "z1=10;#initial elevation in m\n",
+ "z2=3;#final elevation in m\n",
+ "print(\"let us consider velocities and elevations to be given in reference to environment.Availability is given by\")\n",
+ "print(\"A=m*((u-uo)+Po*(v-vo)-To(s-so)+C^2/2+g*z)\")\n",
+ "print(\"dead state of water,from steam tables,uo=104.88 KJ/kg,vo=1.003*10^-3 m^3/kg,so=0.3674 KJ/kg K\")\n",
+ "uo=104.88;\n",
+ "vo=1.003*10**-3;\n",
+ "so=0.3674;\n",
+ "print(\"for initial state of saturated vapour at 150 degree celcius\")\n",
+ "print(\"from steam tables,u1=2559.5 KJ/kg,v1=0.3928 m^3/kg,s1=6.8379 KJ/kg K\")\n",
+ "u1=2559.5;\n",
+ "v1=0.3928;\n",
+ "s1=6.8379;\n",
+ "print(\"for final state of saturated liquid at 20 degree celcius\")\n",
+ "print(\"from steam tables,u2=83.95 KJ/kg,v2=0.001002 m^3/kg,s2=0.2966 KJ/kg K\")\n",
+ "u2=83.95;\n",
+ "v2=0.001002;\n",
+ "s2=0.2966;\n",
+ "print(\"substituting in the expression for availability\")\n",
+ "A1=m*((u1-uo)+Po*(v1-vo)-To*(s1-so)+C1**2*10**-3/2+g*z1*10**-3)\n",
+ "print(\"initial state availability,A1 in KJ\")\n",
+ "print(\"A1=\"),round(A1,2)\n",
+ "A2=m*((u2-uo)+Po*(v2-vo)-To*(s2-so)+C2**2*10**-3/2+g*z2*10**-3)\n",
+ "print(\"final state availability,A2 in KJ\")\n",
+ "print(\"A2=\"),round(A2,2)\n",
+ "deltaA=A2-A1\n",
+ "print(\"change in availability,deltaA in KJ=\"),round(deltaA,2)\n",
+ "print(\"so initial availability =5650.28 KJ\")\n",
+ "print(\"final availability=2.58 KJ \")\n",
+ "print(\"change in availability=decrease by 5647.70 KJ \")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.8;pg no: 225"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.8, Page:225 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\n",
+ "let inlet and exit states of turbine be denoted as 1 and 2\n",
+ "at inlet to turbine,\n",
+ "from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\n",
+ "at exit from turbine,\n",
+ "from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\n",
+ "at dead state,\n",
+ "from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\n",
+ "availability of steam at inlet,A1 in KJ= 6792.43\n",
+ "so availability of steam at inlet=6792.43 KJ\n",
+ "applying first law of thermodynamics,\n",
+ "Q+m*h1=m*h2+W\n",
+ "so W in KJ/s= 2829.0\n",
+ "so turbine output=2829 KW\n",
+ "maximum possible turbine output will be available when irreversibility is zero.\n",
+ "W_rev=W_max=A1-A2\n",
+ "W_max in KJ/s= 3804.82\n",
+ "so maximum output=3804.81 KW\n",
+ "irreversibility can be estimated by the difference between the maximum output and turbine output.\n",
+ "I= in KW= 975.82\n",
+ "so irreversibility=975.81807 KW\n",
+ "NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of availability of steam at inlet,turbine output,maximum possible turbine output,irreversibility\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.8, Page:225 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 8\")\n",
+ "m=5.;#steam flow rate in kg/s\n",
+ "p1=5.*1000.;#initial pressure of steam in Kpa\n",
+ "T1=(500.+273.15);#initial temperature of steam in K \n",
+ "p2=0.2*1000.;#final pressure of steam in Kpa\n",
+ "T1=(140.+273.15);#final temperature of steam in K\n",
+ "po=101.3;#pressure of steam at dead state in Kpa\n",
+ "To=(25.+273.15);#temperature of steam at dead state in K \n",
+ "Q=600.;#heat loss through turbine in KJ/s\n",
+ "print(\"let inlet and exit states of turbine be denoted as 1 and 2\")\n",
+ "print(\"at inlet to turbine,\")\n",
+ "print(\"from steam tables,h1=3433.8 KJ/kg,s1=6.9759 KJ/kg K\")\n",
+ "h1=3433.8;\n",
+ "s1=6.9759;\n",
+ "print(\"at exit from turbine,\")\n",
+ "print(\"from steam tables,h2=2748 KJ/kg,s2=7.228 KJ/kg K\")\n",
+ "h2=2748;\n",
+ "s2=7.228;\n",
+ "print(\"at dead state,\")\n",
+ "print(\"from steam tables,ho=104.96 KJ/kg,so=0.3673 KJ/kg K\")\n",
+ "ho=104.96;\n",
+ "so=0.3673;\n",
+ "A1=m*((h1-ho)-To*(s1-so))\n",
+ "print(\"availability of steam at inlet,A1 in KJ=\"),round(A1,2)\n",
+ "print(\"so availability of steam at inlet=6792.43 KJ\")\n",
+ "print(\"applying first law of thermodynamics,\")\n",
+ "print(\"Q+m*h1=m*h2+W\")\n",
+ "W=m*(h1-h2)-Q\n",
+ "print(\"so W in KJ/s=\"),round(W,2)\n",
+ "print(\"so turbine output=2829 KW\")\n",
+ "print(\"maximum possible turbine output will be available when irreversibility is zero.\")\n",
+ "print(\"W_rev=W_max=A1-A2\")\n",
+ "W_max=m*((h1-h2)-To*(s1-s2))\n",
+ "print(\"W_max in KJ/s=\"),round(W_max,2)\n",
+ "print(\"so maximum output=3804.81 KW\")\n",
+ "print(\"irreversibility can be estimated by the difference between the maximum output and turbine output.\")\n",
+ "I=W_max-W\n",
+ "print(\"I= in KW=\"),round(I,2)\n",
+ "print(\"so irreversibility=975.81807 KW\")\n",
+ "print(\"NOTE=>In book,W_max is calculated wrong,so irreversibility also comes wrong,which are corrected above.\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.9;pg no: 226"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.9, Page:226 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\n",
+ "In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\n"
+ ]
+ }
+ ],
+ "source": [
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.9, Page:226 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 9\")\n",
+ "print(\"In question no.9 comparision between sublimation and vaporisation line is made which cannot be solve using python software.\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.10;pg no: 227"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.10, Page:227 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\n",
+ "In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\n"
+ ]
+ }
+ ],
+ "source": [
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.10, Page:227 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 10\")\n",
+ "print(\"In question no. 10 expression for change in internal energy of gas is derive which cannot be solve using python software.\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.11;pg no: 227"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.11, Page:227 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\n",
+ "availability for heat reservoir(A_HR) in KJ/kg K 167.66\n",
+ "now availability for system(A_system) in KJ/kg K 194.44\n",
+ "net loss of available energy(A) in KJ/kg K= -26.78\n",
+ "so loss of available energy=26.77 KJ/kg K\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of loss of available energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.11, Page:227 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 11\")\n",
+ "To=280.;#surrounding temperature in K\n",
+ "Q=500.;#heat removed in KJ\n",
+ "T1=835.;#temperature of reservoir in K\n",
+ "T2=720.;#temperature of system in K\n",
+ "A_HR=To*Q/T1\n",
+ "print(\"availability for heat reservoir(A_HR) in KJ/kg K\"),round(A_HR,2)\n",
+ "A_system=To*Q/T2\n",
+ "print(\"now availability for system(A_system) in KJ/kg K\"),round(A_system,2)\n",
+ "A=A_HR-A_system \n",
+ "print(\"net loss of available energy(A) in KJ/kg K=\"),round(A,2)\n",
+ "print(\"so loss of available energy=26.77 KJ/kg K\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.12;pg no: 228"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.12, Page:228 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\n",
+ "here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\n",
+ "W_max=W1-W2 in KJ/kg 1647.0\n",
+ "actual work from turbine,W_actual=h1-h2 in KJ/kg 1557.0\n",
+ "so actual work=1557 KJ/kg\n",
+ "maximum possible work=1647 KJ/kg\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of actual,maximum possible work\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.12, Page:228 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 12\")\n",
+ "h1=4142;#enthalpy at entrance in KJ/kg\n",
+ "h2=2585;#enthalpy at exit in KJ/kg\n",
+ "W1=1787;#availability of steam at entrance in KJ/kg\n",
+ "W2=140;#availability of steam at exit in KJ/kg\n",
+ "print(\"here dead state is given as 300 K and maximum possible work for given change of state of steam can be estimated by the difference of flow availability as given under:\")\n",
+ "W_max=W1-W2\n",
+ "print(\"W_max=W1-W2 in KJ/kg\"),round(W_max,2)\n",
+ "W_actual=h1-h2\n",
+ "print(\"actual work from turbine,W_actual=h1-h2 in KJ/kg\"),round(W_actual,2)\n",
+ "print(\"so actual work=1557 KJ/kg\")\n",
+ "print(\"maximum possible work=1647 KJ/kg\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.13;pg no: 228"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.13, Page:228 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\n",
+ "reversible engine efficiency,n_rev=1-(T_min/T_max) 0.621\n",
+ "second law efficiency=n/n_rev 0.4026\n",
+ "in % 40.26\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of second law efficiency\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.13, Page:228 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 13\")\n",
+ "T_min=(20.+273.);#minimum temperature reservoir temperature in K\n",
+ "T_max=(500.+273.);#maximum temperature reservoir temperature in K\n",
+ "n=0.25;#efficiency of heat engine\n",
+ "n_rev=1-(T_min/T_max)\n",
+ "print(\"reversible engine efficiency,n_rev=1-(T_min/T_max)\"),round(n_rev,4)\n",
+ "n/n_rev\n",
+ "print(\"second law efficiency=n/n_rev\"),round(n/n_rev,4)\n",
+ "print(\"in %\"),round(n*100/n_rev,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.14;pg no: 228"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.14, Page:228 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\n",
+ "expansion occurs in adiabatic conditions.\n",
+ "temperature after expansion can be obtained by considering adiabatic expansion\n",
+ "T2/T1=(V1/V2)^(y-1)\n",
+ "so T2= in K= 489.12\n",
+ "mass of air,m in kg= 20.91\n",
+ "change in entropy of control system,deltaSs=(S2-S1) in KJ/K= -0.0\n",
+ "here,there is no change in entropy of environment,deltaSe=0\n",
+ "total entropy change of combined system=deltaSc in KJ/K= -0.0\n",
+ "loss of available energy(E)=irreversibility in KJ= -0.603\n",
+ "so loss of available energy,E=0.603 KJ\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of loss of available energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "import math\n",
+ "print\"Example 7.14, Page:228 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 14\")\n",
+ "V_A=6.;#volume of compartment A in m^3\n",
+ "V_B=4.;#volume of compartment B in m^3\n",
+ "To=300.;#temperature of atmosphere in K\n",
+ "Po=1.*10**5;#atmospheric pressure in pa\n",
+ "P1=6.*10**5;#initial pressure in pa\n",
+ "T1=600.;#initial temperature in K\n",
+ "V1=V_A;#initial volume in m^3\n",
+ "V2=(V_A+V_B);#final volume in m^3\n",
+ "y=1.4;#expansion constant \n",
+ "R=287.;#gas constant in J/kg K\n",
+ "Cv=0.718;#specific heat at constant volume in KJ/kg K\n",
+ "print(\"expansion occurs in adiabatic conditions.\")\n",
+ "print(\"temperature after expansion can be obtained by considering adiabatic expansion\")\n",
+ "T2=T1*(V1/V2)**(y-1)\n",
+ "print(\"T2/T1=(V1/V2)^(y-1)\")\n",
+ "print(\"so T2= in K=\"),round(T2,2)\n",
+ "T2=489.12;#approx.\n",
+ "m=(P1*V1)/(R*T1)\n",
+ "print(\"mass of air,m in kg=\"),round(m,2)\n",
+ "m=20.91;#approx.\n",
+ "deltaSs=m*Cv*math.log(T2/T1)+m*R*10**-3*math.log(V2/V1)\n",
+ "print(\"change in entropy of control system,deltaSs=(S2-S1) in KJ/K=\"),round(deltaSs,2)\n",
+ "print(\"here,there is no change in entropy of environment,deltaSe=0\")\n",
+ "deltaSe=0;\n",
+ "deltaSc=deltaSs+deltaSe\n",
+ "print(\"total entropy change of combined system=deltaSc in KJ/K=\"),round(deltaSc,2)\n",
+ "E=To*deltaSc\n",
+ "print(\"loss of available energy(E)=irreversibility in KJ=\"),round(E,3)\n",
+ "print(\"so loss of available energy,E=0.603 KJ\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.15;pg no: 229"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.15, Page:229 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\n",
+ "In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of maximum possible work\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.15, Page:229 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 15\")\n",
+ "print(\"In question no. 15 prove for ideal gas satisfies the cyclic relation is done which cannot be solve using python software.\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.16;pg no: 230"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.16, Page:230 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\n",
+ "availability or reversible work,W_rev=n_rev*Q1 in KJ/min 229.53\n",
+ "rate of irreversibility,I=W_rev-W_useful in KJ/sec 99.53\n",
+ "second law efficiency=W_useful/W_rev 0.57\n",
+ "in percentage 56.64\n",
+ "so availability=1.38*10^4 KJ/min\n",
+ "and rate of irreversibility=100 KW,second law efficiency=56.63 %\n",
+ "NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of availability,rate of irreversibility and second law efficiency\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.16, Page:230 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 16\")\n",
+ "To=(17.+273.);#temperature of surrounding in K\n",
+ "T1=(700.+273.);#temperature of high temperature reservoir in K\n",
+ "T2=(30.+273.);#temperature of low temperature reservoir in K\n",
+ "Q1=2.*10**4;#rate of heat receive in KJ/min\n",
+ "W_useful=0.13*10**3;#output of engine in KW\n",
+ "n_rev=(1-T2/T1);\n",
+ "W_rev=n_rev*Q1\n",
+ "W_rev=W_rev/60.;#W_rev in KJ/s\n",
+ "print(\"availability or reversible work,W_rev=n_rev*Q1 in KJ/min\"),round(W_rev,2)\n",
+ "I=W_rev-W_useful\n",
+ "print(\"rate of irreversibility,I=W_rev-W_useful in KJ/sec\"),round(I,2)\n",
+ "W_useful/W_rev\n",
+ "print(\"second law efficiency=W_useful/W_rev\"),round(W_useful/W_rev,2)\n",
+ "W_useful*100/W_rev\n",
+ "print(\"in percentage\"),round(W_useful*100/W_rev,2)\n",
+ "print(\"so availability=1.38*10^4 KJ/min\")\n",
+ "print(\"and rate of irreversibility=100 KW,second law efficiency=56.63 %\")\n",
+ "print(\"NOTE=>In this question,wrong values are put in expression for W_rev in book,however answer is calculated correctly.\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.17;pg no: 230"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.17, Page:230 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\n",
+ "loss of available energy=irreversibility=To*deltaSc\n",
+ "deltaSc=deltaSs+deltaSe\n",
+ "change in entropy of system=deltaSs\n",
+ "change in entropy of environment/surroundings=deltaSe\n",
+ "here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\n",
+ "P1/T1=P2/T2\n",
+ "so T2 in K= 555.0\n",
+ "heat addition to air in tank\n",
+ "Q in KJ/kg= 223.11\n",
+ "deltaSs in KJ/kg K= 0.67\n",
+ "deltaSe in KJ/kg K= -0.33\n",
+ "and deltaSc in KJ/kg K= 0.34\n",
+ "so loss of available energy(E)in KJ/kg= 101.55\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of loss of available energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "import math\n",
+ "print\"Example 7.17, Page:230 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 17\")\n",
+ "To=(27+273);#temperature of surrounding in K\n",
+ "T1=(60+273);#initial temperature of air in K\n",
+ "P1=1.5*10**5;#initial pressure of air in pa\n",
+ "P2=2.5*10**5;#final pressure of air in pa\n",
+ "T_reservoir=(400+273);#temperature of reservoir in K\n",
+ "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n",
+ "print(\"loss of available energy=irreversibility=To*deltaSc\")\n",
+ "print(\"deltaSc=deltaSs+deltaSe\")\n",
+ "print(\"change in entropy of system=deltaSs\")\n",
+ "print(\"change in entropy of environment/surroundings=deltaSe\")\n",
+ "print(\"here heat addition process causing rise in pressure from 1.5 bar to 2.5 bar occurs isochorically.let initial and final states be given by subscript 1 and 2\")\n",
+ "print(\"P1/T1=P2/T2\")\n",
+ "T2=P2*T1/P1\n",
+ "print(\"so T2 in K=\"),round(T2,2)\n",
+ "print(\"heat addition to air in tank\")\n",
+ "deltaT=T2-T1;\n",
+ "Q=Cp*deltaT\n",
+ "print(\"Q in KJ/kg=\"),round(Q,2)\n",
+ "deltaSs=Q/T1\n",
+ "print(\"deltaSs in KJ/kg K=\"),round(deltaSs,2)\n",
+ "deltaSe=-Q/T_reservoir\n",
+ "print(\"deltaSe in KJ/kg K=\"),round(deltaSe,2)\n",
+ "deltaSc=deltaSs+deltaSe\n",
+ "print(\"and deltaSc in KJ/kg K=\"),round(deltaSc,2)\n",
+ "E=To*deltaSc\n",
+ "print(\"so loss of available energy(E)in KJ/kg=\"),round(E,2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.18;pg no: 231"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.18, Page:231 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\n",
+ "In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\n"
+ ]
+ }
+ ],
+ "source": [
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.18, Page:231 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 18\")\n",
+ "print(\"In question no. 18,relation for T*ds using maxwell relation is derived which cannot be solve using python software.\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.19;pg no: 232"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.19, Page:232 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\n",
+ "clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\n",
+ "from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\n",
+ "v_fg in m^3/kg= 0.0\n",
+ "let us approximate,\n",
+ "(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\n",
+ "here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\n",
+ "substituting in clapeyron equation,\n",
+ "h_fg in KJ/kg 1941.25\n",
+ "so calculated enthalpy of vaporisation=1941.25 KJ/kg\n",
+ "and enthalpy of vaporisation from steam table=1940.7 KJ/kg\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of enthalpy of vaporisation\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "import math\n",
+ "print\"Example 7.19, Page:232 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 19\")\n",
+ "T=(200+273);#temperature of water in K\n",
+ "print(\"clapeyron equation says,h_fg=T*v_fg*(dp/dT)_sat\")\n",
+ "print(\"from steam tables,vg=0.12736 m^3/kg,vf=0.001157 m^3/kg\")\n",
+ "vg=0.12736;\n",
+ "vf=0.001157;\n",
+ "v_fg=(vg-vf)\n",
+ "print(\"v_fg in m^3/kg=\"),round(v_fg)\n",
+ "print(\"let us approximate,\")\n",
+ "print(\"(dp/dT)_sat_200oc=(deltaP/deltaT)_200oc=(P_205oc-P_195oc)/(205-195) in Mpa/oc\")\n",
+ "print(\"here from steam tables,P_205oc=1.7230 Mpa,P_195oc=1.3978 Mpa\")\n",
+ "P_205oc=1.7230;#pressure at 205 degree celcius in Mpa\n",
+ "P_195oc=1.3978;#pressure at 195 degree celcius in Mpa\n",
+ "(P_205oc-P_195oc)/(205-195)\n",
+ "print(\"substituting in clapeyron equation,\")\n",
+ "h_fg=T*v_fg*(P_205oc-P_195oc)*1000/(205-195)\n",
+ "print(\"h_fg in KJ/kg\"),round(h_fg,2)\n",
+ "print(\"so calculated enthalpy of vaporisation=1941.25 KJ/kg\")\n",
+ "print(\"and enthalpy of vaporisation from steam table=1940.7 KJ/kg\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.20;pg no: 232"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.20, Page:232 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\n",
+ "by clapeyron equation\n",
+ "h_fg=T2*v_fg*(do/dT)_sat \n",
+ "h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\n",
+ "by clapeyron-clausius equation,\n",
+ "log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\n",
+ "log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\n",
+ "so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\n",
+ "% deviation from clapeyron equation in % 6.44\n",
+ "h_fg by clapeyron equation=159.49 KJ/kg\n",
+ "h_fg by clapeyron-clausius equation=169.76 KJ/kg\n",
+ "% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of loss of available energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "import math\n",
+ "print\"Example 7.20, Page:232 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 20\")\n",
+ "P2=260.96;#saturation pressure at -5 degree celcius\n",
+ "P1=182.60;#saturation pressure at -15 degree celcius\n",
+ "vg=0.07665;#specific volume of gas at -10 degree celcius in m^3/kg\n",
+ "vf=0.00070#specific volume at -10 degree celcius in m^3/kg\n",
+ "R=0.06876;#gas constant in KJ/kg K\n",
+ "h_fg=156.3;#enthalpy in KJ/kg K\n",
+ "T2=(-5.+273.);#temperature in K\n",
+ "T1=(-15.+273.);#temperature in K\n",
+ "print(\"by clapeyron equation\")\n",
+ "print(\"h_fg=T2*v_fg*(do/dT)_sat \")\n",
+ "print(\"h_fg=T2*(vg-vf)*(deltaP/deltaT)in KJ/kg\")\n",
+ "h_fg=T2*(vg-vf)*(P1-P2)/(T1-T2)\n",
+ "print(\"by clapeyron-clausius equation,\")\n",
+ "print(\"log(P2/P1)_sat=(h_fg/R)*((1/T1)-(1/T2))_sat\")\n",
+ "print(\"log(P2/P1)=(h_fg/R)*((1/T1)-(1/T2))\")\n",
+ "print(\"so h_fg=log(P2/P1)*R/((1/T1)-(1/T2))in KJ/kg\")\n",
+ "h_fg=math.log(P2/P1)*R/((1/T1)-(1/T2))\n",
+ "print(\"% deviation from clapeyron equation in %\"),round((169.76-159.49)*100/159.49,2)\n",
+ "print(\"h_fg by clapeyron equation=159.49 KJ/kg\")\n",
+ "print(\"h_fg by clapeyron-clausius equation=169.76 KJ/kg\")\n",
+ "print(\"% deviation in h_fg value by clapeyron-clausius equation from the value from clapeyron equation=6.44%\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.21;pg no: 233"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "ename": "SyntaxError",
+ "evalue": "invalid syntax (<ipython-input-21-78365f63e245>, line 15)",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[1;36m File \u001b[1;32m\"<ipython-input-21-78365f63e245>\"\u001b[1;36m, line \u001b[1;32m15\u001b[0m\n\u001b[1;33m volume expansivity=((1./0.8753)*(0.9534-0.7964))/(350.-250.)\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of volume expansivity and isothermal compressibility\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "import math\n",
+ "print\"Example 7.21, Page:233 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 21\")\n",
+ "print(\"volume expansion=(1/v)*(dv/dT)_P\")\n",
+ "print(\"isothermal compressibility=-(1/v)*(dv/dp)_T\")\n",
+ "print(\"let us write dv/dT=deltav/deltaT and dv/dP=deltav/deltaP.The difference may be taken for small pressure and temperature changes.\")\n",
+ "print(\"volume expansivity in K^-1,\")\n",
+ "print(\"=(1/v)*(dv/dT)_300Kpa\")\n",
+ "v_300Kpa_300oc=0.8753;#specific volume at 300Kpa and 300 degree celcius\n",
+ "v_350oc=0.9534;#specific volume 350 degree celcius\n",
+ "v_250oc=0.7964;#specific volume 250 degree celcius\n",
+ "volume expansivity=((1./0.8753)*(0.9534-0.7964))/(350.-250.)\n",
+ "print(\"volume expansivity in Kpa\"),round(volume expansivity,2)\n",
+ "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350oc=0.9534 in m^3/kg,v_250oc=0.7964 in m^3/kg\")\n",
+ "print(\"volume expansivity=1.7937*10^-3 K^-1\")\n",
+ "isothermal=(-1/v_300Kpa_300oc)*(v_350Kpa-v_250Kpa)/(350-250)\n",
+ "print(\"isothermal compressibility in Kpa^-1\")\n",
+ "print(\"isothermal compressibility\"),round(isothermal compressibility,2)\n",
+ "print(\"from steam tables,v_300Kpa_300oc=0.8753 in m^3/kg,v_350Kpa=0.76505 in m^3/kg,v_250Kpa=1.09575 in m^3/kg\")\n",
+ "v_350Kpa=0.76505;#specific volume 350 Kpa\n",
+ "v_250Kpa=1.09575;#specific volume 250 Kpa\n",
+ "print(\"so isothermal compressibility=3.778*10^-3 Kpa^-1\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.22;pg no: 234"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.22, Page:234 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\n",
+ "filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\n",
+ "hi=uf\n",
+ "Cp*Ti=Cv*Tf\n",
+ "so Tf=Cp*Ti/Cv in K 417.33\n",
+ "inside final temperature,Tf=417.33 K\n",
+ "change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K= 0.338\n",
+ "Cp*log(Tf/Ti)+0\n",
+ "change in entropy,deltaS_gen=0.3379 KJ/kg K\n",
+ "irreversibility,I in KJ/kg= 100.76\n",
+ "irreversibility,I=100.74 KJ/kg\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of inside final temperature,change in entropy and irreversibility\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "import math\n",
+ "print\"Example 7.22, Page:234 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 22\")\n",
+ "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n",
+ "Cv=0.718;#specific heat at constant volume in KJ/kg K\n",
+ "Ti=(25+273.15);#atmospheric temperature in K\n",
+ "print(\"filling of the tank is a transient flow(unsteady)process.for the transient filling process,considering subscripts i and f for initial and final states,\")\n",
+ "print(\"hi=uf\")\n",
+ "print(\"Cp*Ti=Cv*Tf\")\n",
+ "Tf=Cp*Ti/Cv\n",
+ "print(\"so Tf=Cp*Ti/Cv in K\"),round(Tf,2)\n",
+ "print(\"inside final temperature,Tf=417.33 K\")\n",
+ "deltaS_gen=Cp*math.log(Tf/Ti)\n",
+ "print(\"change in entropy,deltaS_gen=(Sf-Si)+deltaS_surr in KJ/kg K=\"),round(deltaS_gen,4)\n",
+ "print(\"Cp*log(Tf/Ti)+0\")\n",
+ "print(\"change in entropy,deltaS_gen=0.3379 KJ/kg K\")\n",
+ "To=Ti;\n",
+ "I=To*deltaS_gen\n",
+ "print(\"irreversibility,I in KJ/kg=\"),round(I,2)\n",
+ "print(\"irreversibility,I=100.74 KJ/kg\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.23;pg no: 234"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.23, Page:234 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\n",
+ "here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\n",
+ "therefore,d(E-To-S)/dt=W_max\n",
+ "or W_max=(E-To-S)1-(E-To-S)2\n",
+ "here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\n",
+ "therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\n",
+ "so maximum work in KJ= 40946.6\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of maximum work\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "import math\n",
+ "print\"Example 7.23, Page:234 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 23\")\n",
+ "m=75.;#mass of hot water in kg\n",
+ "T1=(400.+273.);#temperature of hot water in K\n",
+ "T2=(27.+273.);#temperature of environment in K\n",
+ "Cp=4.18;#specific heat of water in KJ/kg K\n",
+ "print(\"here the combined closed system consists of hot water and heat engine.here there is no thermal reservoir in the system under consideration.for the maximum work output,irreversibility=0\")\n",
+ "print(\"therefore,d(E-To-S)/dt=W_max\")\n",
+ "print(\"or W_max=(E-To-S)1-(E-To-S)2\")\n",
+ "print(\"here E1=U1=m*Cp*T1,E2=U2=m*Cp*T2\")\n",
+ "print(\"therefore,W_max=m*Cp*(T1-T2)-To*m*Cp*log(T1/T2)in KJ\")\n",
+ "To=T2;\n",
+ "W_max=m*Cp*(T1-T2)-To*m*Cp*math.log(T1/T2)\n",
+ "print(\"so maximum work in KJ=\"),round(W_max,1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.24;pg no: 235"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.24, Page:235 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\n",
+ "from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\n",
+ "inlet stream availability in KJ/kg= 1587.19\n",
+ "input stream availability is equal to the input absolute availability.\n",
+ "exit stream availaability in KJ/kg 238.69\n",
+ "exit stream availability is equal to the exit absolute availability.\n",
+ "W_rev in KJ/kg\n",
+ "irreversibility=W_rev-W in KJ/kg 348.49\n",
+ "this irreversibility is in fact the availability loss.\n",
+ "inlet stream availability=1587.18 KJ/kg\n",
+ "exit stream availability=238.69 KJ/kg\n",
+ "irreversibility=348.49 KJ/kg\n",
+ "NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of inlet stream availability,exit stream availability and irreversibility\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "import math\n",
+ "print\"Example 7.24, Page:235 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 7 Example 24\")\n",
+ "C1=150;#steam entering velocity in m/s\n",
+ "C2=50;#steam leaving velocity in m/s\n",
+ "To=(15+273);#dead state temperature in K\n",
+ "W=1000;#expansion work in KJ/kg\n",
+ "print(\"from steam tables,h1=h_50bar_600oc=3666.5 KJ/kg,s1=s_50bar_600oc=7.2589 KJ/kg K,h2=hg=2584.7 KJ/kg,s2=sg=8.1502 KJ/kg K\")\n",
+ "h1=3666.5;\n",
+ "s1=7.2589;\n",
+ "h2=2584.7;\n",
+ "s2=8.1502;\n",
+ "(h1+C1**2*10**-3/2)-To*s1\n",
+ "print(\"inlet stream availability in KJ/kg=\"),round((h1+C1**2*10**-3/2)-To*s1,2)\n",
+ "(h2+C2**2*10**-3/2)-To*s2\n",
+ "print(\"input stream availability is equal to the input absolute availability.\")\n",
+ "print(\"exit stream availaability in KJ/kg\"),round((h2+C2**2*10**-3/2)-To*s2,2)\n",
+ "print(\"exit stream availability is equal to the exit absolute availability.\")\n",
+ "print(\"W_rev in KJ/kg\")\n",
+ "W_rev=1587.18-238.69\n",
+ "W_rev-W\n",
+ "print(\"irreversibility=W_rev-W in KJ/kg\"),round(W_rev-W,2)\n",
+ "print(\"this irreversibility is in fact the availability loss.\")\n",
+ "print(\"inlet stream availability=1587.18 KJ/kg\")\n",
+ "print(\"exit stream availability=238.69 KJ/kg\")\n",
+ "print(\"irreversibility=348.49 KJ/kg\")\n",
+ "print(\"NOTE=>In book this question is solve using dead state temperature 25 degree celcius which is wrong as we have to take dead state temperature 15 degree celcius,now this question is correctly solve above taking dead state temperature 15 degree celcius as mentioned in question. \")\n"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}