{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 2: Thermodynamics" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.1: Calculation_on_a_Diffuser.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// scilab Code Exa 2.1 Calculation on a Diffuser \n", "\n", "p1=800; // Initial Pressure in kPa\n", "T1=540; // Initial Temperature in K\n", "p2=580; // Final Pressure in kPa\n", "gamma=1.4; // Specific Heat Ratio\n", "cp=1005; // Specific Heat at Constant Pressure in J/(kgK)\n", "R=0.287; // Universal Gas Constant in kJ/kgK\n", "g=9.81; // Gravitational acceleration in m/s^2\n", "sg=13.6; // Specific Gravity of mercury\n", "n=0.95; // Efficiency in %\n", "AR=4; // Area Ratio of Diffuser\n", "delp=(367)*(1e-3)*(g)*(sg); // Total Pressure Loss Across the Diffuser in kPa\n", "pr=p1/p2; // Pressure Ratio\n", "T2s=T1/(pr^((gamma-1)/gamma));\n", "T2=T1-(n*(T1-T2s));\n", "c2=sqrt(2*cp*(T1-T2));\n", "ro2=p2/(R*T2);\n", "c3=c2/AR;\n", "m=0.5*1e-3*ro2*((c2^2)-(c3^2));\n", "n_D=1-(delp/m);\n", "disp ('%',n_D*1e2,' Efficiency of the diffuser is')\n", "p3=(p2+n_D*m)*1e-2;\n", "disp('m/s',c2,'the velocity of air at diffuser entry is')\n", "disp('m/s',c3,'the velocity of air at diffuser exit is')\n", "disp('bar',p3,'static pressure at the diffuser exit is')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.2: Determining_the_infinitesimal_stage_efficiencies.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Exa 2.2 Determining the infinitesimal stage efficiencies\n", "p1=1.02; // Initial Pressure in bar\n", "T1=300; // Initial Temperature in K\n", "\n", "// part(a)\n", "T2=315; // Final Temperature in K\n", "gamma=1.4; // Specific Heat Ratio\n", "g=9.81; // Gravitational acceleration in m/s^2\n", "sg=1; // Specific Gravity of air\n", "delp=(1500)*(0.001)*(g)*(sg); // Total Pressure Loss Across the Diffuser in kPa\n", "p2=p1+(0.01*delp);\n", "pr=p2/p1; // Pressure Ratio\n", "T2s=T1*(pr^((gamma-1)/gamma));\n", "n_c=(T2s-T1)/(T2-T1); // Efficiency in %\n", "n_p=((gamma-1)/gamma)*((log(p2/p1))/(log(T2/T1)));\n", "disp ('%',n_c*100,'(a)Efficiency of the compressor is')\n", "disp ('%',n_p*100,'and infinitesimal stage Efficiency or polytropic efficiency of the compressor is')\n", "\n", "// part(b) Determining the infinitesimal stage efficiency\n", "\n", "p2_b=2.5; // Final pressure in bar\n", "n_b=0.75; // Efficiency\n", "pr_b=p2_b/p1; // Pressure Ratio\n", "T2s_b=T1*(pr_b^((gamma-1)/gamma));\n", "T2_b=T1+((T2s_b-T1)/n_b);\n", "n_p_b=((gamma-1)/gamma)*((log(p2_b/p1))/(log(T2_b/T1)));\n", "disp ('%' ,n_p_b*100,'(b)infinitesimal stage Efficiency or polytropic efficiency of the compressor is')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.3: Calculations_on_air_compressor.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// scilab Code Exa 2.3 Calculation on a compressor\n", "p1=1.0; // Initial Pressure in bar\n", "t1=40; // Initial Temperature in degree C\n", "T1=t1+273; // in Kelvin\n", "s=8; // number of stages\n", "m=50; // mass flow rate through the compressor in kg/s\n", "pr=1.35; // equal Pressure Ratio in each stage\n", "opr=pr^s; // Overall Pressure Ratio\n", "gamma=1.4; // Specific Heat Ratio\n", "cp=1.005; // Specific Heat at Constant Pressure in kJ/(kgK)\n", "n=0.82; // Overall Efficiency\n", "\n", "// part(a) Determining state of air at the compressor exit\n", "p9=opr*p1;\n", "delTc=T1*(opr^((gamma-1)/gamma)-1)/n;\n", "T9=T1+delTc;\n", "disp('bar',p9,'(a)Exit Pressure is')\n", "disp('K',T9,'and Exit Temperature is')\n", "\n", "// part(b) Determining the polytropic or small stage efficiency\n", "n_p=((gamma-1)/gamma)*((log(p9/p1))/(log(T9/T1)));\n", "disp('%',n_p*100,'(b)small stage Efficiency or polytropic efficiency of the compressor is')\n", "\n", "// part(c) Determining efficiency of each stage\n", "n_st=(pr^((gamma-1)/gamma)-1)/(pr^(((gamma-1)/gamma)/n_p)-1);\n", "disp ('%',n_st*100,'(c)Efficiency of each stage is')\n", "\n", "// part(d) Determining power required to drive the compressor\n", "n_d=0.9; // Overall efficiency of the drive\n", "P=m*cp*delTc/n_d;\n", "disp ('MW' ,P/1e3,'(d)Power required to drive the compressor is')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.4: compressor_with_same_temperature_rise.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// Exa 2.4 compressor with same temperature rise\n", "\n", "p1=1.0; // Initial Pressure in bar\n", "t1=40; // Initial Temperature in degree C\n", "T1=t1+273; // in Kelvin\n", "s=8; // number of stages\n", "pr=1.35;\n", "opr=pr^s; // Overall Pressure Ratio\n", "n=0.82; // Overall Efficiency \n", "p9=opr*p1;\n", "gamma=1.4;\n", "delTc=(T1*(opr^((gamma-1)/gamma)-1)/n);\n", "delTi=delTc/s;\n", "T9=T1+delTc;\n", "n_p=((gamma-1)/gamma)*((log(p9/p1))/(log(T9/T1))); // small stage Efficiency or polytropic efficiency\n", "m=8;\n", "T(1)=T1;\n", "for i=1:m\n", " T(i+1)=T(i)+delTi;\n", " pr(i)=(1+(delTi/T(i)))^(n_p/((gamma-1)/gamma));\n", " n_st(i)=(pr(i)^((gamma-1)/gamma)-1)/(pr(i)^(((gamma-1)/gamma)/n_p)-1);\n", "disp(T(i),'T is');\n", "disp(pr(i),'pressure ratio is')\n", "disp(n_st(i),'efficiency is' )\n", "end" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.5: Calculations_on_three_stage_gas_turbine.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// scilab Code Exa 2.5 Calculation on three stage gas turbine\n", "\n", "p1=1.0; // Initial Pressure in bar\n", "gamma=1.4;\n", "T1=1500; // Initial Temperature in K\n", "s=3; // number of stages\n", "opr=11; // Overall Pressure Ratio\n", "\n", "// part(a)Determining pressure ratio of each stage\n", "pr=opr^(1/s); // equal Pressure Ratio in each stage\n", "disp (pr,'(a)Pressure ratio of each stage is')\n", "\n", "// part(b)Determining the polytropic or small stage efficiency\n", "n_o=0.88; // Overall Efficiency \n", "delT=T1*(1-opr^(-((gamma-1)/gamma)))*n_o;\n", "T2=T1-delT;\n", "n_p=(log(T1/T2))/(((gamma-1)/gamma)*(log(opr)));\n", "disp ('%',n_p*100,'(b)small stage Efficiency or polytropic efficiency of the turbine is')\n", "\n", "// part(c) Determining mass flow rate\n", "P=30000; // Power output of the Turbine in kW\n", "n_d=0.91; // Overall efficiency of the drive\n", "cp=1.005; // Specific Heat at Constant Pressure in kJ/(kgK)\n", "m=P/(cp*delT*n_d);\n", "disp ('kg/s',m,'(c)mass flow rate is')\n", "\n", "// part(d) Determining efficiency of each stage\n", "n_st=(1-pr^(n_p*(-((gamma-1)/gamma))))/(1-pr^(-((gamma-1)/gamma)));\n", "disp ('%',n_st*100,'(d)Efficiency of each stage is')\n", "d=3;\n", "T(1)=T1;\n", "for i=1:d\n", " delT(i)=T(i)*(1-pr^(n_p*(-((gamma-1)/gamma))));\n", " T(i+1)=T(i)-delT(i);\n", " P(i)=m*cp*delT(i);\n", "printf('\n P(%d)=%f MW',i,P(i)*1e-3)\n", "end" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.6: Calculations_on_a_Gas_Turbine.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "// scilab Code Exa 2.6 calculation on a gas turbine\n", "\n", "funcprot(0);\n", "p1=5; // Inlet Pressure in bar\n", "p2=1.2; // Exit Pressure in bar\n", "T1=500; // Initial Temperature in K\n", "gamma=1.4;\n", "m=20; // mass flow rate of the gas in kg/s\n", "cp=1.005; // Specific Heat at Constant Pressure in kJ/(kgK)\n", "n_T=0.9; // Overall Efficiency \n", "pr=p1/p2; // Pressure Ratio\n", "// part(a)\n", "T2s=T1/(pr^((gamma-1)/gamma));\n", "T2=T1-(n_T*(T1-T2s));\n", "n_p=(log(T1/T2))/(log(T1/T2s));\n", "disp('%',n_p*100,'(a)small stage Efficiency or polytropic efficiency of the expansion is')\n", "P=m*cp*(T1-T2);\n", "disp('kW',P,'and Power developed is')\n", "\n", "// part(b)\n", "AR=2.5; // Area Ratio of Diffuser\n", "R=0.287; // Universal Gas Constant in kJ/kgK\n", "p3=1.2; // Exit Pressure for diffuser in bar\n", "c2=75; // Velocity of gas at turbine exit in m/s\n", "c3=c2/AR;\n", "n_d=0.7; // Efficiency of the diffuser\n", "ro2=p2/(R*T2);\n", "delp=n_d*(0.5*0.001*ro2*((c2^2)-(c3^2))); // delp=p3-p2d\n", "disp('mm W.G.',delp*100000/9.81,'(b)static pressure across the diffuser is')\n", "p2d=p3-delp;\n", "prd=p1/p2d;\n", "T2sd=T1/(prd^((gamma-1)/gamma));\n", "T2d=T1-(n_T*(T1-T2sd));\n", "Pd=m*cp*(T1-T2d);\n", "disp('kW',Pd-P,'and Increase in the power output of the turbine is')\n", "\n", "disp('Comment: Error in Textbook, Answers vary due to Round-off Errors')" ] } ], "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 }