{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 3: First law of thermodynamics" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.01: To_find_out_work_done_on_the_system.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.01.sce')\n", "//filename=pathname+filesep()+'3.01-data.sci'\n", "//exec(filename)\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", "//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", "printf('\nRESULTS\n')\n", "printf('\nWork done on the piston=%f kJ',w)\n", "printf('\nWork done on the system=%f kJ',-wn)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.02: To_find_out_the_amount_of_heat_required.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.02.sce')\n", "//filename=pathname+filesep()+'3.02-data.sci'\n", "//exec(filename)\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", "//Heat required(in kJ):\n", "Q=(u2-u1)*m\n", "printf('\nRESULT\n')\n", "printf('Heat required= %f kJ',Q)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.03: To_find_out_the_amount_of_heat_to_be_removed.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.03.sce')\n", "//filename=pathname+filesep()+'3.03-data.sci'\n", "//exec(filename)\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", "//Heat to be removed(in kJ/hr):\n", "Q=m*Cp*(t2-t1)\n", "printf('\nRESULT\n')\n", "printf('Heat should be removed at %d kJ/hr',-Q)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.04: To_determine_the_work_done.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.04.sce')\n", "//filename=pathname+filesep()+'3.04-data.sci'\n", "//exec(filename)\n", "//Volume of the cylinnder(in m^3):\n", "v=0.78\n", "//Atmospheric pressure(in kPa):\n", "p=101.325\n", "//Work done(in kJ):\n", "w=p*v\n", "printf('\nRESULT\n')\n", "printf('\nWork done by air= %f',-w)\n", "printf('\nWork done by surroundings= %f',w)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.05: To_determine_the_heat_interaction.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.05.sce')\n", "//filename=pathname+filesep()+'3.05-data.sci'\n", "//exec(filename)\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", "//Final volume(in m^3):\n", "v2=v1*((p1/p2)^(1/n))\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", "printf('\nRESULT\n')\n", "printf('\nHeat interaction = %f kJ',Q)\n", "printf('\nWork interaction = %f kJ',w)\n", "printf('\nChange in internal energy = %f kJ',du)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.06: To_determine_the_work_done.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.06.sce')\n", "//filename=pathname+filesep()+'3.06-data.sci'\n", "//exec(filename)\n", "//Initial pressure(in MPa):\n", "p1=1\n", "//Final pressure(in MPa):\n", "p2=2\n", "//Initial volume(in m^3):\n", "v1=0.05\n", "//Value of n:\n", "n=1.4\n", "//Final volume(in m^3):\n", "v2=v1*((p1/p2)^(1/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", "printf('\nRESULT\n')\n", "printf('\nHeat interaction = %f kJ',Q)\n", "printf('\nWork interaction = %f kJ',w)\n", "printf('\nChange in internal energy = %f kJ',du)\n", "//If 180 kJ heat transfer takes place:\n", "//Work done(in kJ):\n", "w2=180-du\n", "printf('\nNew work = %f kJ',w2)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.07: To_determine_the_heat_transfer.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.08.sce')\n", "//filename=pathname+filesep()+'3.08-data.sci'\n", "//exec(filename)\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", "//Exit velocity(in m/s):\n", "c2=sqrt(2*Cp*10^3*(t1-t2))\n", "printf('\nRESULT\n')\n", "printf('\nExit Velocity = %f m/s',c2)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.08: To_determine_the_exit_velocity.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.08.sce')\n", "//filename=pathname+filesep()+'3.08-data.sci'\n", "//exec(filename)\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", "//Exit velocity(in m/s):\n", "c2=sqrt(2*Cp*10^3*(t1-t2))\n", "printf('\nRESULT\n')\n", "printf('\nExit Velocity = %f m/s',c2)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.09: To_determine_the_heat_to_be_transferred_to_the_atmosphere.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.09.sce')\n", "//filename=pathname+filesep()+'3.09-data.sci'\n", "//exec(filename)\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", "//Heat flow(in kJ/kg):\n", "Q=dh+w\n", "//Heat transferred to atmosphere(in kJ/kg):\n", "Qa=Q-qc\n", "printf('\nRESULT\n')\n", "printf('\nHeat transferred to atmosphere = %d kJ/kg',Qa)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.10: To_determine_the_water_circulation_rate.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.10.sce')\n", "//filename=pathname+filesep()+'3.10-data.sci'\n", "//exec(filename)\n", "//Seating capacity:\n", "c=500\n", "//Heat requirement per person(in kcal/hr):\n", "q=50\n", "//Enthalpy of water entering the pipe(in kcal/kg):\n", "h1=80\n", "//Enthalpy of water leaving the pipe(in kcal/kg):\n", "h2=45\n", "//Difference in elevation of inlet and exit pipe(in m):\n", "z=10\n", "//Acceleration due to gravity(in m/s^2):\n", "g=9.81\n", "//Heat to be supplied(in kcal/hr):\n", "Q=c*q\n", "//Heat lost by water(in kcal/kg):\n", "Ql=-Q\n", "//By SFEE:\n", "//Quantity of water circulated(in kg/hr):\n", "m=(Ql*10^3*4.18)/(g*z+(h2-h1)*10^3*4.18)\n", "printf('\nRESULT\n')\n", "printf('\nWater circulation rate = %f kg/min',m/60)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.11: To_determine_the_steam_supply_rate.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.11.sce')\n", "//filename=pathname+filesep()+'3.11-data.sci'\n", "//exec(filename)\n", "//Enthalpy of steam entering the injector(in kcal/kg):\n", "h1=720\n", "//Enthalpy of water entering(in kcal/kg):\n", "h2=24.6\n", "//Enthalpy of water and steam mixture leaving the injector(in kcal/kg):\n", "h3=100\n", "//Depth of water injector from steam injector(in m):\n", "z=2\n", "//Velocity of steam entering the injector(in m/s):\n", "v1=50\n", "//Velocity of mixture leaving the injector(in m/s):\n", "v3=25\n", "//Heat loss from injector to surroundings(in kcal/kg):\n", "q=12\n", "//By applying SFEE:\n", "//Steam supply rate(in kg/s):\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", "printf('\nRESULT\n')\n", "printf('\nSteam supply rate = %f kg/s',m)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.12: To_determine_the_work_done.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.12.sce')\n", "//filename=pathname+filesep()+'3.12-data.sci'\n", "//exec(filename)\n", "//Atmospheric pressure(in bar):\n", "p=1.013\n", "//Volume to which the baloon is inflated(in m^3):\n", "v=0.4\n", "//Work done by cylinder(in kJ):\n", "w1=0\n", "//Work done by the balloon(in kJ):\n", "w2=p*10^5*v\n", "//Total work(in kJ):\n", "w=w1+w2\n", "printf('\nRESULT\n')\n", "printf('\nWork done by the system upon atmoshere = %f kJ',w/(10^3))\n", "printf('\nWork done by the atmoshere = %f kJ',-w/(10^3))" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.13: To_determine_capacity_of_the_generator.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.13.sce')\n", "//filename=pathname+filesep()+'3.13-data.sci'\n", "//exec(filename)\n", "//Heat added(in J/s):\n", "Qa=5000\n", "//Turbine work(in J/s):\n", "Wt=0.25*Qa\n", "//Heat rejected(in J/s):\n", "Qr=0.75*Qa\n", "//Work by feed pump(in J/s):\n", "Wp=0.002*Qa\n", "//Capacity of generator(in W):\n", "C=Wt-Wp\n", "printf('\nRESULT\n')\n", "printf('\nCapacity of generator = %f kW ',C/(10^3))" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.14: To_determine_the_exit_velocity.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.14.sce')\n", "//filename=pathname+filesep()+'3.14-data.sci'\n", "//exec(filename)\n", "//Ambient temperature(in K):\n", "T1=27+273\n", "//Temperature of air inside heat exchanger(in K):\n", "T2=750+273\n", "//Temperature of air leaving turbine(in K):\n", "T3=600+273\n", "//Temperature of air leaving the nozzle(in K):\n", "T4=500+273\n", "//Velocity of air entering turbine(in m/s):\n", "c2=50\n", "//Velocity of air entering the nozzle(in m/s):\n", "c3=60\n", "//Specific heat at constant pressure(in kj?kg.K):\n", "Cp=1.005\n", "//By applying SFEE between points 1 & 2:\n", "//Heat transfer to air in heat exchanger(in kJ):\n", "Q12=Cp*(T2-T1)\n", "printf('\nRESULT\n')\n", "printf('\nHeat transfer to air in heat exchanger =%f kJ',Q12)\n", "//By applying SFEE between points 2 & 3:\n", "//Power output from turbine(in kJ/s):\n", "Wt=Cp*(T2-T3)+(c2^2-c3^2)*10^(-3)/2\n", "printf('\nPower output from turbine = %f kJ/s',Wt)\n", "//By applying SFEE between points 3 & 4:\n", "//Velocity at exit of the nozzle(in m/s):\n", "c4=sqrt(2*(Cp*(T3-T4)+(c3^2)*10^(-3)/2))\n", "printf('\nVelocity at exit of the nozzle = %f m/s',c4)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.15: To_determine_the_work_done.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.15.sce')\n", "//filename=pathname+filesep()+'3.15-data.sci'\n", "//exec(filename)\n", "//Initial pressure(in MPa):\n", "p1=0.5\n", "//Initial temperature(in K):\n", "T1=400\n", "//Ratio of v2 to v1:\n", "r1=2\n", "//Ratio of v3 to v1:\n", "r2=6\n", "//Universal gas constant(in kJ/kg):\n", "R=8.314\n", "//Work from state 1 to 2(in kJ):\n", "Wa=R*T1\n", "//Temperature at point 2(in K):\n", "T2=2*T1\n", "//Work done from state 2 to 3(in kJ):\n", "Wb=R*T2*log(r2/r1)\n", "//Total work done by air(in kJ):\n", "W=Wa+Wb\n", "printf('\nRESULT\n')\n", "printf('\nWork done = %f kJ',W)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.16: To_determine_the_work_done.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.16.sce')\n", "//filename=pathname+filesep()+'3.16-data.sci'\n", "//exec(filename)\n", "//Initial pressure(in MPa):\n", "pi=0.5\n", "//Initial volume(in m^3):\n", "vi=0.5\n", "//Final pressure(in MPa):\n", "pf=1\n", "//Atmospheric pressure(in Pa):\n", "patm=1.013*10^5\n", "//Final volume(in m^3):\n", "vf=3*vi\n", "//Work done(in J):\n", "W=(vf-vi)*(pi+pf)*10^5/2\n", "printf('\nRESULT\n')\n", "printf('\nWork done = %d J',W)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.17: To_determine_the_work_done.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.17.sce')\n", "//filename=pathname+filesep()+'3.17-data.sci'\n", "//exec(filename)\n", "//Initial pressure(in MPa):\n", "pi=0.5\n", "//Initial volume(in m^3):\n", "vi=0.5\n", "//Final pressure(in MPa):\n", "pf=1\n", "//Atmospheric pressure(in Pa):\n", "patm=1.013*10^5\n", "//Adiabatic index of compression for H2:\n", "rH2=CpH2/(CpH2-RH2)\n", "//Adiabatic index of compression for N2:\n", "rN2=CpN2/(CpN2-RN2)\n", "//Final pressure of hydrogen(in Pa):\n", "p2=p1*(v1/v2)^rH2\n", "printf('\nRESULT\n')\n", "printf('\nFinal pressure of hydrogen = %f MPa',p2/(10^6))\n", "//Partition work:\n", "Pw=0\n", "printf('\nPartition work = %d',Pw)\n", "//Work done upon H2(in J):\n", "WH2=(p1*v1-p2*v2)/(rH2-1)\n", "//Work done by nitrogen(in J):\n", "WN2=-WH2\n", "printf('\nWork done by hyrogen = %d J',WH2)\n", "printf('\nWork done by nitrogen = %d J',WN2)\n", "//Mass of N2(in kg):\n", "mN2=p1*v1/(RN2*10^3*T1)\n", "//Final temperature of N2(in K):\n", "T2=p2*vN2*T1/(p1*v1)\n", "//Cv of N2(in kJ/kg):\n", "CvN2=CpN2-RN2\n", "//Heat added to N2(in kJ):\n", "QN2=mN2*CvN2*10^3*(T2-T1)+WN2\n", "printf('\nHeat added to nitrogen = %f kJ',QN2/(10^3))" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.18: To_determine_the_work_available.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.18.sce')\n", "//filename=pathname+filesep()+'3.18-data.sci'\n", "//exec(filename)\n", "//Volume of the cylinder(in m^3):\n", "v1=2\n", "//Pressure in the cylinder(in Pa):\n", "p1=0.5*10^6\n", "//Temperature of the cylinder(in K):\n", "T1=375\n", "//Specific heat at const pressure(in kJ/kg.K):\n", "Cp=1.003\n", "//Specific heat at const volume(in kJ/kg.K):\n", "Cv=0.716\n", "//Gas constant for air(in kJ/kg.K):\n", "Ra=0.287\n", "//Atmospheric pressure(in Pa):\n", "patm=1.013*10^5\n", "//Compression ratio:\n", "r=1.4\n", "//Initial mass of air(in kg):\n", "m1=p1*v1/(Ra*T1)\n", "//Final temperature(in K):\n", "T2=T1*(patm/p1)^((r-1)/r)\n", "//Final mass of air left in tank(in kg):\n", "m2=patm*v1/(Ra*T2)\n", "//Kinetic energy available(in kJ):\n", "KE=m1*Cv*T1-m2*Cv*T2-(m1-m2)*Cp*T2\n", "printf('\nRESULT\n')\n", "printf('\nAmount of work available = %f J',KE)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.19: To_determine_the_final_pressure_and_temperature.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.19.sce')\n", "//filename=pathname+filesep()+'3.19-data.sci'\n", "//exec(filename)\n", "//Pressure in the vessel(in Pa):\n", "p1=0.5*10^6\n", "//Volume of 1st chamber(in m^3):\n", "v1=0.5\n", "//Temperature in the vessel(in K):\n", "T1=300\n", "//Final pressure(in Pa):\n", "p2=10^6\n", "//Volume of 2nd chamber(in m^3):\n", "v2=0.5\n", "//Final temperature(in K):\n", "T2=500\n", "//Universal gas constant(in J/kg.K):\n", "R=8314\n", "//Moles in chamber 1:\n", "n1=p1*v1/(R*T1)\n", "//Moles in chamber 2:\n", "n2=p2*v2/(R*T2)\n", "//Temperature of the mixture(in K):\n", "T3=(n1*T1+n2*T2)/(n1+n2)\n", "//Final pressure(in MPa):\n", "p3=(n1+n2)*R*T3/(v1+v2)\n", "printf('\nRESULT\n')\n", "printf('\nFinal pressure = %f MPa',p3/(10^6))\n", "printf('\nFinal temperature = %f K',T3)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.20: To_determine_the_heat_to_be_transferred.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.20.sce')\n", "//filename=pathname+filesep()+'3.20-data.sci'\n", "//exec(filename)\n", "//Volume of the bottle(in m^3):\n", "v=0.5\n", "//Pressure in the bottle(in Bar):\n", "p=1.0135\n", "//Displacement work(in N-m):\n", "W=p*10^5*(0-v)\n", "//Heat transfer(in N-m):\n", "Q=-W\n", "printf('\nRESULT\n')\n", "printf('\nHeat transferred = %d N-m',Q)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.21: To_determine_the_heat_to_be_transferred.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.21.sce')\n", "//filename=pathname+filesep()+'3.21-data.sci'\n", "//exec(filename)\n", "//Volume of bottle(in m^3):\n", "v1=0.3\n", "//Pressure in the bottle(in bar):\n", "p1=35\n", "//Temperature in the bottle(in K):\n", "T1=40+273\n", "//Turbo generator's actual output(in kJ/s):\n", "w1=5\n", "//Final prssure(in bar):\n", "p2=1\n", "//Final volume(in m^3):\n", "v2=v1\n", "//Gas constant for air(in kJ/kg.K):\n", "Ra=0.287\n", "//Compression ratio:\n", "r=1.4\n", "//% of output which is consumed= 60%\n", "//Specific heat at const volume(in kJ/kg):\n", "Cv=0.718\n", "//Specific heat at const pressure(in kJ/kg):\n", "Cp=1.005\n", "//Final temperature(in K):\n", "T2=T1*(p2/p1)^((r-1)/r)\n", "//Initial mass in the bottle(in kg):\n", "m1=p1*10^2*v1/(Ra*T1)\n", "//Final mass in the bottle(in kg):\n", "m2=p2*10^2*v2/(Ra*T2)\n", "//Maximum work that can be obtained(in kJ):\n", "W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2\n", "//Input to the turbo generator(in kJ/s):\n", "i=w1/0.6\n", "//Time duration(in s):\n", "t=W/i\n", "printf('\nRESULT\n')\n", "printf('\nDuration = %f seconds',t)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.22: To_determine_the_duration.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.22.sce')\n", "//filename=pathname+filesep()+'3.22-data.sci'\n", "//exec(filename)\n", "//Pressure at state 1(in bar):\n", "p1=1.5\n", "//Temperature at state 1(in K):\n", "T1=77+273\n", "//Pressure at state 2(in bar):\n", "p2=7.5\n", "//Mass of the air(in kg):\n", "m=3\n", "//Value of n:\n", "n=1.2\n", "//Gas constant for air(in kJ/kg.K):\n", "Ra=0.287\n", "//Temperature at state 2(in K):\n", "T2=T1*(p2/p1)^((n-1)/n)\n", "//Initial volume(in m^3):\n", "v1=m*Ra*T1/(p1*10^2)\n", "//Volume at state 2(in m^3):\n", "v2=(p1*(v1^n)/p2)^(1/n)\n", "//Temperature at state 3(in K):\n", "T3=T1\n", "//Volume at state 3(in m^3):\n", "v3=v2*T3/T2\n", "//Pressure at state 3(in bar):\n", "p3=7.5\n", "//Compression work during process 1-2(in kJ):\n", "W12=m*Ra*(T2-T1)/(1-n)\n", "//Work during process 2-3(in kJ):\n", "W23=p2*(10^2)*(v3-v2)\n", "//Work during process 3-1(in kJ):\n", "W31=p3*10^2*v3*log(v1/v3)\n", "//Net work(in kJ):\n", "Wn=W12+W23+W31\n", "printf('\nRESULT\n')\n", "printf('\nHeat transferred from the system = %f kJ',-Wn)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.23: To_determine_the_work_available_from_the_turbine.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//pathname=get_absolute_file_path('3.23.sce')\n", "//filename=pathname+filesep()+'3.23-data.sci'\n", "//exec(filename)\n", "//Volume of air bottle(in m^3):\n", "v1=0.15\n", "//Initial pressure(in bar):\n", "p1=40\n", "//Initial temperature(in K):\n", "T1=27+273\n", "//Final presure(in bar):\n", "p2=2\n", "//Final volume(in m^3):\n", "v2=v1\n", "//Gas constant for air(in kJ/kg):\n", "Ra=0.287\n", "//Specific heat at const pressure(in kJ/kg):\n", "Cp=1.005\n", "//Specific heat at const volume(in kJ/kg):\n", "Cv=0.718\n", "//Compression ratio:\n", "r=1.4\n", "//Initial mass of air in bottle(in kg):\n", "m1=p1*10^2*v1/(Ra*T1)\n", "//Final temperature(in K):\n", "T2=T1*(p2/p1)^((r-1)/r)\n", "//Final mass of air in bottle(in kg):\n", "m2=p2*10^2*v2/(Ra*T2)\n", "//Energy available for running of turbine due to emptying of bottle(in kJ):\n", "E=m1*Cv*T1-m2*Cv*T2-(m1-m2)*Cp*T2\n", "printf('\nRESULT\n')\n", "printf('\nWorj available from turbine = %f',E)" ] } ], "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 }