{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 3: Evaluating Properties" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.11: Example.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Given:-\n", "p1 = 1.0 // initial pressure in bar\n", "T1 = 295.0 // initial temperature in kelvin \n", "p2 = 5.0 // final pressure in bar\n", "n = 1.3 // polytropic constant\n", "R = 8314/28.97 // gas constant for air in SI units\n", "// From table A-22\n", "u2 = 306.53\n", "u1 = 210.49\n", "// Calculations\n", "T2 = T1*(p2/p1)**((n-1)/n)\n", "w = R*(T2-T1)/(1-n)\n", "Q = u2-u1+w/1000\n", "// Results\n", "printf( ' The work done per unit mass is %f KJ/kg.',w/1000)\n", "printf( ' The heat transfer per unit mass is %f KJ/kg.',Q);" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.1: Example.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Given:-\n", "// Those with 1 are of state 1 and 2 are with state 2\n", "// State 1\n", "p1 = 10**5 // initial pressure in pascal \n", "x1 = 0.5 // initial quality\n", "T1 = 99.63 // temperature in degree celcius, from table A-3\n", "v = 0.5 // volume of container in m3\n", "vf1 = 1.0432*(10**(-3)) // specific volume of fluid in state 1 in m3/Kg(from table A-3)\n", "vg1 = 1.694 // specific volume of gas in state 1 in m3/kg(from table A-3)\n", "// State 2\n", "p2 = 1.5*(10**5) // pressure after heating in pascal\n", "T2 = 111.4 // temperature in degree celcius in state 2, from A-3\n", "vf2 = 1.0582*(10**(-3)) // specific volume of fluid in state 2 in m3/Kg, from A-3\n", "vg2 = 1.159 // specific volume of gas in state 2 in m3/Kg,from A-3\n", "// Calculations\n", "v1 = vf1 + x1*(vg1-vf1) // specific volume in state 1 in m3/Kg\n", "v2 = v1 // specific volume in state 2 in m3/Kg\n", "m = v/v1 // total mass in Kg\n", "mg1 = x1*m // mass of vapour in state 1 in Kg\n", "x2 = (v1-vf2)/(vg2-vf2) // quality in state 2\n", "mg2 = x2*m // mass of vapor in state 2 in Kg \n", "// State 3\n", "p3 = 2.11 // pressure in state 3 from table A-3\n", "// Results\n", "printf( ' The temperature in state 1 is %f degree celcius.',T1)\n", "printf( ' The temperature in state 2 is %f degree celcius.',T2)\n", "printf( ' The mass of vapour in state 1 is %.2f kg.',mg1) \n", "printf( ' The mass of vapour in state 2 is %.2f kg.',mg2)\n", "printf( ' The pressure corresponding to state 3 is %.2f bar',p3)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.2: Example.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Given:-\n", "m = 0.05 // mass of ammonia in kg \n", "p1 = 1.5*(10**5) // initial pressure of ammonia in pascal\n", "v1 = 0.7787 // specific volume in state 1 in m3/kg from table A-14\n", "v2 = 0.9553 // specific volume in state 2 in m3/kg from table A-15\n", "T2 = 25.0 // final temperature in degree celcius\n", "// Calculations\n", "V1 = m*v1 // volume occupied by ammonia in state 1 in m3\n", "V2 = m*v2 // volume occupied by ammonia in state 2 in m3\n", "w = (p1*(V2-V1))/1000 // work in KJ\n", "// Results\n", "printf( ' The volume occupied by ammonia in state 1 is %.2f m^3.',V1)\n", "printf( ' The volume occupied by ammonia in state 2 is %.2f m^3',V2)\n", "printf( ' The work done for the process is %.2f KJ',w)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.3: Example.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Given:-\n", "V = 0.25 // volume of tank in m3\n", "v = 1.673 // specific volume in m3/kg obtained using table A-2\n", "// State 1\n", "T1 = 100.0 // initial temperature in degree celcius\n", "u1 = 2506.5 // specific internal energy in state 1 in KJ/Kg obtained from table A-2\n", "// State 2\n", "p2 = 1.5 // final pressure in bars\n", "T2 = 273.0 // temperature in state 2 in degree celcius obtained from table A-4\n", "u2 = 2767.8 // specific internal energy in state 2 in KJ/Kg obtained from table A-4\n", "// Calculations\n", "m = V/v // mass of the system in kg\n", "DeltaU = m*(u2-u1) // change in internal energy in KJ\n", "W = - DeltaU // from energy balance\n", "// Results\n", "printf( ' The temperature at the final state in is %.2f degree celcius.',T2)\n", "printf( ' The work during the process is %f KJ.',W);" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.4: Example.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Given:-\n", "// State \n", "P1 = 10*(10**5) // initial pressure in pascal\n", "T1 = 400.0 // initial temperature in degree celcius\n", "v1 = 0.3066 // specific volume in state 1 in m3/kg obtained from table A-4\n", "u1 = 2957.3 // specific internal energy in state 1 in KJ/Kg obtained from table A-4\n", "// State 2\n", "v2 = 0.1944 // specific volume in state 2 in m3/kg obtained from table A-3\n", "w2to3 = 0 // work in process 2-3\n", "// State 3 \n", "v3 = v2\n", "vf3 = 1.0905*(10**(-3)) // specific volume of fluid in state 3 from table A-2\n", "vg3 = 0.3928 // specific volume of gas in state 3 from table A-2\n", "uf3 = 631.68 // specific internal energy for fluid in state 3 from table A-2\n", "ug3 = 2559.5 // specific internal energy for gas in state 3 from table A-2\n", "// Calculations\n", "w1to2 = (P1*(v2-v1))/1000 // work in KJ/Kg in process 1-2\n", "W = w1to2 + w2to3 // net work in KJ/kg\n", "x3 = (v3-vf3)/(vg3-vf3)\n", "u3 = uf3+x3*(ug3-uf3) // specific internal energy in state 3 in Kj/Kg\n", "q = (u3-u1) + W // heat transfer in Kj/Kg\n", "// Results\n", "printf( ' The work done in the overall process is %f KJ/kg.',W);\n", "printf( ' The heat transfer in the overall process is %f KJ/kg.',q);" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.6: Example.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Given:-\n", "// State 1\n", "p1 = 20.0 // initial pressure in MPa\n", "T1 = 520.0 // initial temperature in degree celcius\n", "Z1 = 0.83 // compressibility factor\n", "R = 8.314 // universal gas constant in SI unit\n", "n = 1000.0/18.02 // number of moles in a kg of water\n", "// State 2\n", "T2 = 400.0 // final temperature in degree celcius\n", "// From table A-1\n", "Tc = 647.3 // critical temperature in kelvin\n", "pc = 22.09 // critical pressure in MPa\n", "// Calculations\n", "Tr = (T1+273)/Tc // reduced temperature\n", "Pr = p1/pc // reduced pressure \n", "v1 = (Z1*n*R*(T1+273))/(p1*(10**6))\n", "vr = v1*(pc*(10**6))/(n*R*Tc)\n", "Tr2 = (T2+273)/Tc\n", "PR = 0.69 // at above vr and Tr2\n", "P2 = pc*PR\n", "// Results \n", "printf( ' The specific volume in state1 is %f m3/kg and the corresponding value obtained from table A-4 is .01551 m^3/Kg',v1)\n", "printf( ' The pressure in MPa in the final state is %f MPa and the corresponding value from the table is 15.16Mpa',P2);" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.7: Example.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Given:-\n", "T1 = 300.00 //temperature in state 1 in kelvin\n", "P1 = 1.00 //pressure in state 1 in bar\n", "P2 = 2.00 //pressure in state 2 in bar\n", "R = 287.00 //gas constant of air in SI units\n", "// Calculations\n", "v1 = (R*T1)/(P1*10**5) //specific volume in state 1\n", "P = linspace(1,2,50)\n", "for i = 1:50\n", " v(i) = v1\n", "end\n", " \n", "T2 = (P2*10**5*v1)/R\n", "v3 = (R*T2)/(P1*10**5)\n", "vv = linspace(v1,v3,50)\n", "for i = 1:50\n", " Pa(i) = P1\n", "end\n", "//function[out]= f(inp)\n", "//out = (R*T2)/(inp\n", "VV = linspace(v1,v3,50)\n", "for j = 1:50\n", " pp(j) = (R*T2)/VV(j)/(10**5)\n", "end\n", "vcommon = cat(1,v,VV')\n", "pcommon = [P pp']\n", "size(vcommon)\n", "size(pcommon)\n", "//subplot(211)\n", "plot(vcommon,pcommon)\n", "xlabel('v')\n", "ylabel('p(bar)')\n", "//subplot(212)\n", "plot(vv,Pa)\n", "xlabel('v')\n", "ylabel('p(bar)')\n", "//The two steps are shown in one graph and the other on is shown in the other graph'''\n", "printf( 'The temperature in kelvin in state 2 is T2 = %f',T2)\n", "printf( 'The specific volume in state 3 in m^3/kg is v = %f',v3)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.8: Example.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Given:-\n", "// State 1\n", "m = 0.9 // mass of air in kg\n", "T1 = 300.0 // initial temperature in kelvin\n", "P1 = 1.0 // initial pressure in bar\n", "// State 2\n", "T2 = 470.0 // final temperature in kelvin\n", "P2 = 6.0 // final pressure in bar\n", "Q = -20.0 // heat transfer in kj\n", "// From table A-22 \n", "u1 = 214.07 // in KJ/kg\n", "u2 = 337.32 // in KJ/Kg\n", "// Calculations\n", "deltaU = m*(u2-u1) // change in internal energy in kj\n", "W = Q - deltaU // in KJ/kg\n", "// Results\n", "printf( ' The work during the process is %f KJ.',W);" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.9: Example.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Given:-\n", "// State 1\n", "m1 = 2.0 // initial mass of gas in tank 1 in kg\n", "T1 = 350.0 // initial temperature in kelvin in tank1\n", "p1 = 0.7 // initial pressure in bar in tank 1\n", "// State 2\n", "m2 = 8.0 // initial mass of gas in tank 2 in kg\n", "T2 = 300.0 // initial temperature in kelvin in tank 2\n", "p2 = 1.2 // initial pressure in bar in tank 2\n", "Tf = 315.0 // final equilibrium temperature in kelvin\n", "// From table A-20\n", "Cv = 0.745 // in KJ/Kg.k\n", "// Calculations\n", "pf = ((m1+m2)*Tf)/((m1*T1/p1)+(m2*T2/p2)) \n", "Ui = (m1*Cv*T1)+(m2*Cv*T2)\n", "Uf = (m1+m2)*Cv*Tf\n", "deltaU = Uf-Ui\n", "Q = deltaU\n", "// Results\n", "printf( ' The final equilibrium pressure is %f bar.',pf);\n", "printf( ' The heat transfer for the process is %f KJ.',Q);" ] } ], "metadata": { "kernelspec": { "display_name": "Scilab", "language": "scilab", "name": "scilab" }, "language_info": { "file_extension": ".sce", "help_links": [ { "text": "MetaKernel Magics", "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" } ], "mimetype": "text/x-octave", "name": "scilab", "version": "0.7.1" } }, "nbformat": 4, "nbformat_minor": 0 }