{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 3: Reactive Systems" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.10: The_enthalpy_of_reaction.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "T=1500;//The given temperature in K\n", "\n", "//Calculations\n", "hfco=-393.52;//The enthalpy of formation for carbondioxide in MJ/kmol\n", "hf1=61.714;//The change in enthalpy for actual state and reference state in MJ/kmol\n", "HP=hfco+hf1;//The total enthalpy in the products side in MJ/kmol\n", "hfc=-110.52;//The enthalpy of formation for carbonmonoxide in MJ/kmol\n", "hf2=38.848;//The change in enthalpy of CO for actual and reference state in MJ/kmol\n", "hfo=0;//The enthalpy of formation for oxygen gas\n", "hf3=40.61;//The change in enthalpy of oxygen for different states in MJ/kmol\n", "HR=[hfc+hf2]+[0.5*(hfo+hf3)];//The total enthalpy in the reactants side in MJ/kmol\n", "H=HP-HR;//The enthalpy of combustion in MJ/kmol \n", "\n", "//Output\n", "printf(' The enthalpy of combustion is %3.3f MJ/kmol CO ',H)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.11: The_heat_transfer.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "E=30;//The amount of excess air in percentage\n", "tp=400;//The temperature at which propane enters in K\n", "ta=300;//The temperature at which air enters in K\n", "T=900;//The temperature at which products leave in K\n", "m=83.7;//The average molar specific heat of propane at constant pressure in kJ/kmolK\n", "Mp=44;//The molecular weight of propane\n", "\n", "//Calculations\n", "hfc=-393.52;//The enthalpy of formation for carbondioxide in MJ/kmol\n", "hf1=28.041;//The change in enthalpy of CO2 for actual and reference state in MJ/kmol\n", "hfh=-241.82;//The enthalpy of formation for water in MJ/kmol\n", "hf2=21.924;//The change in enthalpy of water for actual and reference state in MJ/kmol\n", "hfn=0;//The enthalpy of nitrogen gas \n", "hf3=18.221;//The change in enthalpy of nitrgen for actual and reference state in MJ/kmol\n", "hfo=0;//The enthalpy of oxygen gas \n", "hf4=19.246;//The change in enthalpy of oxygen for actual and reference state in MJ/kmol\n", "HP=[3*(hfc+hf1)]+[4*(hfh+hf2)]+[24.44*(hfn+hf3)]+[1.5*(hfo+hf4)];//The total enthalpy in the products side in MJ/kmol\n", "hfp=-103.85;//The enthalpy of formation for propane in MJ/kmol\n", "R=0.0837;//Universal gas constant \n", "hfo1=0;//The enthalpy of oxygen gas \n", "hf11=0.054;//The change in enthalpy of oxygen gas for actual and reference state in MJ/kmol\n", "hfn1=0;//The enthalpy of nitrogen gas\n", "hfn22=0.054;//The change in enthalpy of nitrogen for actual and reference state in MJ/kmol\n", "HR=[1*(hfp+(R*(tp-ta)))]+[6.5*(hfo1+hf11)]+[24.44*(hfn1+hfn22)];//The total enthalpy on the reactants side in MJ/kmol\n", "Q=HP-HR;//The amount of heat liberated in MJ/kmol\n", "Q1=[-Q/Mp];//The amount of heat liberated in MJ/kg\n", "\n", "//Output\n", "printf(' The amount of heat transfer per kg of fuel is %3.0f MJ/kg',Q1)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.12: The_standard_enthalpy.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "Ta=150;//The presence of Theoretical air\n", "\n", "//Calculations\n", "hfc=-393.52;//The enthalpy of formation for carbondioxide in MJ/kmol\n", "hfh=-285.8;//The enthalpy of formation for water in MJ/kmol\n", "hfon=0;//The enthalpy of formation for oxygen and nitrogen gas \n", "hfch=-74.87;//The enthalpy of formation for methane in MJ/kmol\n", "HP=[hfc]+[2*hfh];//The total enthalpy on the products side in MJ/kmol\n", "HR=1*hfch;//The total enthalpy on the reactants side in MJ/kmol\n", "H=HP-HR;//The total change in enthalpy of reactants and products in MJ/kmol\n", "np=2;//Number of moles of product\n", "nr=4;//Number of moles of reactant\n", "n=np-nr;//The difference in moles\n", "R=8.314*10^-3;//Universal gas constant \n", "t=298;//The temperature in K\n", "U1=H-[n*R*t];//The standard internal energy in MJ/kmol\n", "hfh1=-241.82;//The enthalpy of formation for water in MJ/kmol\n", "HP1=[1*hfc]+[2*hfh1];//The total enthalpy on the products side in MJ/kmol\n", "H1=HP1-HR;//The change in enthalpy for reactants and products in MJ/kmol\n", "np1=4;//Number of moles of product\n", "nr1=4;//Number of moles of reactant\n", "n1=np1-nr1;//The difference in moles\n", "U2=H1-[n1*R*t];//The standard internal energy in MJ/kmol\n", "\n", "//Output\n", "printf(' (a)The water as liquid , \n The standard enthalpy of combustion is %3.2f MJ/kmol \n The standard internal energy of combustion is %3.2f MJ/kmol \n (b)The water as a gas , \n The standard enthalpy of combustion is %3.2f MJ/kmol \n The standard internal energy of combustion is %3.2f MJ/kmol ',H,U1,H1,U2)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.13: The_calorific_value.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "cv=44000;//The lower calorific value of liquid fuel in kJ/kg\n", "C=84;//The carbon content present in the fuel in percentage\n", "H=16;//The hydrogen content present in the fuel in percentage\n", "t=25;//The temperature in degree centigrade\n", "hfg=2442;//The enthalpy of vaporization for water in kJ/kg\n", "c=12;//Molecular weight of carbon \n", "h=2;//Molecular weight of hydrogen\n", "co2=44;//Molecular weight of carbondioxide\n", "h2o=18;//Molecular weight of water \n", "o2=32;//Molecular weight of oxygen\n", "R=8.314;//Universal gas constant in J/molK\n", "\n", "//Calculations\n", "CO2=[0.84*(co2/c)];//The amount of carbondioxide present per kg of fuel in kg\n", "H2O=[0.16*(h2o/h)];//The amount of water present per kg of fuel in kg\n", "cvd=H2O*hfg;//The difference in the higher and lower calorific value in kJ/kg fuel \n", "HHV=cv+cvd;//The higher calorific value of the liquid fuel in kJ/kg fuel\n", "np=3.08/co2;//number of moles of product in kmol/kg fuel\n", "nr=3.52/o2;//The number of moles of reactant in kmol/kg fuel\n", "n=np-nr;//The difference in the moles\n", "HHVv=HHV+[n*R*(t+273)];//The higher calorific value at constant volume in kJ/kg fuel\n", "LHVv=cv+[n*R*(t+273)];//The lower calorific value at constant volume in kJ/kg fuel\n", "\n", "//Output\n", "printf(' The higher calorific value at constant pressure = %3.0f kJ/kg fuel \n The higher calorific value at constant volume = %3.0f kJ/kg fuel \n The lower calorific value at constant volume = %3.0f kJ/kg fuel',HHV,HHVv,LHVv)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.14: The_adiabatic_flame_temperature.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "E=100;//The amount of excess air in percent\n", "T=298;//The temperature of reactants in K\n", "nc=1;//Number of moles of propane\n", "\n", "//Calculations\n", "hfch=-103.85;//Enthalpy of formation for propane in MJ/kmol fuel\n", "HR=nc*hfch;//Total enthalpy on the reactants side in MJ/kmol fuel\n", "hfc=-393.52;//Enthalpy of formation for carbondioxide in MJ/kmol fuel\n", "hfh=-241.82;//Enthalpy of formation for water in MJ/kmol fuel\n", "hfon=0;//Enthalpy of formation for both oxygen and nitrogen gas\n", "x=HR-[(3*hfc)+(4*hfh)+(5*hfon)+(37.6*hfon)];//For adiabatic combustion enthalpy obtained for equating reactants and products in MJ/kmol fuel\n", "hfn=x/37.6;//trail to get the change in enthalpy of nitrogen in MJ/kmol\n", "T1=1500;//Assuming the products temperature for fist trail in K\n", "hfc1=61.714;//The change in enthalpy for corbondioxide for trail temp in MJ/kmol fuel\n", "hfh1=48.095;//The change in enthalpy for water for trail temp in MJ/kmol fuel\n", "hfo1=40.61;//The change in enthalpy for oxygen for trail temp in MJ/kmol fuel\n", "hfn1=38.405;//The change in enthalpy for nitrogen for trail temp in MJ/kmol fuel\n", "HP1=(HR-x)+(3*hfc1)+(4*hfh1)+(5*hfo1)+(37.6*hfn1);//Total enthalpy of products for first trail in MJ/kmol fuel\n", "T2=1600;//Assuming the products temperature for second trail in K\n", "hfc2=67.58;//The change in enthalpy for corbondioxide for trail temp in MJ/kmol fuel\n", "hfh2=52.844;//The change in enthalpy for water for trail temp in MJ/kmol fuel\n", "hfo2=44.279;//The change in enthalpy for oxygen for trail temp in MJ/kmol fuel\n", "hfn2=41.903;//The change in enthalpy for nitrogen for trail temp in MJ/kmol fuel\n", "HP2=(HR-x)+(3*hfc2)+(4*hfh2)+(5*hfo2)+(37.6*hfn2);//Total enthalpy of products for second trail in MJ/kmol fuel\n", "Te=[[(HR-HP1)/(HP2-HP1)]*(T2-T1)]+T1;//The eatimated adiabatic flame temperature in K\n", "\n", "//Output\n", "printf(' The adiabatic flame temperature for steady-flow process is %3.1f K',Te)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.15: The_adiabatic_flame_temperature.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "T=600;//The initial temperature of air in K\n", "p=1;//The initial pressure of air in atm\n", "R=8.314;//Universal gas constant in J/molK\n", "Tr=298;//The temperature of reactants in K\n", "a=4.503;//Given Constant \n", "b=-8.965*10^-3;//Given Constant\n", "c=37.38*10^-6;//Given Constant\n", "d=-36.49*10^-9;//Given Constant\n", "e=12.22*10^-12;//Given Constant\n", "\n", "//Calculations\n", "hfc=-393.52;//Enthalpy of formation for carbondioxide in MJ/kmol fuel\n", "hfh=-241.82;//Enthalpy of formation for water in MJ/kmol fuel\n", "hfn=0;//Enthalpy of formation for nitrogen gas\n", "HP=[1*hfc]+[2*hfh]+[7.52*hfn];//The enthalpy on the products side in MJ/kmol fuel\n", "hch=[R*[(a*(T-Tr))+((b/2)*(T^2-Tr^2))+((c/3)*(T^3-Tr^3))+((d/4)*(T^4-Tr^4))+((e/5)*(T^5-Tr^5))]]/1000;//The change in enthalpy of the methane in MJ/kmol\n", "hfc1=-74.87;//The enthalpy of formation for methane in MJ/kmol fuel \n", "hfh1=9.247;//The change in enthalpy of the water in MJ/kmol\n", "hfn1=8.891;//The change in enthalpy of nitrogen in MJ/kmol\n", "HR=[(hfc1+hch)+(2*hfh1)+(7.52*hfn1)];//The enthalpy on the reactants side in MJ/kmol\n", "x=HR-HP;//The enthalpy for the remaining gases in the product side in MJ/kmol\n", "hfn2=x/7.52;//The guess enthalpy for the nitrogen gas in MJ/kmol\n", "Tc=3700;//The corresponding temperature for the enthalpy of guess nitrogen in K\n", "T1=2800;//The temperature assumed for the first trail in K\n", "hco1=140.444;//The change in enthalpy for the assume temp for carbondioxide in MJ/kmol\n", "hh1=115.294;//The change in enthalpy for the assume temp for water in MJ/kmol\n", "hn1=85.345;//The change in enthalpy for the assume temp for nitrogen in MJ/kmol\n", "HP1=hco1+(2*hh1)+(7.52*hn1)+(HR-x);//The total enthalpy on the products side for first trail in MJ/kmol fuel\n", "T2=2500;//The temperature assumed for the second trail in K\n", "hco2=121.926;//The change in enthalpy for the assume temp for carbondioxide in MJ/kmol\n", "hh2=98.964;//The change in enthalpy for the assume temp for water in MJ/kmol\n", "hn2=74.312;//;//The change in enthalpy for the assume temp for nitrogen in MJ/kmol\n", "HP2=hco2+(2*hh2)+(7.52*hn2)+(HR-x);//The total enthalpy on the products side for the second trail in MJ/kmol\n", "T3=2600;//The temperature fo the third trail in K\n", "hco3=128.085;//The change in enthalpy for the assume temp for carbondioxide in MJ/kmol\n", "hh3=104.37;//The change in enthalpy for the assume temp for water in MJ/kmol\n", "hn3=77.973;//The change in enthalpy for the assume temp for nitrogen in MJ/kmol\n", "HP3=hco3+(2*hh3)+(7.52*hn3)+(HR-x);//The total enthalpy on the products side for the third trail in MJ/kmol\n", "Ta1=[[(HR-HP2)/(HP3-HP2)]*(T3-T2)]+T2;//The adiabatic temperature for constant pressure process in K\n", "UR1=HR-(10.52*R*10^-3*T);//The internal energy of reactant in MJ/kmol fuel\n", "Tc1=3000;//Assume temperature for first trail in K\n", "hcoa1=146.645;//The change in enthalpy for the assume temp for carbondioxide in MJ/kmol\n", "hha1=120.813;//The change in enthalpy for the assume temp for carbondioxide in MJ/kmol\n", "hna1=89.036;//The change in enthalpy for the assume temp for nitrogen in MJ/kmol\n", "UP1=hcoa1+(2*hha1)+(7.52*hna1)+(HR-x)-(0.08746*Tc1);//The internal energy of products in MJ/kmol fuel\n", "Tc2=3200;//Assume temperature for the second trail in K\n", "hcoa2=165.331;//;//The change in enthalpy for the assume temp for carbondioxide in MJ/kmol\n", "hha2=137.553;//The change in enthalpy for the assume temp for water in MJ/kmol\n", "hna2=100.161;//The change in enthalpy for the assume temp for nitrogen in MJ/kmol\n", "UP2=hcoa2+(2*hha2)+(7.52*hna2)+(HR-x)-(0.08746*Tc2);//The internal energy of products in MJ/kmol fuel\n", "Tu=[[(UR1-UP1)/(UP2-UP1)]*(Tc2-Tc1)]+Tc1;//The adiabatic flame temperature at constant pressure process in K\n", "\n", "//Output\n", "printf('The adiabatic flame temperature at \n (a)Constant pressure process is %3.0f K \n (b)Constant volume process is %3.1f K',Ta1,Tu)\n", "\n", "\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.16: The_adiabatic_flame_temperature.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "T=600;//Temperature at constant pressure process in K\n", "p=1;//The pressure in atm\n", "E=50;//The amount of excess air in percent\n", "L=20;//The amount of less air in percent\n", "cp=52.234;//Specific constant for methane in kJ/kmolK\n", "T1=298;//Assume the normal temperature in K\n", "\n", "//Calculations\n", "hfch=-74.87;//The enthalpy of formation for carbondioxide in MJ\n", "hch=cp*(T-T1)*10^-3;//The change in enthalpy of carbondioxide in MJ\n", "ho=9.247;//The change in enthalpy of oxygen in MJ\n", "hn=8.891;//The change in enthalpy of nitrogen in MJ\n", "HR=hfch+hch+(3*ho)+(11.28*hn);//The total enthalpy on the reactants side in MJ\n", "hfc1=-393.52;//The enthalpy of formation of carbondioxide in MJ\n", "hfh1=-241.82;//The enthalpy of formation of water in MJ\n", "HP=hfc1+(2*hfh1);//The enthalpy of products side in MJ\n", "x=HR-HP;//The change in enthalpy for the remaining in MJ\n", "hn2=x/11.28;//The enthalpy of nitrogen assumed to be in MJ/kmol\n", "Tc=2800;//The corresponding temperature in K\n", "T1=2000;//The temperature for first trail in K\n", "hfc11=91.45;//The enthalpy for the assume temp for carbondioxide in MJ\n", "hfh11=72.689;//The change in enthalpy for the assume temp for water in MJ\n", "hfn11=56.141;//The change in enthalpy for the assume temp for nitrogen in MJ\n", "hfo11=59.199;//;//The change in enthalpy for the assume temp for oxygen in MJ\n", "HP1=hfc11+(2*hfh11)+(11.28*hfn11)+(hfo11)+(HR-x);//The total enthalpy on the products side for first trail in MJ\n", "T2=2100;//The temperature for second trail in K\n", "hfc22=97.5;//The enthalpy for the assume temp for carbondioxide in MJ\n", "hfh22=77.831;//The change in enthalpy for the assume temp for water in MJ\n", "hfn22=59.748;//The change in enthalpy for the assume temp for nitrogen in MJ\n", "hfo22=62.986;//;//The change in enthalpy for the assume temp for oxygen in MJ\n", "HP2=hfc22+(2*hfh22)+(11.28*hfn22)+(hfo22)+(HR-x);//The total enthalpy on the products side for second trail in MJ\n", "Ta1=[[(HR-HP1)/(HP2-HP1)]*(T2-T1)]+T1;//The adiabatic temperature for constant pressure process in K\n", "X=2*[2-1.6];//By balance oxygen\n", "hfchr=-74.87;//The enthalpy of formation for methane in MJ\n", "hor=9.247;//The change in enthalpy for oxygen in MJ\n", "hnr=8.891;//The change in enthalpy for nitrogen in MJ\n", "HRr=hfchr+hch+(1.6*hor)+(6.01*hnr);//The total enthalpy on reactants side in MJ\n", "hfcop=-110.52;//The formation of enthalpy for carbonmoxide in MJ\n", "hfcp=-393.52;//The formation of enthalpy for carbondioxide in MJ\n", "hfhp=-241.82;//The formation of enthalpy for water in MJ\n", "HPp=(0.8*hfcop)+(0.2*hfcp)+(2*hfhp);//The enthalpy on product side in MJ\n", "Tp1=2000;//The temperature for first trail in K\n", "hco11=56.739;//The change in enthalpy for CO in MJ\n", "hco211=91.45;//The change in enthalpy for CO2 in MJ\n", "hh11=72.689;//The change in enthalpy for water in MJ\n", "hn11=56.141;//The change in enthalpy for nitrogen in MJ\n", "HPp1=(0.8*hco11)+(0.2*hco211)+(2*hh11)+(6.016*hn11)-HPp;///The enthalpy on the products side for trail temp in MJ\n", "Tp2=2400;//The temperature for second trail in K\n", "hco22=71.34;//The change in enthalpy for CO in MJ\n", "hco222=115.788;//The change in enthalpy for CO2 in MJ\n", "hh22=93.604;//The change in enthalpy for water in MJ\n", "hn22=70.651;//The change in enthalpy for nitrogen in MJ\n", "HPp2=(0.8*hco22)+(0.2*hco222)+(2*hh22)+(6.016*hn22)+HPp;///The enthalpy on the products side for trail temp in MJ\n", "Tp3=2300;//The temperature for first trail in K\n", "hco33=67.676;//The change in enthalpy for CO in MJ\n", "hco233=109.671;//The change in enthalpy for CO2 in MJ\n", "hh33=88.295;//The change in enthalpy for water in MJ\n", "hn33=67.007;//The change in enthalpy for nitrogen in MJ\n", "HPp3=(0.8*hco33)+(0.2*hco233)+(2*hh33)+(6.016*hn33)+HPp;///The enthalpy on the products side for trail temp in MJ\n", "Ta2=[[(HRr-HPp3)/(HPp2-HPp3)]*(Tp2-Tp3)]+Tp3;//The adiabatic temperature for constant pressure process in K\n", "hccc=-283.022;//The only combustible substance is CO in MJ/kmol\n", "Q=-0.8*hccc;//The thermal energy loss in MJ/kmol fuel\n", "\n", "//Output\n", "printf(' The adiabatic flame temperature having \n (a)50 percent excess air is %3.1f K \n (b)20 percent less air is %3.1f K \n The loss of thermal energy due to incomplete combustion is %3.1f MJ/kmol fuel',Ta1,Ta2,Q)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.18: Dissociation_of_carbondioxide.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "T1=3000;//Given temperature in K\n", "T2=4000;//Given temperature in K\n", "p=1;//The pressure in atm\n", "KP1=1.117;//Natural logarithm of equilibrium constant at 3000 K \n", "KP2=-1.593;//Natural logarithm of equilibrium constant at 4000 K\n", "\n", "//Calculations\n", "Kp1=exp(KP1);//The value of equilibrium constant at 3000 K\n", "Kp2=exp(KP2);//The value of equilibrium constant at 4000 K\n", "a1=0.4;//The dissociation of 1 mole of CO2 for the first trail\n", "a2=0.5;//The dissociation of 1 mole of CO2 for the second trail \n", "K1=3.674;//The value of equilibrium constant for the first trail \n", "K2=2.236;//The value of equilibrium constant for the second trail\n", "a12=[[(K1-Kp1)/(K1-K2)]*(a2-a1)]+a1;//The approximate dissociation of 1 mole of CO2\n", "A12=a12*100;//The amount of CO2 will dissociate in percent\n", "a3=0.9;//The dissociation of 1 mole of CO2 for the first trail\n", "a4=0.89;//The dissociation of 1 mole of CO2 for the second trail\n", "K3=0.1995;//The value of equilibrium constant for the first trail \n", "K4=0.2227;//The value of equilibrium constant for the second trail \n", "a23=[[(Kp2-K4)/(K3-K4)]*(a3-a4)]+a4;//The approximate dissociation of 1 mole of CO2\n", "A23=a23*100;//The amount of CO2 will dissociate in percent\n", "\n", "//output\n", "printf('The percent dissociation of carbondioxide into carbonmonoxide and oxygen at \n (a) at 3000 K and 1 atm pressure = %3.1f percent \n (b) at 4000 K and 1 atm pressure = %3.2f percent ',A12,A23)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.19: The_mole_fractio.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "p=1;//Initial pressure in atm\n", "T=300;//Initial temperature in K\n", "Tc=2400;//To calculate the molefraction of the products at this temperature in K\n", "KP1=3.866;//Natural logarithm of equilibrium constant at 2400 K for the equation \n", "\n", "//Calculations\n", "K1=exp(KP1);//The value of equilibrium constant at 2400 K\n", "nr=1+0.5;//The number of moles of reactants\n", "Pp=(p*Tc)/(nr*T);//Pressure exercted on the products side per mole in atm/mole\n", "a=0.098;//The dissociation of 1 mole of CO2\n", "np=(a+2)/2;//The number of moles of products\n", "xco=[2*(1-a)]/(2+a);//Mole fraction of CO2\n", "xc=[2*a]/(2+a);//Mole fraction of CO\n", "xo=a/(2+a);//Mole fraction of O2\n", "PP=5.333*np;//Pressure of the product in bar\n", "\n", "//output\n", "printf('Mole fraction of the carbondioxide is %3.4f \n Mole fraction of the carbonmonoxide is %3.4f \n Mole fraction of oxygen is %3.4f \n Pressure of the product is %3.3f bar',xco,xc,xo,PP)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.1: Volume_of_air.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "E=20;//Methanol burned with excess air in percentage \n", "p=1;//Pressure of air in bar\n", "t=27;//Temperature of air in degree centigrade\n", "O=32;//The molecular weight of oxygen\n", "N=28;//The molecular weight of nitrogen\n", "R=8314;//Universal gas constant in Nm/kmolK\n", "C=32;//Molecular weight of methanol\n", "CO=44;//Molecular weight of the carbondioxide \n", "H=18;//Molecular weight of the water\n", "\n", "//Calculations\n", "S=[(1.8*O)+(6.768*N)]/C;//Stoichiometric air/fuel ratio\n", "A=[(1.8*O)+(6.768*N)]/C;//Actual air/fuel ratio\n", "M=1.8+6.768;//1 kmole of fuel reacts with air in kmole\n", "V=(M*R*(t+273))/(p*10^5);//Volume of air in m^3/kmole fuel\n", "T=(1+1.8+6.768);//The total number of moles in the reactants when excess air is supplied in moles\n", "Cm=(1/T);//Mole fraction of the methanol\n", "Om=(1.8/T);//Mole fraction of the oxygen\n", "Nm=(6.768/T);//Mole fraction of the nitrogen\n", "Mr=(Cm*C)+(Om*O)+(Nm*N);//Molecular weight of reactants \n", "Tp=(1+2+6.768+0.3);//Total number of moles in the products in moles\n", "COm=(1/Tp);//Mole fraction of the carbondioxide\n", "Hp=(2/Tp);//Mole fraction of the water \n", "Np=(6.768/Tp);//Mole fraction of the nitrogen\n", "Op=(0.3/Tp);//Mole fraction of the oxygen\n", "Mp=(COm*CO)+(Hp*H)+(Np*N)+(Op*O);//Molecular weight of products\n", "Pp=(Hp*p);//Partial pressure of water vapour in bar\n", "D=60;//The dew point is the saturation temp corresponding to partial pressure in degree centigrade\n", "\n", "//Output\n", "printf(' (a) The volume of air supplied per kmole of fuel = %3.1f m^3/kmole fuel \n (b) The molecular weight of the reactants = %3.2f \n The molecular weight of the products = %3.2f \n (c) The dew point of the products = %3.0f degree centigrade ',V,Mr,Mp,D)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.20: The_adiabatic_flame_temperature.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "t=25;//The temperature of air in degree centigrade\n", "p=1;//The pressure of air in atm\n", "T1=2200;//Given first temperature in K\n", "T2=2400;//Given second temperature in K\n", "h1=59.86;//The change in enthalpy of hydrogen at 2200 K in MJ/kmol\n", "h2=66.915;//The change in enthalpy of hydrogen at 2400 K in MJ/kmol\n", "T=298;//The temperature of air in K\n", "\n", "//Calculations\n", "HR=0;//The total enthalpy on the reactants side since all the reactants are elements\n", "Kp1=-6.774;//Natural logarithm of equilibrium constant at 2200 K for the equation \n", "K1=exp(Kp1);//The value of equilibrium constant at 2200 K\n", "a1=0.02;//By trail and error method the degree of dissociation of H2O\n", "hfh=-241.82;//The enthalpy of formation of water at both 2200 and 2400 K in MJ/kmol\n", "hfh1=83.036;//The change in enthalpy of water at 2200 K in MJ/kmol\n", "hfd1=59.86;//The change in enthalpy of hydrogen at 2200 K in MJ/kmol\n", "hfo1=66.802;//The change in enthalpy of oxygen at 2200 K in MJ/kmol\n", "hfn1=63.371;//The change in enthalpy of nitrogen at 2200 K in MJ/kmol\n", "HP1=(0.98*(hfh+hfh1))+(0.02*hfd1)+(0.01*hfo1)+(1.88*hfn1);//The enthalpy on the products side in MJ/kmol \n", "a2=0.04;//By trail and error method the degree of dissociation of H2O at 2400 K\n", "hfh2=93.604;//The change in enthalpy of water at 2400 K in MJ/kmol\n", "hfd2=66.915;//The change in enthalpy of hydrogen at 2400 K in MJ/kmol\n", "hfo2=74.492;//The change in enthalpy of oxygen at 2400 K in MJ/kmol\n", "hfn2=70.651;//The change in enthalpy of nitrogen at 2400 K in MJ/kmol\n", "HP2=(0.96*(hfh+hfh2))+(0.04*hfd2)+(0.02*hfo2)+(1.88*hfn2);//The enthalpy on the products side in MJ/kmol \n", "H1=HP1-HR;//The total change in enthalpy at 2200 K in MJ/kmol\n", "H2=HP2-HR;//The total change in enthalpy at 2400 K in MJ/kmol\n", "Tl=[[[T2-T1]/[HP2-HP1]]*[HR-HP1]]+T1;//The required temperature in K\n", "\n", "//Output\n", "printf('The adiabatic flame temperature taking dissociation into account is %3.0f K',Tl)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.2: Mass_of_exhaust_gases.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "C1=40;//The content of C7H16 in the fuel in percentage\n", "C2=60;//The content of C8H18 in the fuel in percentage\n", "d=0.12;//The diameter of the bore in m\n", "l=0.145;//The length of the bore in m\n", "r=8.5;//Compression ratio \n", "p=1.1;//Pressure at exhaust stroke in bar\n", "T=720;//The temperature at the exhaust stroke in K\n", "pi=3.141;//Mathematical constant pi\n", "O=32;//The molecular weight of oxygen\n", "N=28;//The molecular weight of nitrogen\n", "C3=100;//Molecular weight of C7H16\n", "C4=114;//The molecular weight of C8H18\n", "R=8314;//Universal gas constant in Nm/kmolK\n", "CO2=44;//Molecular weight of the carbondioxide \n", "C5=28;//Molecular weight of the carbonmonoxide\n", "H=18;//Molecular weight of the water\n", "\n", "//Calculations\n", "N2=100-(12+1.5+2.5);//Percentage of nitrogen in the dry products of combustion\n", "Y=84/3.76;//The number of moles oxygen is supplied\n", "X=13.5/7.6;//Moles of carbon\n", "Z=(22.34-15.25)*2;//The number of moles of hydrogen\n", "Hl=(6.4+10.8)/2;//Number of moles of hydrogen on L.H.S\n", "Hr=7.98;//Number of moles of hydrogen on R.H.S\n", "Hd=Hl-Hr;//Difference of hydrogen moles\n", "A=[[12.58*(O+(3.76*N))]/[((C1/100)*C3)+((C2/100)*C4)]];//The Air/fuel ratio\n", "Vs=(pi/4)*d^2*l;//Swept volume of the cylinder in m^3\n", "Vc=Vs/(r-1);//Clearance volume in m^3\n", "M=[(6.757*CO2)+(0.8446*C5)+(1.408*O)+(47.3*N)+(8.6*H)]/[6.757+0.8446+1.408+47.3+8.6];//Molecular weight of the product\n", "R1=R/M;//Gas constant in J/kgK\n", "m=[(p*10^5)*Vc]/[R1*T];//Mass of the exhaust gases in the clearance space in kg\n", "\n", "//Output \n", "printf('(a)The air/fuel ratio =%3.2f \n (b)The mass of the exhaust gases in the clearance space =%3.7f kg ',A,m)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.3: Volumetric_analysis.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "C=0.86;//The amount of carbon content in the 1kg of fuel by weight in kg\n", "H=0.05;//The amount of hydrogen content in the 1kg of fuel by weight in kg\n", "O=0.02;//The amount of oxygen content in the 1kg of fuel by weight in kg\n", "S=0.005;//The amount of sulphur content in the 1kg of fuel by weight in kg\n", "N=0.065;//The amount of nitrogen content in the 1kg of fuel by weight in kg\n", "E=25;//The amount of excess air supplied in percentage\n", "o=32;//Molecular weight of the oxygen\n", "co=44;//Molecular weight of the carbondioxide \n", "c=12;//Molecular weight of the carbon\n", "s=32;//Molecular weight of the sulphur\n", "so=64;//Molecular weight of sulphur dioxide\n", "n=28;//Molecular weight of the nitrogen\n", "\n", "//Calculations\n", "o1=(o/c)*C;//The amount of oxygen required for 0.86 kg of carbon in kg\n", "coa=(co/c)*C;//The amount of carbondioxide produced for 0.86 kg of carbon in kg\n", "o2=(o/4)*H;//The amount of oxygen required for 0.05 kg of hydrogen in kg\n", "h2=(36/4)*H;//The amount of water produced for 0.05 kg of hydrogen in kg\n", "o3=(o/s)*S;//The amount of oxygen required for 0.005 kg of sulphur in kg\n", "s1=(so/s)*S;//The amount of sulphur dioxide produced for 0.005 kg of sulphur in kg\n", "To=o1+o2+o3;//Total oxygen required for the complete combustion of fuel in kg\n", "Tt=To-O;//The amount of oxygen required per kg of fuel for complete combustion theoretically in kg\n", "As=(Tt*100)/23;//Stoichiometric air/fuel ratio\n", "as=As*(1+(E/100));//The actual quantity of air supplied per kg of fuel in kg\n", "o2a=0.23*(E/100)*As;//The oxygen in the excess air in kg\n", "n2a=0.77*(1+(E/100))*As;//The nitrogen in the air in kg\n", "n2e=n2a+N;//Total nitrogen in the exhaust in kg\n", "Tw=coa+n2e+o2a;//Total weight in kg\n", "pco=(coa/Tw)*100;//Percentage composition of carbondioxide\n", "pn=(n2e/Tw)*100;//Percentage composition of nitrogen\n", "po=(o2a/Tw)*100;//Percentage composition of oxygen\n", "mco=(coa/co);//Moles of carbondioxide\n", "mn=(n2e/n);//Moles of nitrogen\n", "mo=(o2a/o);//Moles of oxygen\n", "Tm=mco+mn+mo;//Total moles\n", "vco=(mco/Tm)*100;//Volumetric analysis of carbondioxide in percentage\n", "vn=(mn/Tm)*100;//Volumetric analysis of nitrogen in percentage\n", "vo=(mo/Tm)*100;//Volumetric analysis of oxygen in percentage\n", "\n", "//Output\n", "printf(' (a)Stoichiometric air/fuel ratio = %3.2f \n (b)The percentage of dry products of combustion by weight : \n CO2 = %3.2f percent \n N2 = %3.2f percent \n O2 = %3.2f percent \n (c)The percentage of dry products of combustion by volume : \n CO2 = %3.2f percent \n N2 = %3.2f percent \n O2= %3.2f percent ',As,pco,pn,po,vco,vn,vo)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.4: Fuel_consumption.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "CO=12;//The composition of carbondioxide of combustion by volume in percentage \n", "C=0.5;//The composition of carbonmoxide of combustion by volume in percentage \n", "O=4;//The composition of oxygen of combustion by volume in percentage \n", "N=83.5;//The composition of nitrogen of combustion by volume in percentage \n", "o=32;//Molecular weight of the oxygen\n", "co=44;//Molecular weight of the carbondioxide \n", "c=12;//Molecular weight of the carbon\n", "s=32;//Molecular weight of the sulphur\n", "so=64;//Molecular weight of sulphur dioxide\n", "n1=28;//Molecular weight of the nitrogen\n", "h=2;//Molecular weight of the hydrogen\n", "\n", "//Calculations\n", "m=12+0.5;//Balancing carbon\n", "x=N/3.76;//Balancing nitrogen\n", "z=[x-(CO+(C/2)+O)]*2;//Balancing oxygen\n", "n=z*h;//Balancing hydrogen\n", "Af=[(x*o)+(N*n1)]/[(m*c)+(n)];//Air/fuel ratio\n", "As=[(18.46*o)+(69.41*n1)]/173.84;//Stoichiometric air/fuel ratio\n", "Ta=(Af/As)*100;//Percent theoretical air\n", "mc=[(m*c)/173.84]*100;//Composition of carbon on mass basis in percent\n", "mh=(n/173.84)*100;//Composition of hydrogen on mass basis in percent\n", "\n", "//Output\n", "printf(' (a)The air/fuel ratio = %3.2f \n (b)The percent theoretical air = %3.1f percent \n (c)The percentage composition of fuel on a mass basis : \n C = %3.1f percent \n H = %3.1f percent ',Af,Ta,mc,mh)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.5: Percentage_analysis.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "C=86;//The composition of carbon in the fuel by weight in percentage\n", "H=14;//The composition of hydrogen in the fuel by weight in percentage\n", "e=1.25;//Equivalent ratio\n", "o=32;//Molecular weight of the oxygen\n", "co=44;//Molecular weight of the carbondioxide \n", "c=12;//Molecular weight of the carbon\n", "s=32;//Molecular weight of the sulphur\n", "so=64;//Molecular weight of sulphur dioxide\n", "n=28;//Molecular weight of the nitrogen\n", "h2=2;//Molecular weight of the hydrogen\n", "Fc=0.86;//Fraction of C\n", "\n", "//Calculations\n", "Ra=1/Fc;//Relative air/fuel ratio\n", "x=2*[1+(0.9765/2)-(1.488*0.8)];//By oxygen balance\n", "Tm=0.5957+0.4043+4.476;//Total number of moles of dry exhaust gas\n", "vc=(0.5957/Tm)*100;//Volumetric analysis of carbonmonoxide of combustion in percentage\n", "vco=(0.4043/Tm)*100;//Volumetric analysis of carbondioxide of combustion in percentage\n", "vn=(4.476/Tm)*100;//Volumetric analysis of nitrogen of combustion in percentage\n", "\n", "//Calculations\n", "printf(' The percentage analysis of dry exhaust gas by volume : \n CO = %3.2f percent \n CO2 = %3.2f percent \n N2 = %3.2f percent ',vc,vco,vn)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.6: Heat_transfer.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "t=25;//The temperature of both reactants and products in degree centigrade\n", "p=1;//The pressure of both reactants and products in bar\n", "\n", "//Calculations \n", "h=0;//Enthalpy of all elements at given temp and pressure \n", "hf1=-103.85;//The enthalpy of the compound C3H8 in the reactants side at given temp and pressure in MJ/kmol\n", "hf2=-393.52;//The enthalpy of carbondioxide for the given temp and pressure in MJ/kmol\n", "hf3=-285.8;//The enthalpy of the water for the given temp and pressure in MJ/kmol\n", "hf4=[3*hf2]+[4*hf3];//Total enthalpy in the products side in MJ/kmol\n", "Q=hf4-hf1;//The heat transfer per mole of fuel in MJ/kmol fuel\n", "\n", "//Output\n", "printf(' The heat transfer per mole of fuel = %3.2f kJ/mol fuel',Q)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.7: The_work_for_a_fuel_rate.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "t=25;//The temperature of the air entering the diesel engine in degree centigrade \n", "T=600;//The temperature at which the products are released in K\n", "Ta=200;//Theoretical air used in percentage \n", "Q=-93;//Heat loss from the engine in MJ/kmol fuel\n", "f=1;//The fuel rate in kmol/h\n", "\n", "//Calculations \n", "hfr=-290.97;//The enthalpy of C12H26 for the given conditions in the reactants side in MJ/kmol\n", "h1=-393.52;//Enthalpy of carbondioxide at formation state in MJ/kmol\n", "h11=12.916;//The change in enthalpy for the given temp of CO2 in MJ/kmol\n", "hfc=h1+h11;//The enthalpy of the carbondioxide in MJ/kmol\n", "h2=-241.82;//The enthalpy of water at formation state in MJ/kmol\n", "h22=10.498;//The change in enthalpy for the given temp of water in MJ/kmol\n", "hfh=h2+h22;//The enthalpy of the water in MJ/kmol\n", "h3=0;//Enthalpy of the oxygen gas \n", "h33=9.247;//The change in enthalpy for the given temp of oxygen in MJ/kmol\n", "hfo=h3+h33;//The enthalpy of oxygen in MJ/kmol\n", "h4=0;//The enthalpy of the nitrogen gas\n", "h44=8.891;//The change in enthalpy of the nitrogen for the given temp in MJ/kmol\n", "hfn=h4+h44;//The enthalpy of nitrogen in MJ/kmol\n", "hfp=(12*hfc)+(13*hfh)+(18.5*hfo)+(139.12*hfn);//The total enthalpy on the products side in MJ/kmol\n", "W=Q+hfr-hfp;//The work in MJ/kmol fuel\n", "W1=(f*W*10^3)/3600;//The work in kW\n", "\n", "//Output\n", "printf('The work for a fuel rate of 1 kmol/h is %3.1f kW',W1)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.8: The_fuel_consumption.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "P=600;//Power of an engine in kW\n", "t=25;//Temperature at which fuel is used in degree centigrade\n", "Ta=150;//Theoretical air used in percentage\n", "T1=400;//The temperature at which air enters in K\n", "T2=700;//The temperature at which the products of combustion leave in K\n", "Q=-150;//The heat loss from the engine in kW\n", "C=12;//Molecular weight of carbon\n", "h=1;//Molecular weight of hydrogen\n", "\n", "//Calculations\n", "hfc=-259.28;//The enthalpy of the compound C8H18 for the given conditions in MJ/kmol fuel\n", "hfo1=3.029;//The enthalpy of the oxygen gas in MJ/kmol fuel\n", "hfn1=2.971;//The enthalpy of the nitrogen gas in MJ/kmol fuel\n", "HR=(hfc)+(1.5*12.5*hfo1)+(1.5*12.5*3.76*hfn1);//The total enthalpy on the reactants side in MJ/kmol fuel\n", "hfco=-393.52;//The enthalpy of carbondioxide for formation state in MJ/kmol fuel\n", "hfco1=17.761;//The change in enthalpy of the carbondioxide for temp difference in MJ/kmol fuel\n", "hfh=-241.82;//The enthalpy of water for formation state in MJ/kmol fuel\n", "hfh1=14.184;//The change in the enthalpy of the water for temp difference in MJ/kmol fuel\n", "hfo2=12.502;//The enthalpy of the oxygen gas in MJ/kmol fuel\n", "hfn2=11.937;//The enthalpy of the nitrogen gas in MJ/kmol fuel\n", "HP=(8*(hfco+hfco1))+(9*(hfh+hfh1))+(6.25*hfo2)+(70.5*hfn2);//The total enthalpy on the products side in MJ/kmol fuel\n", "H=HP-HR;//The total change in enthalpy of reactants and products in MJ/kmol fuel\n", "nf=([Q-P]*3600)/[H*10^3];//The fuel rate in kmol/s\n", "M=(8*C)+(18*h);//Molecular weight of fuel \n", "mf=nf*M;//The fuel consumption in kg/h\n", "\n", "//Output\n", "printf(' The fuel consumption for complete combustion is %3.2f kg/h',mf)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3.9: The_heat_transfer.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "//Input data\n", "t=25;//Temperature at which fuel is used for combustion in degree centigrade \n", "p=1;//The pressure at which fuel is used in bar\n", "T=400;//The temperature of the products of combustion in K\n", "R=8.314*10^-3;//Universal gas constant\n", "\n", "//Calculations\n", "hfc=-103.85;//Enthalpy of the compound C3H8 in MJ/kmol fuel \n", "HR=[1*(hfc-(R*(t+273)))]+[5*(-R*(t+273))];//The total enthalpy of the reactants in MJ/kmol fuel\n", "hfco=-393.52;//The enthalpy of the carbondioxide in MJ/kmol fuel\n", "hfco1=4.008;//The change in enthalpy of the carbondioxide for the given conditions in MJ/kmol fuel\n", "hfh=-241.82;//The enthalpy of the water in MJ/kmol fuel\n", "hfh1=3.452;//The change in enthalpy of the water for the given conditions in MJ/kmol fuel\n", "HP=[3*(hfco+hfco1-(R*T))]+[4*(hfh+hfh1-(R*T))];//The total enthalpy of the products in MJ/kmol fuel\n", "Q=HP-HR;//The total change in the enthalpy of reactans and products in MJ/kmol fuel\n", "Q1=-Q;//Heat liberated in kJ/mol propane\n", "\n", "//Output\n", "printf('The heat transfer per mole of propane = %3.1f kJ/mol propane',Q1)" ] } ], "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 }