summaryrefslogtreecommitdiff
path: root/Engineering_Thermodynamics_by_O._Singh/chapter3_3.ipynb
diff options
context:
space:
mode:
authorkinitrupti2017-05-12 18:53:46 +0530
committerkinitrupti2017-05-12 18:53:46 +0530
commit6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d (patch)
tree22789c9dbe468dae6697dcd12d8e97de4bcf94a2 /Engineering_Thermodynamics_by_O._Singh/chapter3_3.ipynb
parentd36fc3b8f88cc3108ffff6151e376b619b9abb01 (diff)
downloadPython-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.gz
Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.bz2
Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.zip
Removed duplicates
Diffstat (limited to 'Engineering_Thermodynamics_by_O._Singh/chapter3_3.ipynb')
-rwxr-xr-xEngineering_Thermodynamics_by_O._Singh/chapter3_3.ipynb1506
1 files changed, 1506 insertions, 0 deletions
diff --git a/Engineering_Thermodynamics_by_O._Singh/chapter3_3.ipynb b/Engineering_Thermodynamics_by_O._Singh/chapter3_3.ipynb
new file mode 100755
index 00000000..22ed40c9
--- /dev/null
+++ b/Engineering_Thermodynamics_by_O._Singh/chapter3_3.ipynb
@@ -0,0 +1,1506 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 3:First Law of Thermo Dynamics"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.1;pg no:76"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.1, Page:46 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\n",
+ "a> work done on piston(W_piston)in KJ can be obtained as\n",
+ "W_piston=pdv\n",
+ "b> paddle work done on the system(W_paddle)=-4.88 KJ\n",
+ "net work done of system(W_net)in KJ\n",
+ "W_net=W_piston+W_paddle\n",
+ "so work done on system(W_net)=1.435 KJ\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of work done on system\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.1, Page:46 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1\")\n",
+ "import scipy\n",
+ "from scipy import integrate\n",
+ "\n",
+ "def fun1(x):\n",
+ "\ty=x*x\n",
+ "\treturn y\n",
+ "\n",
+ "p=689.;#pressure of gas in cylinder in kpa\n",
+ "v1=0.04;#initial volume of fluid in m^3\n",
+ "v2=0.045;#final volume of fluid in m^3\n",
+ "W_paddle=-4.88;#paddle work done on the system in KJ\n",
+ "print(\"a> work done on piston(W_piston)in KJ can be obtained as\")\n",
+ "print(\"W_piston=pdv\")\n",
+ "#function y = f(v), y=p, endfunction\n",
+ "def fun1(x):\n",
+ "\ty=p\n",
+ "\treturn y\n",
+ "\n",
+ "W_piston=scipy.integrate.quad(fun1,v1,v2) \n",
+ "print(\"b> paddle work done on the system(W_paddle)=-4.88 KJ\")\n",
+ "print(\"net work done of system(W_net)in KJ\")\n",
+ "print(\"W_net=W_piston+W_paddle\")\n",
+ "print(\"so work done on system(W_net)=1.435 KJ\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.2;pg no:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.2, Page:76 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\n",
+ "as the vessel is rigid therefore work done shall be zero\n",
+ "W=0\n",
+ "from first law of thermodynamics,heat required(Q)in KJ\n",
+ "Q=U2-U1+W=Q=m(u2-u1)+W\n",
+ "so heat required = 5.6\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of heat required\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.2, Page:76 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2\")\n",
+ "m=0.5;#mass of gas in kg\n",
+ "u1=26.6;#internal energy of gas at 200 degree celcius\n",
+ "u2=37.8;#internal energy of gas at 400 degree celcius\n",
+ "W=0;#work done by vessel in KJ\n",
+ "print(\"as the vessel is rigid therefore work done shall be zero\")\n",
+ "print(\"W=0\")\n",
+ "print(\"from first law of thermodynamics,heat required(Q)in KJ\")\n",
+ "print(\"Q=U2-U1+W=Q=m(u2-u1)+W\")\n",
+ "Q=m*(u2-u1)+W\n",
+ "print(\"so heat required =\"),round(Q,2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.3;pg no:77"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.3, Page:77 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\n",
+ "by steady flow energy equation\n",
+ "q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\n",
+ "let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\n",
+ "q=h2-h1\n",
+ "rate of heat removal(Q)in KJ/hr\n",
+ "Q=m(h2-h1)=m*Cp*(T2-T1)\n",
+ "heat should be removed at the rate=KJ/hr 40500.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of \"heat should be removed\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.3, Page:77 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3\")\n",
+ "m=50;#rate at which carbon dioxide passing through heat exchanger in kg/hr\n",
+ "T2=800;#initial temperature of carbon dioxide in degree celcius\n",
+ "T1=50;#final temperature of carbon dioxide in degree celcius\n",
+ "Cp=1.08;#specific heat at constant pressure in KJ/kg K\n",
+ "print(\"by steady flow energy equation\")\n",
+ "print(\"q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w\")\n",
+ "print(\"let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero\")\n",
+ "print(\"q=h2-h1\")\n",
+ "print(\"rate of heat removal(Q)in KJ/hr\")\n",
+ "print(\"Q=m(h2-h1)=m*Cp*(T2-T1)\")\n",
+ "Q=m*Cp*(T2-T1)\n",
+ "print(\"heat should be removed at the rate=KJ/hr\"),round(Q)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.4;pg no:77"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "#cal of work done by surrounding on system\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.4, Page:77 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 4\")\n",
+ "v=0.78;#volume of cylinder in m^3\n",
+ "p=101.325;#atmospheric pressure in kPa\n",
+ "print(\"total work done by the air at atmospheric pressure of 101.325 kPa\")\n",
+ "print(\"W=(pdv)cylinder+(pdv)air\")\n",
+ "print(\"0+p*(delta v)\")\n",
+ "print(\"work done by air(W)=-p*v in KJ\")\n",
+ "W=-p*v\n",
+ "print(\"so work done by surrounding on system=KJ\"),round(-W,2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.5:pg no:77"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.5, Page:77 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\n",
+ "given p*v^1.3=constant\n",
+ "assuming expansion to be quasi-static,the work may be given as\n",
+ "W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\n",
+ "from internal energy relation,change in specific internal energy\n",
+ "deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\n",
+ "total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\n",
+ "using p1*V1^1.3=p2*V2^1.3\n",
+ "V2=in m^3 0.85\n",
+ "take V2=.852 m^3\n",
+ "so deltaU in KJ\n",
+ "and W in KJ 246.67\n",
+ "from first law\n",
+ "deltaQ=KJ 113.47\n",
+ "heat interaction=113.5 KJ\n",
+ "work interaction=246.7 KJ\n",
+ "change in internal energy=-113.2 KJ\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of heat,work interaction and change in internal energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.5, Page:77 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5\")\n",
+ "m=5;#mass of gas in kg\n",
+ "p1=1*10**3;#initial pressure of gas in KPa\n",
+ "V1=0.5;#initial volume of gas in m^3\n",
+ "p2=0.5*10**3;#final pressure of gas in KPa\n",
+ "n=1.3;#expansion constant\n",
+ "print(\"given p*v^1.3=constant\")\n",
+ "print(\"assuming expansion to be quasi-static,the work may be given as\")\n",
+ "print(\"W=m(p*dv)=(p2*V2-p1*V1)/(1-n)\")\n",
+ "print(\"from internal energy relation,change in specific internal energy\")\n",
+ "print(\"deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg\")\n",
+ "print(\"total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ\")\n",
+ "print(\"using p1*V1^1.3=p2*V2^1.3\")\n",
+ "V2=V1*(p1/p2)**(1/1.3)\n",
+ "print(\"V2=in m^3\"),round(V2,2)\n",
+ "print(\"take V2=.852 m^3\")\n",
+ "V2=0.852;#final volume of gas in m^3\n",
+ "print(\"so deltaU in KJ\")\n",
+ "deltaU=1.8*(p2*V2-p1*V1)\n",
+ "W=(p2*V2-p1*V1)/(1-n)\n",
+ "print(\"and W in KJ\"),round(W,2)\n",
+ "print(\"from first law\")\n",
+ "deltaQ=deltaU+W\n",
+ "print(\"deltaQ=KJ\"),round(deltaQ,2)\n",
+ "print(\"heat interaction=113.5 KJ\")\n",
+ "print(\"work interaction=246.7 KJ\")\n",
+ "print(\"change in internal energy=-113.2 KJ\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.6;pg no:78"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.6, Page:78 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\n",
+ "final state volume(v2)in m^3\n",
+ "v2= 0.0\n",
+ "take v2=0.03 m^3\n",
+ "now internal energy of gas is given by U=7.5*p*v-425\n",
+ "change in internal energy(deltaU)in KJ\n",
+ "deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\n",
+ "deltaU=7.5*10^3*(p2*v2-p1*v1) 75.0\n",
+ "for quasi-static process\n",
+ "work(W) in KJ,W=p*dv\n",
+ "W=(p2*v2-p1*v1)/(1-n)\n",
+ "from first law of thermodynamics,\n",
+ "heat interaction(deltaQ)=deltaU+W\n",
+ "heat=50 KJ\n",
+ "work=25 KJ(-ve)\n",
+ "internal energy change=75 KJ\n",
+ "if 180 KJ heat transfer takes place,then from 1st law,\n",
+ "deltaQ= 50.0\n",
+ "since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\n",
+ "W=KJ 105.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of heat,workinternal energy change\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.6, Page:78 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6\")\n",
+ "p1=1;#initial pressure of gas in MPa\n",
+ "v1=0.05;#initial volume of gas in m^3\n",
+ "p2=2;#final pressure of gas in MPa\n",
+ "n=1.4;#expansion constant\n",
+ "print(\"final state volume(v2)in m^3\")\n",
+ "v2=((p1/p2)**(1/1.4))*v1\n",
+ "print(\"v2=\"),round(v2,2)\n",
+ "print(\"take v2=0.03 m^3\")\n",
+ "v2=0.03;#final volume of gas in m^3\n",
+ "print(\"now internal energy of gas is given by U=7.5*p*v-425\")\n",
+ "print(\"change in internal energy(deltaU)in KJ\")\n",
+ "print(\"deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1\")\n",
+ "deltaU=7.5*10**3*(p2*v2-p1*v1)\n",
+ "print(\"deltaU=7.5*10^3*(p2*v2-p1*v1)\"),round(deltaU,2)\n",
+ "print(\"for quasi-static process\")\n",
+ "print(\"work(W) in KJ,W=p*dv\")\n",
+ "W=((p2*v2-p1*v1)/(1-n))*10**3\n",
+ "print(\"W=(p2*v2-p1*v1)/(1-n)\")\n",
+ "print(\"from first law of thermodynamics,\")\n",
+ "print(\"heat interaction(deltaQ)=deltaU+W\")\n",
+ "deltaQ=deltaU+W\n",
+ "print(\"heat=50 KJ\")\n",
+ "print(\"work=25 KJ(-ve)\")\n",
+ "print(\"internal energy change=75 KJ\")\n",
+ "print(\"if 180 KJ heat transfer takes place,then from 1st law,\")\n",
+ "print(\"deltaQ=\"),round(deltaQ,2)\n",
+ "print(\"since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.\")\n",
+ "W=180-75\n",
+ "print(\"W=KJ\"),round(W,2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.7;pg no:79"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.7, Page:79 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\n",
+ "characteristics gas constant(R)in J/kg K\n",
+ "R= 519.64\n",
+ "take R=0.520,KJ/kg K\n",
+ "Cv=inKJ/kg K 1.18\n",
+ "y= 1.44\n",
+ "for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\n",
+ "now,T2=in K\n",
+ "work(W)in KJ/kg\n",
+ "W= -257.78\n",
+ "for polytropic process,heat(Q)in KJ/K\n",
+ "Q= 82.02\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of work and heat\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.7, Page:79 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7\")\n",
+ "M=16;#molecular weight of gas\n",
+ "p1=101.3;#initial pressure of gas in KPa\n",
+ "p2=600;#final pressure of gas in KPa\n",
+ "T1=(273+20);#initial temperature of gas in K\n",
+ "R1=8.3143*10**3;#universal gas constant in J/kg K\n",
+ "Cp=1.7;#specific heat at constant pressure in KJ/kg K\n",
+ "n=1.3;#expansion constant\n",
+ "T2=((p2/p1)**(n-1/n))\n",
+ "print(\"characteristics gas constant(R)in J/kg K\")\n",
+ "R=R1/M\n",
+ "print(\"R=\"),round(R,2)\n",
+ "print(\"take R=0.520,KJ/kg K\")\n",
+ "R=0.520;#characteristics gas constant in KJ/kg K\n",
+ "Cv=Cp-R\n",
+ "print(\"Cv=inKJ/kg K\"),round(Cv,2)\n",
+ "y=Cp/Cv\n",
+ "print(\"y=\"),round(y,2)\n",
+ "y=1.44;#ratio of specific heat at constant pressure to constant volume\n",
+ "print(\"for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3\")\n",
+ "T2=T1*((p2/p1)**((n-1)/n))\n",
+ "print(\"now,T2=in K\")\n",
+ "print(\"work(W)in KJ/kg\")\n",
+ "W=R*((T1-T2)/(n-1))\n",
+ "print(\"W=\"),round(W,2)\n",
+ "W=257.78034;#work done in KJ/kg\n",
+ "print(\"for polytropic process,heat(Q)in KJ/K\")\n",
+ "Q=((y-n)/(y-1))*W\n",
+ "print(\"Q=\"),round(Q,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.8;pg no:80"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.8, Page:80 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\n",
+ "applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\n",
+ "h1+C1^2/2=h2+C2^2/2\n",
+ "given that C1=0,negligible inlet velocity\n",
+ "so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\n",
+ "exit velocity(C2)in m/s 1098.2\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of exit velocity\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "import math\n",
+ "print\"Example 3.8, Page:80 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8\")\n",
+ "T1=(627+273);#initial temperature of air in nozzle in K\n",
+ "T2=(27+273);#temperature at which air leaves nozzle in K\n",
+ "Cp=1.005*10**3;#specific heat at constant pressure in J/kg K\n",
+ "C2=math.sqrt(2*Cp*(T1-T2))\n",
+ "print(\"applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy\")\n",
+ "print(\"h1+C1^2/2=h2+C2^2/2\")\n",
+ "print(\"given that C1=0,negligible inlet velocity\")\n",
+ "print(\"so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))\")\n",
+ "print(\"exit velocity(C2)in m/s\"),round(C2,1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.9;pg no:80"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.9, Page:80 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\n",
+ "work interaction,W=-200 KJ/kg of air\n",
+ "increase in enthalpy of air=100 KJ/kg of air\n",
+ "total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\n",
+ "writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\n",
+ "h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\n",
+ "assuming no change in potential energy and kinetic energy\n",
+ "deltaK.E=deltaP.=0\n",
+ "total heat interaction(Q)in KJ/kg of air\n",
+ "Q= -100.0\n",
+ "Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\n",
+ "so heat transferred to atmosphere(Q2)in KJ/kg of air -10.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of heat transferred to atmosphere\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.9, Page:80 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9\")\n",
+ "W=-200;#shaft work in KJ/kg of air\n",
+ "deltah=100;#increase in enthalpy in KJ/kg of air\n",
+ "Q1=-90;#heat transferred to water in KJ/kg of air\n",
+ "print(\"work interaction,W=-200 KJ/kg of air\")\n",
+ "print(\"increase in enthalpy of air=100 KJ/kg of air\")\n",
+ "print(\"total heat interaction,Q=heat transferred to water + heat transferred to atmosphere\")\n",
+ "print(\"writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2\")\n",
+ "print(\"h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W\")\n",
+ "print(\"assuming no change in potential energy and kinetic energy\")\n",
+ "print(\"deltaK.E=deltaP.=0\")\n",
+ "print(\"total heat interaction(Q)in KJ/kg of air\")\n",
+ "Q=deltah+W\n",
+ "print(\"Q=\"),round(Q,2)\n",
+ "Q2=Q-Q1\n",
+ "print(\"Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2\")\n",
+ "print(\"so heat transferred to atmosphere(Q2)in KJ/kg of air\"),round(Q2,2)\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.10;pg no:81"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.10, Page:81 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\n",
+ "above problem can be solved using steady flow energy equations upon hot water flow\n",
+ "Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\n",
+ "here total heat to be supplied(Q)in kcal/hr\n",
+ "so heat lost by water(-ve),Q=-25000 kcal/hr\n",
+ "there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\n",
+ "Q+m*(h1+g*z1)=m*(h2+g*z2)\n",
+ "so water circulation rate(m)in kg/hr\n",
+ "so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\n",
+ "water circulation rate=(m)in kg/min 11.91\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of water circulation rate\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.10, Page:81 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10\")\n",
+ "n=500;#total number of persons\n",
+ "q=50;#heat requirement per person in kcal/hr\n",
+ "h1=80;#enthalpy of hot water enter in pipe in kcal/kg\n",
+ "h2=45;#enthalpy of hot water leaves the pipe in kcal/kg\n",
+ "g=9.81;#acceleartion due to gravity in m/s^2\n",
+ "deltaz=10;#difference in elevation of inlet and exit pipe in m\n",
+ "print(\"above problem can be solved using steady flow energy equations upon hot water flow\")\n",
+ "print(\"Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)\")\n",
+ "print(\"here total heat to be supplied(Q)in kcal/hr\")\n",
+ "Q=n*q\n",
+ "print(\"so heat lost by water(-ve),Q=-25000 kcal/hr\")\n",
+ "Q=-25000#heat loss by water in kcal/hr\n",
+ "print(\"there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,\")\n",
+ "print(\"Q+m*(h1+g*z1)=m*(h2+g*z2)\")\n",
+ "print(\"so water circulation rate(m)in kg/hr\")\n",
+ "print(\"so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18\")\n",
+ "m=Q*10**3*4.18/(g*deltaz-(h1-h2)*10**3*4.18)\n",
+ "m=m/60\n",
+ "print(\"water circulation rate=(m)in kg/min\"),round(m,2)\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.11;pg no:81"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.11, Page:81 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\n",
+ "let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\n",
+ "energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\n",
+ "m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\n",
+ "so steam suppling rate(m)in kg/s per kg of water\n",
+ "m= 0.124\n",
+ "NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of steam suppling rate\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.11, Page:81 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11\")\n",
+ "v1=50;#velocity of steam entering injector in m/s\n",
+ "v2=25;#velocity of mixture leave injector in m/s\n",
+ "h1=720;#enthalpy of steam entering injector in kcal/kg\n",
+ "h2=24.6;#enthalpy of water entering injector in kcal/kg\n",
+ "h3=100;#enthalpy of steam leaving injector in kcal/kg\n",
+ "h4=100;#enthalpy of water leaving injector in kcal/kg\n",
+ "deltaz=2;#depth from axis of injector in m\n",
+ "q=12;#heat loss from injector to surrounding through injector\n",
+ "g=9.81;#acceleration due to gravity in m/s^2\n",
+ "print(\"let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted\")\n",
+ "print(\"energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding\")\n",
+ "print(\"m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18\")\n",
+ "print(\"so steam suppling rate(m)in kg/s per kg of water\")\n",
+ "m=((h3*10**3*4.18+v2**2/2)-(h2*10**3*4.18+g*deltaz))/((v1**2/2+h1*10**3*4.18)-(h3*10**3*4.18+v2**2/2)-(q*10**3*4.18))\n",
+ "print(\"m=\"),round(m,3)\n",
+ "print(\"NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.12;pg no:82"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.12, Page:82 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\n",
+ "here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\n",
+ "displacement work, W=(p.dv)cylinder+(p.dv)ballon\n",
+ "(p.dv)cylinder=0,as cylinder is rigid\n",
+ "so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\n",
+ "and work done by atmosphere=KJ 40.52\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of work done by atmosphere\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.12, Page:82 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12\")\n",
+ "p=1.013*10**5;#atmospheric pressure in pa\n",
+ "deltav=0.4;#change in volume in m^3\n",
+ "print(\"here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.\")\n",
+ "print(\"displacement work, W=(p.dv)cylinder+(p.dv)ballon\")\n",
+ "print(\"(p.dv)cylinder=0,as cylinder is rigid\")\n",
+ "print(\"so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000\")\n",
+ "W=(p*deltav)/1000\n",
+ "print(\"and work done by atmosphere=KJ\"),round(W,2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.13;pg no:82"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.13, Page:82 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\n",
+ "work done by turbine(Wt)in J#s is 25% of heat added i.e Wt= 1250.0\n",
+ "heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\n",
+ "Qrejected= 3750.0\n",
+ "and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\n",
+ "Wp=(-) 10.0\n",
+ "capacity of generator(W)=in Kw 1.24\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of capacity of generator\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.13, Page:82 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13\")\n",
+ "Qadd=5000;#heat supplied in boiler in J#s\n",
+ "Wt=.25*Qadd\n",
+ "print(\"work done by turbine(Wt)in J#s is 25% of heat added i.e\"),\n",
+ "print(\"Wt=\"),round(Wt,2)\n",
+ "print(\"heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e\")\n",
+ "Qrejected=.75*Qadd\n",
+ "print(\"Qrejected=\"),round(Qrejected,2)\n",
+ "print(\"and feed water pump work(Wp)in J#s is 0.2% of heat added i.e\")\n",
+ "Wp=0.002*Qadd\n",
+ "print(\"Wp=(-)\"),round(Wp,2)\n",
+ "W=(Wt-Wp)/1000\n",
+ "print(\"capacity of generator(W)=in Kw\"),round(W,2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.14;pg no:83"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.14, Page:83 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\n",
+ "in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\n",
+ "h1+Q1_2=h2\n",
+ "Q1_2=h2-h1\n",
+ "so heat transfer to air in heat exchanger(Q1_2)in KJ\n",
+ "Q1_2= 726.61\n",
+ "in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\n",
+ "h2+C2^2#2=h3+C3^2/2+Wt\n",
+ "Wt=(h2-h3)+(C2^2-C3^2)/2\n",
+ "so power output from turbine(Wt)in KJ#s\n",
+ "Wt= 1.0\n",
+ "applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\n",
+ "h3+C=h4+C4^2/2\n",
+ "C4^2#2=(h3-h4)+C3^2/2\n",
+ "velocity at exit of nozzle(C4)in m#s\n",
+ "C4= 14.3\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of velocity at exit of nozzle\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "import math\n",
+ "print\"Example 3.14, Page:83 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14\")\n",
+ "T1=(27+273);##ambient temperature in K\n",
+ "T2=(750+273);##temperature of heated air inside heat exchanger in K\n",
+ "T3=(600+273);##temperature of hot air leaves turbine in K\n",
+ "T4=(500+273);##temperature at which air leaves nozzle in K\n",
+ "Cp=1.005;##specific heat at constant pressure in KJ#kg K\n",
+ "C2=50;##velocity of hot air enter into gas turbine in m#s\n",
+ "C3=60;##velocity of air leaving turbine enters a nozzle in m#s\n",
+ "print(\"in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,\")\n",
+ "print(\"h1+Q1_2=h2\")\n",
+ "print(\"Q1_2=h2-h1\")\n",
+ "print(\"so heat transfer to air in heat exchanger(Q1_2)in KJ\")\n",
+ "Q1_2=Cp*(T2-T1)\n",
+ "print(\"Q1_2=\"),round(Q1_2,2)\n",
+ "print(\"in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air\")\n",
+ "print(\"h2+C2^2#2=h3+C3^2/2+Wt\")\n",
+ "print(\"Wt=(h2-h3)+(C2^2-C3^2)/2\")\n",
+ "print(\"so power output from turbine(Wt)in KJ#s\")\n",
+ "Wt=Cp*(T2-T3)+(C2**2-C3**2)*10**-3/2\n",
+ "print(\"Wt=\"),round(Cp,2)\n",
+ "print(\"applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,\")\n",
+ "print(\"h3+C=h4+C4^2/2\")\n",
+ "print(\"C4^2#2=(h3-h4)+C3^2/2\")\n",
+ "print(\"velocity at exit of nozzle(C4)in m#s\")\n",
+ "C4=math.sqrt(2*(Cp*(T3-T4)+C3**2*10**-3/2))\n",
+ "print(\"C4=\"),round(C4,2)\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.15;pg no:85"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.15, Page:85 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\n",
+ "for constant pressure heating,say state changes from 1 to 2\n",
+ "Wa=p1*dv\n",
+ "Wa=p1*(v2-v1)\n",
+ "it is given that v2=2v1\n",
+ "so Wa=p1*v1=R*T1\n",
+ "for subsequent expansion at constant temperature say state from 2 to 3\n",
+ "also given that v3/v1=6,v3/v2=3\n",
+ "so work=Wb=p*dv\n",
+ "on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\n",
+ "temperature at 2 can be given by perfect gas consideration as,\n",
+ "T2/T1=v2/v1\n",
+ "or T2=2*T1\n",
+ "now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\n",
+ "so W in KJ= 10632.69\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of total work done by ai\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "import math\n",
+ "print\"Example 3.15, Page:85 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15\")\n",
+ "T1=400;##initial temperature of gas in K\n",
+ "R=8.314;##gas constant in \n",
+ "print(\"for constant pressure heating,say state changes from 1 to 2\")\n",
+ "print(\"Wa=p1*dv\")\n",
+ "print(\"Wa=p1*(v2-v1)\")\n",
+ "print(\"it is given that v2=2v1\")\n",
+ "print(\"so Wa=p1*v1=R*T1\")\n",
+ "print(\"for subsequent expansion at constant temperature say state from 2 to 3\")\n",
+ "print(\"also given that v3/v1=6,v3/v2=3\")\n",
+ "print(\"so work=Wb=p*dv\")\n",
+ "print(\"on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3\")\n",
+ "print(\"temperature at 2 can be given by perfect gas consideration as,\")\n",
+ "print(\"T2/T1=v2/v1\")\n",
+ "print(\"or T2=2*T1\")\n",
+ "print(\"now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ\")\n",
+ "W=R*T1+2*R*T1*math.log(3)\n",
+ "print(\"so W in KJ=\"),round(W,2)\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.16;pg no:85"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.16, Page:85 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\n",
+ "NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \n",
+ "we get W=(Vf-Vi)*((Pi+Pf)/2)\n",
+ "also final volume of gas in m^3 is Vf=3*Vi\n",
+ "now work done by gas(W)in J 750000.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of work done by gas\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.16, Page:85 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16\")\n",
+ "Pi=0.5*10**6;##initial pressure of gas in pa\n",
+ "Vi=0.5;##initial volume of gas in m^3\n",
+ "Pf=1*10**6;##final pressure of gas in pa\n",
+ "print(\"NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further \")\n",
+ "print(\"we get W=(Vf-Vi)*((Pi+Pf)/2)\")\n",
+ "print(\"also final volume of gas in m^3 is Vf=3*Vi\") \n",
+ "Vf=3*Vi\n",
+ "W=(Vf-Vi)*((Pi+Pf)/2)\n",
+ "print(\"now work done by gas(W)in J\"),round(W,2)\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.17;pg no:87"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.17, Page:87 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\n",
+ "with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\n",
+ "adiabatic index of compression of H2 can be obtained as,\n",
+ "Cp_H2=\n",
+ "y_H2=Cp_H2/(Cp_H2-R_H2) 1.4\n",
+ "adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\n",
+ "y_N2= 1.4\n",
+ "i>for hydrogen,p1*v1^y=p2*v2^y\n",
+ "so final pressure of H2(p2)in pa\n",
+ "p2= 1324078.55\n",
+ "ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \n",
+ "partition work=0\n",
+ "iii>work done upon H2(W_H2)in J,\n",
+ "W_H2= -200054.06\n",
+ "work done upon H2(W_H2)=-2*10^5 J\n",
+ "so work done by N2(W_N2)=2*10^5 J \n",
+ "iv>heat added to N2 can be obtained using first law of thermodynamics as\n",
+ "Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\n",
+ "final temperature of N2 can be obtained considering it as perfect gas\n",
+ "therefore, T2=(p2*v2*T1)#(p1*v1)\n",
+ "here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\n",
+ "p2=1.324*10^6 pa,v2=0.75 m^3\n",
+ "so now final temperature of N2(T2)in K= 1191.67\n",
+ "mass of N2(m)in kg= 2.81\n",
+ "specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2= 1.0\n",
+ "heat added to N2,(Q_N2)in KJ\n",
+ "Q_N2= 2052.89\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of \n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.17, Page:87 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17\")\n",
+ "Cp_H2=14.307;##specific heat of H2 at constant pressure in KJ#kg K\n",
+ "R_H2=4.1240;##gas constant for H2 in KJ#kg K\n",
+ "Cp_N2=1.039;##specific heat of N2 at constant pressure in KJ#kg K\n",
+ "R_N2=0.2968;##gas constant for N2 in KJ#kg K\n",
+ "T1=(27+273);##ambient temperature in K\n",
+ "v1=0.5;##initial volume of H2 in m^3\n",
+ "p1=0.5*10**6;##initial pressure of H2 in pa \n",
+ "v2=0.25;##final volume of H2 in m^3 \n",
+ "p2=1.324*10**6;##final pressure of H2 in pa\n",
+ "print(\"with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.\")\n",
+ "print(\"adiabatic index of compression of H2 can be obtained as,\")\n",
+ "print(\"Cp_H2=\")\n",
+ "y_H2=Cp_H2/(Cp_H2-R_H2)\n",
+ "print(\"y_H2=Cp_H2/(Cp_H2-R_H2)\"),round(y_H2,2)\n",
+ "print(\"adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))\")\n",
+ "y_N2=Cp_N2/(Cp_N2-R_N2)\n",
+ "print(\"y_N2=\"),round(y_N2,2)\n",
+ "print(\"i>for hydrogen,p1*v1^y=p2*v2^y\")\n",
+ "print(\"so final pressure of H2(p2)in pa\")\n",
+ "p2=p1*(v1/v2)**y_H2\n",
+ "print(\"p2=\"),round(p2,2)\n",
+ "print(\"ii>since partition remains in equlibrium throughout hence no work is done by partition.it is a case similar to free expansion \")\n",
+ "print(\"partition work=0\")\n",
+ "print(\"iii>work done upon H2(W_H2)in J,\")\n",
+ "W_H2=(p1*v1-p2*v2)/(y_H2-1)\n",
+ "print(\"W_H2=\"),round(W_H2,2)\n",
+ "print(\"work done upon H2(W_H2)=-2*10^5 J\")\n",
+ "W_N2=2*10**5;##work done by N2 in J\n",
+ "print(\"so work done by N2(W_N2)=2*10^5 J \")\n",
+ "print(\"iv>heat added to N2 can be obtained using first law of thermodynamics as\")\n",
+ "print(\"Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2\")\n",
+ "print(\"final temperature of N2 can be obtained considering it as perfect gas\")\n",
+ "print(\"therefore, T2=(p2*v2*T1)#(p1*v1)\")\n",
+ "print(\"here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless\")\n",
+ "print(\"p2=1.324*10^6 pa,v2=0.75 m^3\")\n",
+ "v2=0.75;##final volume of N2 in m^3\n",
+ "T2=(p2*v2*T1)/(p1*v1)\n",
+ "print(\"so now final temperature of N2(T2)in K=\"),round(T2,2)\n",
+ "T2=1191.6;##T2 approx. equal to 1191.6 K\n",
+ "m=(p1*v1)/(R_N2*1000*T1)\n",
+ "print(\"mass of N2(m)in kg=\"),round(m,2)\n",
+ "m=2.8;##m approx equal to 2.8 kg\n",
+ "Cv_N2=Cp_N2-R_N2\n",
+ "print(\"specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2=\"),round(Cv_N2)\n",
+ "print(\"heat added to N2,(Q_N2)in KJ\")\n",
+ "Q_N2=((m*Cv_N2*1000*(T2-T1))+W_N2)/1000\n",
+ "print(\"Q_N2=\"),round(Q_N2,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.18;pg no:88"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.18, Page:88 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\n",
+ "let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\n",
+ "initial mass of air(m1)in kg\n",
+ "m1= 9.29\n",
+ "for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\n",
+ "T2=in K 237.64\n",
+ "final mass of air left in tank(m2)in kg\n",
+ "m2= 2.97\n",
+ "writing down energy equation for unsteady flow system\n",
+ "(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\n",
+ "or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\n",
+ "kinetic energy available for running turbine(W)in KJ\n",
+ "W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n",
+ "W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\n",
+ "amount of work available=KJ 482.67\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of amount of work available\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.18, Page:88 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18\")\n",
+ "p1=0.5*10**6;#initial pressure of air in pa\n",
+ "p2=1.013*10**5;#atmospheric pressure in pa\n",
+ "v1=2;#initial volume of air in m^3\n",
+ "v2=v1;#final volume of air in m^3\n",
+ "T1=375;#initial temperature of air in K\n",
+ "Cp_air=1.003;#specific heat at consatnt pressure in KJ/kg K\n",
+ "Cv_air=0.716;#specific heat at consatnt volume in KJ/kg K\n",
+ "R_air=0.287;#gas constant in KJ/kg K\n",
+ "y=1.4;#expansion constant for air\n",
+ "print(\"let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder\")\n",
+ "print(\"initial mass of air(m1)in kg\")\n",
+ "m1=(p1*v1)/(R_air*1000*T1)\n",
+ "print(\"m1=\"),round(m1,2)\n",
+ "print(\"for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure\")\n",
+ "T2=T1*(p2/p1)**((y-1)/y)\n",
+ "print(\"T2=in K\"),round(T2,2)\n",
+ "print(\"final mass of air left in tank(m2)in kg\")\n",
+ "m2=(p2*v2)/(R_air*1000*T2)\n",
+ "print(\"m2=\"),round(m2,2)\n",
+ "print(\"writing down energy equation for unsteady flow system\")\n",
+ "print(\"(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)\")\n",
+ "print(\"or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2\")\n",
+ "print(\"kinetic energy available for running turbine(W)in KJ\")\n",
+ "print(\"W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n",
+ "print(\"W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2\")\n",
+ "W=((m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2)/1000\n",
+ "print(\"amount of work available=KJ\"),round(W,2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.19;pg no:89"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.19, Page:89 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\n",
+ "using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\n",
+ "n1= 0.1\n",
+ "now n2= 0.12\n",
+ "for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\n",
+ "deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\n",
+ "final temperature of gas(T3)in K\n",
+ "T3= 409.09\n",
+ "using perfect gas equation for final mixture,\n",
+ "final pressure of gas(p3)in Mpa\n",
+ "p3= 750000.0\n",
+ "so final pressure and temperature =0.75 Mpa and 409.11 K\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of final pressure and temperature\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.19, Page:89 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19\")\n",
+ "p1=0.5*10**6;#initial pressure of air in pa\n",
+ "v1=0.5;#initial volume of air in m^3\n",
+ "T1=(27+273);#initial temperature of air in K\n",
+ "p2=1*10**6;#final pressure of air in pa\n",
+ "v2=0.5;#final volume of air in m^3\n",
+ "T2=500;#final temperature of air in K\n",
+ "R=8314;#gas constant in J/kg K\n",
+ "Cv=0.716;#specific heat at constant volume in KJ/kg K\n",
+ "print(\"using perfect gas equation for the two chambers having initial states as 1 and 2 and final states as 3\")\n",
+ "n1=(p1*v1)/(R*T1)\n",
+ "print(\"n1=\"),round(n1,2)\n",
+ "n2=(p2*v2)/(R*T2)\n",
+ "print(\"now n2=\"),round(n2,2)\n",
+ "print(\"for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,\")\n",
+ "deltaU=0;#change in internal energy\n",
+ "print(\"deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)\")\n",
+ "print(\"final temperature of gas(T3)in K\")\n",
+ "T3=(deltaU+Cv*(n1*T1+n2*T2))/(Cv*(n1+n2))\n",
+ "print(\"T3=\"),round(T3,2)\n",
+ "print(\"using perfect gas equation for final mixture,\")\n",
+ "print(\"final pressure of gas(p3)in Mpa\")\n",
+ "p3=((n1+n2)*R*T3)/(v1+v2)\n",
+ "print(\"p3=\"),round(p3,3)\n",
+ "print(\"so final pressure and temperature =0.75 Mpa and 409.11 K\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.20;pg no:90"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.20, Page:90 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\n",
+ "printlacement work,W=p*(v1-v2)in N.m -50675.0\n",
+ "so heat transfer(Q)in N.m\n",
+ "Q=-W 50675.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of heat transfer\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.20, Page:90 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20\")\n",
+ "v1=0;#initial volume of air inside bottle in m^3\n",
+ "v2=0.5;#final volume of air inside bottle in m^3\n",
+ "p=1.0135*10**5;#atmospheric pressure in pa\n",
+ "W=p*(v1-v2)\n",
+ "print(\"printlacement work,W=p*(v1-v2)in N.m\"),round(W,2)\n",
+ "print(\"so heat transfer(Q)in N.m\")\n",
+ "Q=-W\n",
+ "print(\"Q=-W\"),round(Q,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.21;pg no:90"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.21, Page:90 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\n",
+ "here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\n",
+ "(p2/p1)^((y-1)/y)=(T2/T1)\n",
+ "final temperature of air(T2)in K\n",
+ "T2= 113.34\n",
+ "by perfect gas law,initial mass in bottle(m1)in kg\n",
+ "m1= 11.69\n",
+ "final mass in bottle(m2)in kg\n",
+ "m2= 0.92\n",
+ "energy available for running turbo generator or work(W)in KJ\n",
+ "W+(m1-m2)*h2=m1*u1-m2*u2\n",
+ "W= 1325.42\n",
+ "this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\n",
+ "turbogenerator actual output(P1)=5 KJ/s\n",
+ "input to turbogenerator(P2)in KJ/s\n",
+ "time duration for which turbogenerator can be run(deltat)in seconds\n",
+ "deltat= 159.05\n",
+ "duration=160 seconds approx.\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of time duration for which turbogenerator can be run\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.21, Page:90 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21\")\n",
+ "p1=35.*10**5;#initial pressure of air in pa\n",
+ "v1=0.3;#initial volume of air in m^3\n",
+ "T1=(313.);#initial temperature of air in K\n",
+ "p2=1.*10**5;#final pressure of air in pa\n",
+ "v2=0.3;#final volume of air in m^3\n",
+ "y=1.4;#expansion constant\n",
+ "R=0.287;#gas constant in KJ/kg K\n",
+ "Cv=0.718;#specific heat at constant volume in KJ/kg K\n",
+ "Cp=1.005;#specific heat at constant pressure in KJ/kg K\n",
+ "print(\"here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.\")\n",
+ "print(\"(p2/p1)^((y-1)/y)=(T2/T1)\")\n",
+ "print(\"final temperature of air(T2)in K\")\n",
+ "T2=T1*(p2/p1)**((y-1)/y)\n",
+ "print(\"T2=\"),round(T2,2)\n",
+ "print(\"by perfect gas law,initial mass in bottle(m1)in kg\")\n",
+ "m1=(p1*v1)/(R*1000.*T1)\n",
+ "print(\"m1=\"),round(m1,2)\n",
+ "print(\"final mass in bottle(m2)in kg\")\n",
+ "m2=(p2*v2)/(R*1000.*T2)\n",
+ "print(\"m2=\"),round(m2,2)\n",
+ "print(\"energy available for running turbo generator or work(W)in KJ\")\n",
+ "print(\"W+(m1-m2)*h2=m1*u1-m2*u2\")\n",
+ "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n",
+ "print(\"W=\"),round(W,2)\n",
+ "print(\"this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits\")\n",
+ "print(\"turbogenerator actual output(P1)=5 KJ/s\")\n",
+ "P1=5;#turbogenerator actual output in KJ/s\n",
+ "print(\"input to turbogenerator(P2)in KJ/s\")\n",
+ "P2=P1/0.6\n",
+ "print(\"time duration for which turbogenerator can be run(deltat)in seconds\")\n",
+ "deltat=W/P2\n",
+ "print(\"deltat=\"),round(deltat,2)\n",
+ "print(\"duration=160 seconds approx.\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.22;pg no:91"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 27,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.22, Page:91 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\n",
+ "different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\n",
+ "process 1-2 is polytropic process with index 1.2\n",
+ "(T2/T1)=(p2/p1)^((n-1)/n)\n",
+ "final temperature of air(T2)in K\n",
+ "T2= 457.68\n",
+ "at state 1,p1*v1=m*R*T1\n",
+ "initial volume of air(v1)in m^3\n",
+ "v1= 2.01\n",
+ "final volume of air(v2)in m^3\n",
+ "for process 1-2,v2= 0.53\n",
+ "for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\n",
+ "v3=v2*T3/T2 in m^3\n",
+ "here process 3-1 is isothermal process so T1=T3\n",
+ "during process 1-2 the compression work(W1_2)in KJ\n",
+ "W1_2=(m*R*(T2-T1)/(1-n))\n",
+ "work during process 2-3(W2_3)in KJ,\n",
+ "W2_3=p2*(v3-v2)/1000\n",
+ "work during process 3-1(W3_1)in KJ\n",
+ "W3_1= 485.0\n",
+ "net work done(W_net)in KJ\n",
+ "W_net=W1_2+W2_3+W3_1 -71.28\n",
+ "net work=-71.27 KJ\n",
+ "here -ve workshows work done upon the system.since it is cycle,so\n",
+ "W_net=Q_net\n",
+ "phi dW=phi dQ=-71.27 KJ\n",
+ "heat transferred from system=71.27 KJ\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of network,heat transferred from system\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "import math\n",
+ "print\"Example 3.22, Page:91 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22\")\n",
+ "p1=1.5*10**5;#initial pressure of air in pa\n",
+ "T1=(77+273);#initial temperature of air in K\n",
+ "p2=7.5*10**5;#final pressure of air in pa\n",
+ "n=1.2;#expansion constant for process 1-2\n",
+ "R=0.287;#gas constant in KJ/kg K\n",
+ "m=3.;#mass of air in kg\n",
+ "print(\"different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram\")\n",
+ "print(\"process 1-2 is polytropic process with index 1.2\")\n",
+ "print(\"(T2/T1)=(p2/p1)^((n-1)/n)\")\n",
+ "print(\"final temperature of air(T2)in K\")\n",
+ "T2=T1*((p2/p1)**((n-1)/n))\n",
+ "print(\"T2=\"),round(T2,2)\n",
+ "print(\"at state 1,p1*v1=m*R*T1\")\n",
+ "print(\"initial volume of air(v1)in m^3\")\n",
+ "v1=(m*R*1000*T1)/p1\n",
+ "print(\"v1=\"),round(v1,2)\n",
+ "print(\"final volume of air(v2)in m^3\")\n",
+ "v2=((p1*v1**n)/p2)**(1/n)\n",
+ "print(\"for process 1-2,v2=\"),round(v2,2)\n",
+ "print(\"for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3\")\n",
+ "print(\"v3=v2*T3/T2 in m^3\")\n",
+ "print(\"here process 3-1 is isothermal process so T1=T3\")\n",
+ "T3=T1;#process 3-1 is isothermal\n",
+ "v3=v2*T3/T2\n",
+ "print(\"during process 1-2 the compression work(W1_2)in KJ\")\n",
+ "print(\"W1_2=(m*R*(T2-T1)/(1-n))\")\n",
+ "W1_2=(m*R*(T2-T1)/(1-n))\n",
+ "print(\"work during process 2-3(W2_3)in KJ,\")\n",
+ "print(\"W2_3=p2*(v3-v2)/1000\")\n",
+ "W2_3=p2*(v3-v2)/1000\n",
+ "print(\"work during process 3-1(W3_1)in KJ\")\n",
+ "p3=p2;#pressure is constant for process 2-3\n",
+ "W3_1=p3*v3*math.log(v1/v3)/1000\n",
+ "print(\"W3_1=\"),round(W3_1,2)\n",
+ "print(\"net work done(W_net)in KJ\")\n",
+ "W_net=W1_2+W2_3+W3_1\n",
+ "print(\"W_net=W1_2+W2_3+W3_1\"),round(W_net,2)\n",
+ "print(\"net work=-71.27 KJ\")\n",
+ "print(\"here -ve workshows work done upon the system.since it is cycle,so\")\n",
+ "print(\"W_net=Q_net\")\n",
+ "print(\"phi dW=phi dQ=-71.27 KJ\")\n",
+ "print(\"heat transferred from system=71.27 KJ\")\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.23;pg no:93"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.23, Page:93 \n",
+ " \n",
+ "\n",
+ "Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\n",
+ "initial mass of air in bottle(m1)in kg \n",
+ "m1= 6.97\n",
+ "now final temperature(T2)in K\n",
+ "T2= 0.0\n",
+ "final mass of air in bottle(m2)in kg\n",
+ "m2= 0.82\n",
+ "energy available for running of turbine due to emptying of bottle(W)in KJ\n",
+ "W= 639.09\n",
+ "work available from turbine=639.27KJ\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of work available from turbine\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.23, Page:93 \\n \\n\"\n",
+ "print(\"Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23\")\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",
+ "y=1.4;#expansion constant \n",
+ "p1=40*10**5;#initial temperature of air in pa\n",
+ "v1=0.15;#initial volume of air in m^3\n",
+ "T1=(27+273);#initial temperature of air in K\n",
+ "p2=2*10**5;#final temperature of air in pa\n",
+ "v2=0.15;#final volume of air in m^3\n",
+ "R=0.287;#gas constant in KJ/kg K\n",
+ "print(\"initial mass of air in bottle(m1)in kg \")\n",
+ "m1=(p1*v1)/(R*1000*T1)\n",
+ "print(\"m1=\"),round(m1,2)\n",
+ "print(\"now final temperature(T2)in K\")\n",
+ "T2=T1*(p2/p1)**((y-1)/y)\n",
+ "print(\"T2=\"),round(T2,2)\n",
+ "T2=127.36;#take T2=127.36 approx.\n",
+ "print(\"final mass of air in bottle(m2)in kg\")\n",
+ "m2=(p2*v2)/(R*1000*T2)\n",
+ "print(\"m2=\"),round(m2,2)\n",
+ "m2=0.821;#take m2=0.821 approx.\n",
+ "print(\"energy available for running of turbine due to emptying of bottle(W)in KJ\")\n",
+ "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n",
+ "print(\"W=\"),round(W,2)\n",
+ "print(\"work available from turbine=639.27KJ\")\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
+}