{ "metadata": { "name": "", "signature": "sha256:8d4c3e3e1406cca57fa7a5e5be30daeeb95ae0c1a8fcd1dccf25d2f1f8ce833d" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 3: First Law of Thermodynyamics" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1, page no. 76" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "#Variable Declaration: \n", "#Pressure in the gas cylinder(in kPa):\n", "p=689\n", "#Final volume(in m**3):\n", "v2=0.045\n", "#Initial volume(in m**3):\n", "v1=0.04\n", "#Work done by the paddle(in kJ):\n", "Pw=-4.88\n", "\n", "#Calculation:\n", "#Work done by the system on the piston(in kJ):\n", "w=p*(v2-v1)\n", "#Net Work of the system(in kJ):\n", "wn=w+Pw\n", "\n", "#Results:\n", "print \"Work done on the piston in kJ: \",w\n", "print \"Work done on the system in kJ: \",-wn" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Work done on the piston in kJ: 3.445\n", "Work done on the system in kJ: 1.435\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2, page no. 76" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "#Variable Declaration: \n", "#Mass of the gas(in kg):\n", "m=0.5\n", "#Initial internal energy(in kJ/kg):\n", "u1=26.6\n", "#Final internal energy(in kJ/kg):\n", "u2=37.8\n", "\n", "#Calculation:\n", "#Heat required(in kJ):\n", "Q=(u2-u1)*m\n", "\n", "#Results: \n", "print \"Heat required (kJ): \",Q" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Heat required (kJ): 5.6\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3, page no. 77" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "#Variable Declaration: \n", "#Mass flow rate(in kg/hr):\n", "m=50\n", "#Initial temp(in C):\n", "t1=800\n", "#Final temp(in C):\n", "t2=50\n", "#Heat capacity at const pressure(in kJ/kg.K):\n", "Cp=1.08\n", "\n", "#Calculation:\n", "#Heat to be removed(in kJ/hr):\n", "Q=m*Cp*(t2-t1)\n", "\n", "#Results: \n", "print \"Heat should be removed at (kJ/hr): \",-Q" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Heat should be removed at (kJ/hr): 40500.0\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4, page no. 77" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "#Variable Declaration: \n", "#Volume of the cylinnder(in m**3):\n", "v=0.78\n", "#Atmospheric pressure(in kPa):\n", "p=101.325\n", "\n", "#Calculation:\n", "#Work done(in kJ):\n", "w=round(p*v,2)\n", "\n", "#Results: \n", "print \"Work done by air (KJ): \",-w\n", "print \"Work done by surroundings (KJ): \",w" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Work done by air (KJ): -79.03\n", "Work done by surroundings (KJ): 79.03\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5, page no. 77" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable Declaration: \n", "#Mass of the gas(in kg):\n", "m=5\n", "#Value of n in P*(V**n)=const:\n", "n=1.3\n", "#Initial pressure(in MPa):\n", "p1=1\n", "#Initial volume(in m**3):\n", "v1=0.5\n", "#Final pressure(in MPa):\n", "p2=0.5\n", "\n", "#Calculation:\n", "#Final volume(in m**3):\n", "v2=round(v1*((p1/p2)**(1/n)),3)\n", "#Work done(in kJ):\n", "w=(p2*v2-p1*v1)*10**3/(1-n)\n", "#Change in internal energy(in kJ/kg):\n", "du=1.8*(p2*v2-p1*v1)*10**3\n", "#Heat interaction(in kJ):\n", "Q=du+w\n", "\n", "#Results: \n", "print \"Heat interaction (kJ): \",round(Q,1)\n", "print \"Work interaction (kJ): \",round(w,1)\n", "print \"Change in internal energy (kJ): \",round(du,1)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Heat interaction (kJ): 113.5\n", "Work interaction (kJ): 246.7\n", "Change in internal energy (kJ): -133.2\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 6, page no. 78" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable Declaration: \n", "#Initial pressure(in MPa):\n", "p1=1.0\n", "#Final pressure(in MPa):\n", "p2=2.0\n", "#Initial volume(in m**3):\n", "v1=0.05\n", "#Value of n:\n", "n=1.4\n", "\n", "#Calculation:\n", "#Final volume(in m**3):\n", "v2=round(v1*((p1/p2)**(1/n)),2)\n", "\n", "#Change in internal energy(in kJ/kg):\n", "du=7.5*(p2*v2-p1*v1)*10**3\n", "#Work done(in kJ):\n", "w=(p2*v2-p1*v1)*10**3/(1-n)\n", "#Heat interaction(in kJ):\n", "Q=du+w\n", "\n", "#Results: \n", "print \"Heat interaction (kJ): \",Q\n", "print \"Work interaction (kJ): \",w\n", "print \"Change in internal energy (kJ): \",du\n", "\n", "#If 180 kJ heat transfer takes place:\n", "#Work done(in kJ):\n", "w2=180-du\n", "print \"New work (kJ): \",w2" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Heat interaction (kJ): 50.0\n", "Work interaction (kJ): -25.0\n", "Change in internal energy (kJ): 75.0\n", "New work (kJ): 105.0\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7, page no. 79" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable Declaration:\n", "#Universal Gas Constant (in KJ.mol/Kg.K):\n", "r=8.3143\n", "#Molecular weight of perfect gas:\n", "M=16\n", "#Molar specific heat at constant pressure for perfect gas(KJ/Kg.K):\n", "Cp=1.7\n", "#Initial pressure (Kpa):\n", "p1=101.3\n", "#Final pressure (Kpa):\n", "p2 = 600\n", "#Initial tempreture (K):\n", "T1 = 273+20\n", "#Polytripic index from PV^1.3 = const\n", "n = 1.3\n", "\n", "#Calculations:\n", "#Characterstic Gas Constant (KJ/Kg.K):\n", "R=r/M\n", "#Molar specific heat at constant volume for perfect gas(KJ/Kg.K):\n", "Cv=Cp-R\n", "#Specific heat ratio:\n", "y = Cp/Cv\n", "#Final Tempreture (K):\n", "T2 = T1*(p2/p1)**((n-1)/n)\n", "#Polytropic work (KJ/Kg):\n", "W = R*(T1-T2)/(n-1)\n", "#Polytropic process heat (KJ/Kg):\n", "Q = W*(y-n)/(y-1)\n", "\n", "#Results:\n", "print \"Heat transfered (KJ/Kg): \",round(Q,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Heat transfered (KJ/Kg): -82.06\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 8, page no. 80" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math as m\n", "\n", "#Variable Declaration: \n", "#Initial temperature(in K):\n", "t1=627+273\n", "#Final temperature(in K):\n", "t2=27+273\n", "#Specific heat at const pressure(in kJ/kg.K):\n", "Cp=1.005\n", "\n", "#Calculation\n", "#Exit velocity(in m/s):\n", "c2=m.sqrt(2*Cp*10**3*(t1-t2))\n", "\n", "#Results: \n", "print \"Exit Velocity (m/s): \" ,round(c2,1)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Exit Velocity (m/s): 1098.2\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 9, page no. 80" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable Declaration: \n", "#Work interaction(in kJ):\n", "w=-200\n", "#Increase in enthalpy(in kJ/kg):\n", "dh=100\n", "#Heat picked up by the cooling water(in kJ/kg):\n", "qc=-90\n", "\n", "#Calculation:\n", "#Heat flow(in kJ/kg):\n", "Q=dh+w\n", "#Heat transferred to atmosphere(in kJ/kg):\n", "Qa=Q-qc\n", "\n", "#Results: \n", "print \"Heat transferred to atmosphere (kJ/kg): \",Qa" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Heat transferred to atmosphere (kJ/kg): -10\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 10, page no. 81" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "#Variable Declaration: \n", "c=500 #Seating capacity:\n", "q=50 #Heat requirement per person(in kcal/hr):\n", "h1=80 #Enthalpy of water entering the pipe(in kcal/kg):\n", "h2=45 #Enthalpy of water leaving the pipe(in kcal/kg):\n", "z=10 #Difference in elevation of inlet and exit pipe(in m):\n", "g=9.81 #Acceleration due to gravity(in m/s**2):\n", "\n", "#Calculation:\n", "Q=c*q #Heat to be supplied(in kcal/hr):\n", "Ql=-Q #Heat lost by water(in kcal/kg):\n", "m=(Ql*10**3*4.18)/(g*z+(h2-h1)*10**3*4.18) #Quantity of water circulated(in kg/hr):\n", "\n", "\n", "#Results: \n", "print \"Water circulation rate (kg/min):\",round(m/60,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Water circulation rate (kg/min): 11.91\n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 11, page no. 81" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable Declaration: \n", "h1=720.0 #Enthalpy of steam entering the injector(in kcal/kg):\n", "h2=24.6 #Enthalpy of water entering(in kcal/kg):\n", "h3=100.0 #Enthalpy of water and steam mixture leaving the injector(in kcal/kg):\n", "z=2.0 #Depth of water injector from steam injector(in m):\n", "v1=50.0 #Velocity of steam entering the injector(in m/s):\n", "v3=25.0 #Velocity of mixture leaving the injector(in m/s):\n", "q=12.0 #Heat loss from injector to surroundings(in kcal/kg):\n", "g=9.8 #Acceleration due to gravity (m/s^2):\n", "\n", "\n", "#Calculation:\n", "m=(((v3**2)/2+h3*10**3*4.18)-(h2*10**3*4.18+g*z))/(((v1**2)/2+h1*10**3*4.18)-((v3**2)/2+h3*10**3*4.18)-(q*10**3*4.18))\n", "\n", "#Results: \n", "print \"Steam supply rate (kg/s): \",round(m,3)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Steam supply rate (kg/s): 0.124\n" ] } ], "prompt_number": 11 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 12, page no. 82" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "#Variable Declaration: \n", "p=1.013 #Atmospheric pressure(in bar):\n", "v=0.4 #Volume to which the baloon is inflated(in m**3):\n", "w1=0 #Work done by cylinder(in kJ):\n", "\n", "#Calculation:\n", "w2=p*10**5*v #Work done by the balloon(in kJ):\n", "w=w1+w2 #Total work(in kJ):\n", "\n", "\n", "#Results: \n", "print \"Work done by the system upon atmoshere (KJ): \",w/(10**3)\n", "print \"Work done by the atmoshere (KJ): \",-w/(10**3)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Work done by the system upon atmoshere (KJ): 40.52\n", "Work done by the atmoshere (KJ): -40.52\n" ] } ], "prompt_number": 12 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 13, page no. 82" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable Declaration: \n", "Qa=5000 #Heat added(in J/s):\n", "\n", "#Calculation:\n", "Wt=0.25*Qa #Turbine work(in J/s):\n", "Qr=0.75*Qa #Heat rejected(in J/s):\n", "Wp=0.002*Qa #Work by feed pump(in J/s):\n", "C=Wt-Wp #Capacity of generator(in W):\n", "\n", "#Results: \n", "print \"Capacity of generator (KW): \",C/(10**3)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Capacity of generator (KW): 1.24\n" ] } ], "prompt_number": 13 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 14, page no. 83" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math as m\n", "\n", "#Variable Declaration: \n", "T1=27+273 #Ambient temperature(in K):\n", "T2=750+273 #Temperature of air inside heat exchanger(in K):\n", "T3=600+273 #Temperature of air leaving turbine(in K):\n", "T4=500+273 #Temperature of air leaving turbine(in K):\n", "c2=50 #Velocity of air entering turbine(in m/s):\n", "c3=60 #Velocity of air entering the nozzle(in m/s):\n", "Cp=1.005#Specific heat at constant pressure(in kj?kg.K):\n", "\n", "\n", "#Calculation:\n", "Q12=Cp*(T2-T1) #Heat transfer to air in heat exchanger(in kJ):\n", "Wt=Cp*(T2-T3)+(c2**2-c3**2)*10**(-3)/2 #Power output from turbine(in kJ/s):\n", "c4=m.sqrt(2*(Cp*(T3-T4)+(c3**2)*10**(-3)/2))#Velocity at exit of the nozzle(in m/s):\n", "\n", "#Results: \n", "print \"Heat transfer to air in heat exchanger (KJ): \",round(Q12,2)\n", "print \"Power output from turbine (KJ/s): \",Wt\n", "print \"Velocity at exit of the nozzle (m/s): \",round(c4,1)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Heat transfer to air in heat exchanger (KJ): 726.61\n", "Power output from turbine (KJ/s): 150.2\n", "Velocity at exit of the nozzle (m/s): 14.3\n" ] } ], "prompt_number": 14 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 15, page no. 85" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math as m\n", "\n", "#Variable Declaration: \n", "p1=0.5 #Initial pressure(in MPa):\n", "T1=400 #Initial temperature(in K):\n", "r1=2 #Ratio of v2 to v1:\n", "r2=6 #Ratio of v3 to v1:\n", "R=8.314 #Universal gas constant(in kJ/kg):\n", "\n", "#Calculation:\n", "Wa=R*T1 #Work from state 1 to 2(in kJ):\n", "T2=2*T1 #Temperature at point 2(in K):\n", "Wb=R*T2*m.log(r2/r1) #Work done from state 2 to 3(in kJ):\n", "W=Wa+Wb#Total work done by air(in kJ):\n", "\n", "#Results: \n", "print \"Work done (KJ): \",round(W,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Work done (KJ): 10632.69\n" ] } ], "prompt_number": 15 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 16, page no. 85" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable Declaration: \n", "pi=0.5*10**6 #Initial pressure(in Pa):\n", "vi=0.5 #Initial volume(in m**3):\n", "pf=1*10**6 #Final pressure(in Pa):\n", "patm=1.013*10**5 #Atmospheric pressure(in Pa):\n", "\n", "#Calculation:\n", "vf=3*vi #Final volume(in m**3):\n", "W=(vf-vi)*(pi+pf)/2 #Work done(in J):\n", "\n", "#Results: \n", "print \"Work done (MJ): \",W/10**6" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Work done (MJ): 0.75\n" ] } ], "prompt_number": 16 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 17, page no. 87" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable Declaration: \n", "p1=0.5*10**6 #Initial pressure(in Pa):\n", "pf=1*10**6 #Final pressure(in Pa):\n", "v1=0.5 #Initial volume(in m**3):\n", "v2=0.25 #Final volume(in m**3):\n", "vN2=0.75#Final Nitrogen volume(in m**3):\n", "T1=273+27#Initial Tempereature (K):\n", "patm=1.013*10**5 #Atmospheric pressure(in Pa):\n", "CpH2=14.307 #Cp of hydrogen (KJ/Kg)\n", "CpN2=1.039 #Cp of hydrogen (KJ/Kg)\n", "RN2=0.2968\n", "RH2=4.1240 \n", "\n", "#Calculations:\n", "rH2=CpH2/(CpH2-RH2) #Adiabatic index of compression for H2:\n", "rN2=CpN2/(CpN2-RN2) #Adiabatic index of compression for N2:\n", "p2=p1*(v1/v2)**rH2 #Final pressure of hydrogen(in Pa):\n", "Pw=0 #Partition work:\n", "WH2=(p1*v1-p2*v2)/(rH2-1) #Work done upon H2(in J):\n", "WN2=-WH2 #Work done by nitrogen(in J):\n", "mN2=round(p1*v1/(RN2*10**3*T1),1) #Mass of N2(in kg):\n", "T2=p2*vN2*T1/(p1*v1) #Final temperature of N2(in K):\n", "CvN2=CpN2-RN2 #Cv of N2(in kJ/kg):\n", "QN2=mN2*CvN2*10**3*(T2-T1)+WN2 #Heat added to N2(in kJ):\n", "\n", "#Results: \n", "print \"Final pressure of hydrogen (MPa): \",round(p2/(10**6),3)\n", "print \"Partition work (KJ): \",Pw\n", "print \"Work done by hyrogen (10^5 J): \",round(WH2/10**5)\n", "print \"Work done by nitrogen (10^5 J): \",round(WN2/10**5)\n", "print \"Heat added to nitrogen (kJ): \",round(QN2/(10**3),2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Final pressure of hydrogen (MPa): 1.324\n", "Partition work (KJ): 0\n", "Work done by hyrogen (10^5 J): -2.0\n", "Work done by nitrogen (10^5 J): 2.0\n", "Heat added to nitrogen (kJ): 2053.09\n" ] } ], "prompt_number": 18 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 18, page no. 88" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable Declaration: \n", "v1=2 #Volume of the cylinder(in m**3):\n", "p1=0.5*10**6 #Pressure in the cylinder(in Pa):\n", "T1=375 #Temperature of the cylinder(in K):\n", "Cp=1.003 #Specific heat at const pressure(in kJ/kg.K):\n", "Cv=0.716 #Specific heat at const volume(in kJ/kg.K):\n", "Ra=0.287 #Gas constant for air(in kJ/kg.K):\n", "patm=1.013*10**5 #Atmospheric pressure(in Pa):\n", "r=1.4 #Compression ratio:\n", "\n", "#Calculation:\n", "m1=p1*v1/(Ra*T1) #Initial mass of air(in kg):\n", "T2=T1*(patm/p1)**((r-1)/r) #Final temperature(in K):\n", "m2=patm*v1/(Ra*T2) #Final mass of air left in tank(in kg):\n", "KE=m1*Cv*T1-m2*Cv*T2-(m1-m2)*Cp*T2 #Kinetic energy available(in kJ):\n", "\n", "#Results: \n", "print \"Amount of work available (KJ): \",round(KE/10**3,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Amount of work available (KJ): 482.67\n" ] } ], "prompt_number": 19 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 19, page no. 89" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable Declaration: \n", "p1=0.5*10**6 #Pressure in the vessel(in Pa):\n", "v1=0.5 #Volume of 1st chamber(in m**3):\n", "T1=300 #Temperature in the vessel(in K):\n", "p2=10**6 #Final pressure(in Pa):\n", "v2=0.5 #Volume of 2nd chamber(in m**3):\n", "T2=500 #Final temperature(in K):\n", "R=8314 #Universal gas constant(in J/kg.K):\n", "\n", "#Calculation:\n", "n1=p1*v1/(R*T1) #Moles in chamber 1:\n", "n2=p2*v2/(R*T2) #Moles in chamber 2:\n", "T3=(n1*T1+n2*T2)/(n1+n2) #Temperature of the mixture(in K):\n", "p3=(n1+n2)*R*T3/(v1+v2) #Final pressure(in MPa):\n", "\n", "\n", "#Results: \n", "print \"Final pressure (MPa): \",p3/(10**6)\n", "print \"Final temperature (K): \",round(T3,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Final pressure (MPa): 0.75\n", "Final temperature (K): 409.09\n" ] } ], "prompt_number": 20 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 20, page no. 90" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "\n", "#Variable Declaration: \n", "v=0.5 #Volume of the bottle(in m**3):\n", "p=1.0135 #Pressure in the bottle(in Bar):\n", "\n", "#Calculation:\n", "W=p*10**5*(0-v) #Displacement work(in N-m):\n", "Q=-W #Heat transfer(in N-m):\n", "\n", "#Results: \n", "print \"Heat transferred (N-m): \",Q" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Heat transferred (N-m): 50675.0\n" ] } ], "prompt_number": 21 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 21, page no. 90" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable Declaration: \n", "v1=0.3 #Volume of bottle(in m**3):\n", "p1=35.0 #Pressure in the bottle(in bar):\n", "T1=40.0+273.0 #Temperature in the bottle(in K):\n", "w1=5.0 #Turbo generator's actual output(in kJ/s):\n", "p2=1.0 #Final prssure(in bar):\n", "v2=v1 #Final volume(in m**3):\n", "Ra=0.287 #Gas constant for air(in kJ/kg.K):\n", "r=1.4 #Compression ratio:\n", "Cv=0.718 #Specific heat at const volume(in kJ/kg):\n", "Cp=1.005 #Specific heat at const pressure(in kJ/kg):\n", "\n", "#Calculation:\n", "T2=T1*(p2/p1)**((r-1)/r) #Final temperature(in K):\n", "m1=p1*10**2*v1/(Ra*T1) #Initial mass in the bottle(in kg):\n", "m2=p2*10**2*v2/(Ra*T2) #Final mass in the bottle(in kg):\n", "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2 #Maximum work that can be obtained(in kJ):\n", "i=w1/0.6 #Input to the turbo generator(in kJ/s):\n", "t=W/round(i,2) #Time duration(in s):\n", "\n", "#Results: \n", "print \"Duration (Seconds): \",round(t,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Duration (Seconds): 159.11\n" ] } ], "prompt_number": 22 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 22, page no. 91" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math as M\n", "#Variable Declaration: \n", "p1=1.5 #Pressure at state 1(in bar):\n", "T1=77+273 #Temperature at state 1(in K):\n", "p2=7.5 #Pressure at state 2(in bar):\n", "m=3 #Mass of the air(in kg):\n", "n=1.2 #Value of n:\n", "Ra=0.287 \n", "\n", "#Calculation:\n", "T2=T1*(p2/p1)**((n-1)/n) #Temperature at state 2(in K):\n", "v1=m*Ra*T1/(p1*10**2) #Initial volume(in m**3):\n", "v2=(p1*(v1**n)/p2)**(1/n) #Volume at state 2(in m**3):\n", "T3=T1 #Temperature at state 3(in K):\n", "v3=v2*T3/T2 #Volume at state 3(in m**3):\n", "p3=7.5 #Pressure at state 3(in bar):\n", "W12=m*Ra*(T2-T1)/(1-n) #Compression work during process 1-2(in kJ):\n", "W23=p2*(10**2)*(v3-v2) #Work during process 2-3(in kJ):\n", "W31=p3*10**2*v3*M.log(v1/v3) #Work during process 3-1(in kJ):\n", "Wn=W12+W23+W31 #Net work(in kJ):\n", "\n", "#Results: \n", "print \"Heat transferred from the system (kJ): \",round(-Wn,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Heat transferred from the system (kJ): 71.28\n" ] } ], "prompt_number": 23 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 23, page no. 93" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable Declaration: \n", "v1=0.15 #Volume of air bottle(in m**3):\n", "p1=40 #Initial pressure(in bar):\n", "T1=27+273 #Initial temperature(in K):\n", "p2=2.0 #Final presure(in bar):\n", "Ra=0.287 #Gas constant for air(in kJ/kg):\n", "Cp=1.005 #Specific heat at const pressure(in kJ/kg):\n", "Cv=0.718 #Specific heat at const volume(in kJ/kg):\n", "r=1.4 #Compression ratio:\n", "\n", "#Calculation:\n", "v2=v1 #Final volume(in m**3):\n", "m1=p1*10**2*v1/(Ra*T1) #Initial mass of air in bottle(in kg):\n", "T2=T1*(p2/p1)**((r-1)/r) #Final temperature(in K):\n", "m2=p2*10**2*v2/(Ra*T2) #Final mass of air in bottle(in kg):\n", "E=m1*Cv*T1-m2*Cv*T2-(m1-m2)*Cp*T2 #Energy available for running of turbine due to emptying of bottle(in kJ):\n", "\n", "#Results: \n", "print \"Work available from turbine(KJ):\",round(E,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Work available from turbine(KJ): 638.33\n" ] } ], "prompt_number": 24 } ], "metadata": {} } ] }