{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 4 : Fuels and combustion"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex: 4.1 Pg: 211"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a) Mass of air supplied WA = 13.80 kg \n",
      " (b)Percentage excess air supplied = 4.68 percentage \n",
      " (c)mass of dry flue gas formed = 13.82 kg \n",
      " (d) Mass of water vapour formed = 0.90 kg\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "#Input data\n",
    "C=84##The mass of carbon present in the fuel in %\n",
    "H=10##The mass of hydrogen present in the fuel in %\n",
    "S=3.2##The mass of sulphur present in the fuel in %\n",
    "O=1.6##The mass of oxygen present in the fuel in %\n",
    "I=1.2##The mass of incombustible in the fuel in %\n",
    "X=15.72##The flue gas of combined CO2 and SO2 by volume in %\n",
    "Og=1##The flue gas of O2 by volume in %\n",
    "Y=100##Let us consider the fuel oil in kg\n",
    "C1=12##Molecular weight of Carbon \n",
    "H1=2##Molecular weight of hydrogen\n",
    "S1=32##Molecular weight of sulphur\n",
    "O1=32##Molecular weight of oxygen\n",
    "Co2=44##Molecular weight of carbondioxide\n",
    "So2=64##Molecular weight of sulphurdioxide\n",
    "N1=28##Molecular weight of nitrogen \n",
    "H2O=18##Molecular weight of water\n",
    "\n",
    "#Calculations\n",
    "b=C/C1##Equating coefficients of the carbon from equation\n",
    "g=H/H1##Equating coefficients of the hydrogen from equation\n",
    "d=S/S1##Equating coefficients of the sulphur from the equation\n",
    "e=(b+d)/(X/Og)##By volumetric analysis\n",
    "x=b+d+e+(g/2)-(O/O1)##Moles of oxygen are supplied for combustion\n",
    "f=3.76*x##Equating coefficients of the nitrogen from equation\n",
    "Mo=x*O1##Mass of oxygen supplied in kg\n",
    "Ma=Mo/0.232##Mass of air supplied for 100 kg of fuel in kg\n",
    "Wa=Ma/100##Mass of air supplied for 1 kg fuel in kg\n",
    "Wrh=((11.5*C)+(34.5*((H)-(O/8))+(4.3*S)))/100##Theoretical air required per kg of fuel in kg\n",
    "E=((Wa-Wrh)/Wrh)*100##Percentage of excess air in %\n",
    "D=(b*Co2)+(d*So2)+(e*O1)+(f*N1)##Mass of dry flue gas formed for 100 kg fuel in kg\n",
    "dfg=D/100##Mass of dry flue gas formed per kg of fuel in kg\n",
    "Mw=(g*H2O)/100##Mass of water vapour formed per kg of fuel\n",
    "\n",
    "#Output\n",
    "print \"(a) Mass of air supplied WA = %3.2f kg \\n (b)Percentage excess air supplied = %3.2f percentage \\n (c)mass of dry flue gas formed = %3.2f kg \\n (d) Mass of water vapour formed = %3.2f kg\"%(Wa,E,dfg,Mw)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex: 4.2 Pg 212"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The percentage excess air used is = 11.3 percentage\n"
     ]
    }
   ],
   "source": [
    "#Input data\n",
    "CO2=11.5##Percentage of carbondioxide present in combustion in %\n",
    "O2=2.7##Percentage of oxygen present in the combustion in %\n",
    "CO=0.7##Percentage of carbonmonoxide present in the combuston in %\n",
    "\n",
    "#Calculations \n",
    "a=85.1/3.76##Equating moles for nitrogen from the equation \n",
    "x=(CO2+CO)/3##Equating moles for carbon from the equation \n",
    "b=(a-CO2-(CO/2)-O2)*2##Equating moles for oxygen from the equation \n",
    "y=a/x##Moles of oxygen supplied for one mole of propane gas\n",
    "z=5##Theoretically 5 moles of oxygen are required for reacting\n",
    "E=((y-z)/z)*100##The excess of air supplied in %\n",
    "\n",
    "#Output\n",
    "print \"The percentage excess air used is = %3.1f percentage\"%(E)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex: 4.3 Pg: 213"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " (a) The air fuel ratio during the test = 17.05 \n",
      " (b) The excess or deficiency of air used =  18 Percentage of excess air used\n"
     ]
    }
   ],
   "source": [
    "#Input data\n",
    "CO2=12.1##The amount of carbondioxide released from the combustion in %\n",
    "O2=3.8##The amount of oxygen released from the combustion in %\n",
    "CO=0.9##The amount of carbonmonoxide released from the combustion in %\n",
    "MO=32##Molecular weight of Oxygen\n",
    "\n",
    "#Calculations\n",
    "a=83.2/3.76##Equating moles for nitrogen from the equation \n",
    "b=(2*a)-(2*CO2)-(2*O2)-CO##Equating moles for oxygen from the equation\n",
    "x=CO2+CO##Equating moles for carbon from the equation\n",
    "y=2*b##Equating moles for hydrogen from the equation\n",
    "z=18.75##Moles of Oxygen from the stoichiometric equation \n",
    "z1=a##Moles of Oxygen from the combustion equation \n",
    "E=((z1-z)/z)*100##Percentage of excess air in%\n",
    "A=(a*MO)/0.232##Actual air supplied per mole of C13H23\n",
    "Mc=179##Molecular weight of C13H23\n",
    "Af=A/Mc##Air fuel ratio during the test\n",
    "\n",
    "#Output\n",
    "print \" (a) The air fuel ratio during the test = %3.2f \\n (b) The excess or deficiency of air used = %3.0f Percentage of excess air used\"%(Af,E)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex: 4.4 Pg: 214"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " (a)The amount of dry flue gas produced per kg fuel = 11.73 kg \n",
      " (b)The dry exhaust loss = 1723.7 kJ/kg fuel and incomplete combustion loss per kg fuel = 1648.15 kJ/kg fuel \n",
      " (c)The boiler efficiency = 83.12 percentage \n",
      " (d) THe fuel burning rate = 5.566 kg/s \n",
      " (e)The percentage of excess air used = 31.12 percentage \n",
      " (f) The percentage of energy absorbed in the superheater = 24.05 percentage\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "#Input data\n",
    "C=61##The mass of carbon present in the coal according to coal analysis on mass basis in %\n",
    "H=4##The mass of hydrogen present in the coal according to coal analysis on mass basis in %\n",
    "O=3##The mass of oxygen present in the coal according to coal analysis on mass basis in %\n",
    "N=2##The mass of nitrogen present in the coal according to coal analysis on mass basis in %\n",
    "S=1##The mass of sulphur present in the coal according to coal analysis on mass basis in %\n",
    "M=4##The mass of moisture present in the coal according to coal analysis on mass basis in %\n",
    "A=25##The mass of ash present in the coal according to coal analysis on mass basis in %\n",
    "HHV=24.3##The high heating value of the coal i.e energy released by complete combustion of 1 kg fuel in MJ/kg\n",
    "CO2=12##The amount of carbondioxide by volume according to dry flue gas analysis in %\n",
    "CO=1.5##The amount of carbonmonoxide by volume according to dry flue gas analysis in %\n",
    "O2=7##The amount of oxygen by volume according to dry flue gas analysis in %\n",
    "N2=79.5##The amount of nitrogen by volume according to dry flue gas analysis in %\n",
    "Te=170##Exhaust gas temperature in degree centigrade\n",
    "L=0.03##Energy loss other than dry exhaust loss and incomplete combustion is 3% of HHV\n",
    "R=150##Steam generation rate in t/h\n",
    "Po=100##Steam condition at boiler outlet in bar\n",
    "To=500##Steam condition at boiler outlet in degree centigrade\n",
    "Ti=160##Feed water inlet temperature in degree centigrade\n",
    "HCO2=33083##Heat of reaction in kJ/kg carbon\n",
    "HCO=9500##Heat of reaction in kJ/kg carbon\n",
    "cp=1.05##Heat capacity of dry flue gas (dfg) in kJ/kgK\n",
    "Ta=30##The ambient temperature of air in degree centigrade\n",
    "Mc=44##Molecular weight of Carbondioxide\n",
    "Mco=28##Molecular weight of carbonmonoxide\n",
    "Mo=32##Molecular weight of oxygen\n",
    "Mn=28##Molecular weight of nitrogen\n",
    "Mx=12##Molecular weight of carbon\n",
    "h1=3373.7##Enthalpy at 100 bar and 500 degree centigrade in kJ/kg\n",
    "hf=675.55##Enthalpy at 160 degree centigrade in kJ/kg\n",
    "hg=2724.7##Enthalpy at 100 bar in kJ/kg\n",
    "\n",
    "#Calculations\n",
    "Mdfg=(((C/100)*((Mc*(CO2/100))+(Mco*(CO/100))+(Mo*(N2/100))))/(Mx*((CO2/100)+(CO/100))))##Mass of dry flue gas produced per kg of fuel in kg\n",
    "Ed=Mdfg*cp*(Te-Ta)##Energy loss due to dry exhaust gas in kJ/kg fuel\n",
    "#Since Mdfg is 11.73kg through sciab calculation, there is a variation in Ed value and Ei value\n",
    "Ei=((Mdfg)*(HCO2-HCO)*(Mx/Mco))*((Mco*(CO/100))/((Mc*(CO2/100))+(Mco*(CO/100))+(Mo*(O2/100))+(Mco*(N2/100))))##Energy loss due to incomplete combustion in kJ/kg fuel\n",
    "El=L*HHV##Energy loss other than dry exhaust loss and incomplete combustion loss in MJ/kg fuel\n",
    "TEl=(Ed/1000)+(Ei/1000)+El##Total energy loss in MJ/kg fuel\n",
    "Be=((HHV-TEl)/(HHV))*100##Boiler efficiency in %\n",
    "Wf=(((R*1000)*(h1-hf))/((Be/100)*HHV*1000))/3600##The fuel burning rate in kg/s\n",
    "Wth=(11.5*(C/100))+(34.5*((H/100)-(O/800)))+(4.3*(S/100))##Thearetical air required per kg of fuel in kg\n",
    "WA=(((3.04*(N2/100)*(C/100)))/((CO2/100)+(CO/100)))-((N/100)*(1/0.768))##Actual air supplied per kg of fuel in kg\n",
    "per=((WA-Wth)/Wth)*100##Percentage excess air used in %\n",
    "pea=((h1-hg)/(h1-hf))*100##Percentage of energy absorbed in the superheater\n",
    "\n",
    "#Output\n",
    "print \" (a)The amount of dry flue gas produced per kg fuel = %3.2f kg \\n (b)The dry exhaust loss = %3.1f kJ/kg fuel and incomplete combustion loss per kg fuel = %3.2f kJ/kg fuel \\n (c)The boiler efficiency = %3.2f percentage \\n (d) THe fuel burning rate = %3.3f kg/s \\n (e)The percentage of excess air used = %3.2f percentage \\n (f) The percentage of energy absorbed in the superheater = %3.2f percentage\"%(Mdfg,Ed,Ei,Be,Wf,per,pea)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex: 4.5 Pg: 216"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " (a)The total volume of combustion products at 200 degee centigrade and 1.013 bar = 26.26 m**3 \n",
      " (b)The dry flue gas analysis based on carbondioxide,oxygen and nitrogen is \n",
      " Carbondioxide = 11.64 percent \n",
      " Oxygen = 5.07 percent \n",
      " Nitrogen = 83.29 percent\n"
     ]
    }
   ],
   "source": [
    "#Input data\n",
    "C=83.7##The amount of carbon present in the fuel oil according to ultimate analysis of a fuel oil in %\n",
    "H=12.7##The amount of hydrogen present in the fuel oil according to ultimate analysis of a fuel oil in %\n",
    "O=1.2##The amount of oxygen present in the fuel oil according to ultimate analysis of a fuel oil in %\n",
    "N=1.7##The amount of nitrogen present in the fuel oil according to ultimate analysis of a fuel oil in %\n",
    "S=0.7##The amount of sulphur present in the fuel oil according to ultimate analysis of a fuel oil in %\n",
    "td=27##The dry bulb temperature of combustion air in degree centigrade\n",
    "tw=21##The wet bulb temperature of combustion air in degree centigrade\n",
    "E=0.3##Excess air and assuming complete combustion in %\n",
    "t=200##Temperature to find total volume of combustion products in degree centigrade\n",
    "p=1.013##Pressure to find total volume of combustion procucts in bar\n",
    "\n",
    "#Calculations\n",
    "Wth=(11.5*(C/100))+(34.5*((H/100)-(O/100)*(1/8)))+(4.3*(S/100))##Theoretical air required per kg of fuel in kg\n",
    "WA=(1+E)*Wth##Actual air required per kg of fuel in kg/kg fuel\n",
    "sh=0.0132##Specific humidity at DBT and WBT in kg moisture/kg dry air\n",
    "W=WA*sh##Water vapour entering with air per kg fuel in kg vap/kg fuel\n",
    "Tw=(9*(H/100))+WA##Total water vapour formed per kg fuel in kg\n",
    "CO2=(44/12)*(C/100)##mass of carbondioxide gas per kg of fuel\n",
    "O2=0.232*E*Wth##Mass of oxygen gas per kg of fuel\n",
    "N2=0.768*(1+E)*Wth+(N/100)##Mass of nitrogen gas per kg of fuel\n",
    "SO2=(64/32)*(S/100)##Mass of nitrogen gas per kg of fuel\n",
    "H2O=1.383##Mass of water per kg of fuel\n",
    "M=(CO2/44)+(O2/32)+(N2/28)+(SO2/64)+(H2O/18)##Moles of combustion gases formed per kg fuel\n",
    "VG=M*22.4*((273+t)/273)*(1.013/1.013)##Volume of flue gases at 200 degree centigrade and 1.013 bar per kg fuel\n",
    "CO21=((CO2/44)/((CO2/44)+(O2/32)+(N2/28)))*100##Composition of dry flue gas CO2 by volume\n",
    "O21=((O2/32)/((CO2/44)+(O2/32)+(N2/28)))*100##Composition of dry flue gas O2 by volume\n",
    "N21=((N2/28)/((CO2/44)+(O2/32)+(N2/28)))*100##Composition of dry flue gas N2 by volume\n",
    "\n",
    "#Output\n",
    "print \" (a)The total volume of combustion products at 200 degee centigrade and 1.013 bar = %3.2f m**3 \\n (b)The dry flue gas analysis based on carbondioxide,oxygen and nitrogen is \\n Carbondioxide = %3.2f percent \\n Oxygen = %3.2f percent \\n Nitrogen = %3.2f percent\"%(VG,CO21,O21,N21)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex: 4.6 Pg: 217"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " (a)The molecular weight of the combustion products M = 28.36 kg/kg mol \n",
      " (b) The total gas volume for complete combustion at 260 degree centigrade and 1.013 bar is 31.49 m**3/kg fuel \n",
      " (c)The dry flue gas analysis on \n",
      " carbondioxide = 9.7 percent \n",
      " oxygen = 4.6 percent \n",
      " nitrogen = 85.7 percent \n"
     ]
    }
   ],
   "source": [
    "#Input data\n",
    "C2H6=22.6##The amount of gas present in the fuel gas according to volumetric analysis of fuel gas by volume in %\n",
    "CH4=73.6##The amount of gas present in the fuel gas according to volumetric analysis of fuel gas by volume in %\n",
    "CO2=2.4##The amount of gas present in the fuel gas according to volumetric analysis of fuel gas by volume in %\n",
    "N2=1.4##The amount of gas present in the fuel gas according to volumetric analysis of fuel gas by volume in %\n",
    "E=0.25##Assuming combustion air to be dry and in excess\n",
    "t=260##The temperature for the total gas volume for complete combustion in degree centigrade\n",
    "p=1.013##The pressure for the total gas volume for complete combustion in bar\n",
    "Mch=30##Molecular weight of C2H6\n",
    "Mc=16##Molecular weight of CH4\n",
    "Mco=44##Molecular weight of CO2\n",
    "Mn=28##Molecular weight of N2\n",
    "Mo=32##Molecular weight of O2\n",
    "Mh=18##Molecular weight of H2O\n",
    "\n",
    "#Calculations\n",
    "x=100##Assuming 100 moles of fuel gas \n",
    "Mf=((C2H6/100)*Mch)+((CH4/100)*Mc)+((N2/100)*Mn)+((CO2/100)*Mco)##Molecular weight of fuel gas\n",
    "Ma=((226.3*(Mo+(3.76*Mn))*(1+E)))/28.96##Moles of air supplied\n",
    "Mc=1440##Moles of combustion gas from the equation \n",
    "Mr=x+Ma+Mc##Total reaction molecules\n",
    "Mwc=((121.2*Mco)+(215*Mh)+(56.6*Mo)+(1065.4*Mn))/Mc##Molecular weight of combustion gas in kg/kgmol\n",
    "Mt=Mc/(x*20)##Total number of moles of combustion gas per kg fuel gas\n",
    "VG=Mt*22.4*((273+t)/273)##Volume of combustion products per kg fuel gas\n",
    "CO21=(121.2/(121.2+56.6+1065.4))*100##Gas analysis of CO2 by volume\n",
    "O21=(56.6/1243.2)*100##Gas analysis of O2 by volume\n",
    "N2=(1065.4/1243.2)*100##Gas analysis of N2 by volume\n",
    "\n",
    "#Output\n",
    "print \" (a)The molecular weight of the combustion products M = %3.2f kg/kg mol \\n (b) The total gas volume for complete combustion at 260 degree centigrade and 1.013 bar is %3.2f m**3/kg fuel \\n (c)The dry flue gas analysis on \\n carbondioxide = %3.1f percent \\n oxygen = %3.1f percent \\n nitrogen = %3.1f percent \"%(Mwc,VG,CO21,O21,N2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex: 4.7 Pg: 218"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The air leakage into the air preheater per kg of coal fired is   1 kg air/kg fuel\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "#Input data\n",
    "CO21=9.7##Carbondioxide gas analysis before the air preheater \n",
    "CO22=9.2##Carbondioxide gas analysis after the air preheater\n",
    "O21=4.0##Oxygen gas analysis before the air preheater\n",
    "O22=4.9##Oxygen gas analysis after the air preheater\n",
    "N21=86.3##Nitrogen gas analysis before the air preheater\n",
    "N22=85.9##Nitrogen gas analysis after the air preheater\n",
    "C=72.0##The coal used shows the carbon percentage by mass in %\n",
    "\n",
    "#Calculations\n",
    "W1=((3.04)*(N21/100)*(C/100))/((CO21/100))##Before air preheater in kg air/kg fuel\n",
    "W2=((3.04)*(N22/100)*(C/100))/((CO22/100))##After air preheater in kg air/kg fuel\n",
    "A=W2-W1##Air leakage in kg air/kg fuel\n",
    "\n",
    "#Output\n",
    "print \"The air leakage into the air preheater per kg of coal fired is %3.0f kg air/kg fuel\"%(A)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex: 4.8 Pg: 218"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)The height of the stack H = 36.44 m \n",
      " (b)The diameter at its base D = 1.06 m \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "#Input data\n",
    "n=6##Total lancashire boilers in a textile factory\n",
    "Ws=6##Each boiler supplying steam in t/h\n",
    "p=16##Pressure at which steam is supplied in bar\n",
    "t=250##Temperature at which steam is supplied in degree centigrade\n",
    "CV=43960##Calorific value of the fuel oil in kJ/kg\n",
    "no=75##Overall efficiency of the boiler in %\n",
    "a=16##The amount of air required for efficient burning of the fuel inkg\n",
    "H=20##Drought of water gauge required at the base of chimney in mm\n",
    "tf=320##The flue gases leave the boiler in degree centigrade\n",
    "ts=300##The average temperature of the gases in the stack in degree centigrade\n",
    "ta=30##The atmospheric temperature in degree centigrade\n",
    "R=0.287##Real Gas constant in kJ/kgK\n",
    "h1=2919.2##enthalpy at the entrance of the boiler in kJ/kgK\n",
    "hf=125.8##Enthalpy at the feed in kJ/kgK\n",
    "pi=3.1412##Mathematical constant\n",
    "g=9.81##gravitational fore constant in m/s**2\n",
    "P=1.013##Atmospheric pressure in bar\n",
    "\n",
    "#Calculations\n",
    "H1=((H*R*(273+ta)*(273+ts)))/(P*100*((273+ts)-(273+ta)))##The draught produced in m\n",
    "Wf=(((Ws*1000)*6*(h1-hf))/((no/100)*CV))/3600##Air fuel ratio in kg/s\n",
    "Wa=a*Wf##Actual air fuel ratio in kg/s\n",
    "Wfg=17*Wf##Air fuel ratio in kg/s\n",
    "D=(((Wfg*R*(273+ts)*(4/pi)))/((101.3)*(2*g*H1)**(1/2)))**(1/2)##Diameter at its base in m\n",
    "\n",
    "#Output\n",
    "print \"(a)The height of the stack H = %3.2f m \\n (b)The diameter at its base D = %3.2f m \"%(H1,D)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex: 4.9 Pg: 219"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The required motor capacity needed for the FD fan is 90.49 kW \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "#Input data\n",
    "Wf=10##Coal rate in t/h\n",
    "C=78##The mass of carbon present in the coal according to coal analysis on mass basis in %\n",
    "H=3##The mass of hydrogen present in the coal according to coal analysis on mass basis in %\n",
    "O=3##The mass of oxygen present in the coal according to coal analysis on mass basis in %\n",
    "S=1##The mass of sulphur present in the coal according to coal analysis on mass basis in %\n",
    "M=7##The mass of moisture present in the coal according to coal analysis on mass basis in %\n",
    "A=8##The mass of ash present in the coal according to coal analysis on mass basis in %\n",
    "E=0.3##Excess air in percentage\n",
    "p=180##Plenum chamber pressure in mm water gauge\n",
    "nm=0.6##Mechanical efficiency of the fan\n",
    "ta=30##Room temperature in degree centigrade\n",
    "R=0.287##Real gas constant\n",
    "P=101.325##Atmospheric pressure in kPa\n",
    "g=9.812##gravitational force constant m/s**2\n",
    "\n",
    "#Calculations\n",
    "Wth=(11.5*(C/100))+(34.5*((H/100)-(O/(8*100))))+(4.3*(S/100))##Theoretical air required per kg fuel in kg air/kg fuel\n",
    "WA=Wth*(1+0.3)##Actual air required per kg fuel in kg air/kg fuel\n",
    "Va=(R*(273+ta))/P##Volume flow rate of air in m**3/kg\n",
    "FD=((WA*Wf*1000*Va*p*g)/(3600*nm))/1000##FD fan motor capacity in kW\n",
    "\n",
    "#Output\n",
    "print \"The required motor capacity needed for the FD fan is %3.2f kW \"%(FD)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex: 4.10 Pg: 220"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The motor capacity of the ID fan is 233.64 kW \n"
     ]
    }
   ],
   "source": [
    "#Input data\n",
    "tg=180##The gas temperature in degree centigrade\n",
    "p=250##The draught produced by the ID fan in mm\n",
    "nf=0.52##The efficiency of the fan\n",
    "Va=0.858##Volume flow rate of air in m**3/kg\n",
    "g=9.812##gravitational force constant in m/s**2\n",
    "Wf=10##Coal rate in t/h\n",
    "Wa=12.9##Actual air required per kg fuel in kg air/kg fuel\n",
    "ta=30##Room temperature in degree centigrade\n",
    "\n",
    "#Calculations\n",
    "Wfg=((Wf+(Wa*10))*1000)/3600##Fuel gas required in kg/s\n",
    "Vfg=(Va*(tg+273))/(ta+273)##Volume flow rate of fuel gas in m**3/kg\n",
    "ID=((Wfg*Vfg*p*g)/(nf))/1000##ID fan motor capacity in kW\n",
    "\n",
    "#Output\n",
    "print \"The motor capacity of the ID fan is %3.2f kW \"%(ID)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex: 4.11 Pg: 220"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)The complete volumetric composition of the dry flue gas is \n",
      " Carbondioxide by volume = 13.20 percentage \n",
      " Oxygen by volume = 3.20 percentage \n",
      " Carbonmonoxide by volume = 4.21 percentage \n",
      " Nitrogen by volume = 79.39 percentage \n",
      " (b) The actual amount of air supplied per kg coal = 12.27 kg \n",
      " (c) Mass of water vapour formed per kg coal = 0.40 kg \n",
      " (d) The dew point temperature of the flue gas = 32.90 degree centigrade \n"
     ]
    }
   ],
   "source": [
    "#Input data\n",
    "CO2=13.2##The volume of carbondioxide present in the partial analysis of dry flue gas in %\n",
    "O2=3.2##The volume of oxygen present in the partial analysis of dry flue gas in %\n",
    "C=88##The mass of carbon present in the coal according to coal analysis on mass basis in %\n",
    "H=4.4##The mass of hydrogen present in the coal according to coal analysis on mass basis in %\n",
    "A=7.6##The mass of ash present in the coal according to coal analysis on mass basis in %\n",
    "M=0##Moisture present in the fuel was nil\n",
    "Mc=12##Molecular weight of the carbon \n",
    "Mh=2##Molecular weight of the hydrogen\n",
    "Mo=32##Molecular weight of the oxygen\n",
    "Mho=18##Molecular weight of water\n",
    "p=101.325##Atmospheric pressure in kPa\n",
    "\n",
    "#Calculations\n",
    "c=C/Mc##Equating coefficients of the carbon from the equation \n",
    "g=H/Mh##Equating coefficients of the hydrogen from the equation \n",
    "x=(CO2/100)/(O2/100)##From dry fuel gas analysis (dfg) \n",
    "d=(((CO2/100)*(47.5))-7.333)/(((CO2/100)*(3.032))-1)##Coefficient of the carbonmonoxide in the equations product side\n",
    "b=c-d##Coefficient of the carbondioxide in the equation product side\n",
    "a=10.21-(0.742*d)##Coefficient of the oxygen in the reactant side of the equation \n",
    "e=b/x##Coefficient of the oxygen in the product side of the equation \n",
    "f=3.76*a##Equating coefficients of the nitrogen from the equation \n",
    "ma=(a*Mo)/0.232##Mass of air supplied for 100 kg coal in kg\n",
    "ma1=ma/100##Mass of air supplied per kg coal in kg\n",
    "T=b+d+e+f##Total number of moles of dry flue gas (dfg)\n",
    "CO21=(b/T)*100##Carbondioxide by volume in percentage\n",
    "O21=(e/T)*100##Oxygen by volume in percentage\n",
    "CO1=(d/T)*100##Carbonmonoxide by volume in percentage\n",
    "N21=(f/T)*100##Nitrogen by volume in percentage\n",
    "Mwv=(g*Mho)/100##Mass of watervapour formed per kg coal in kg\n",
    "Mf=(g)/(b+d+e+f+g)##Mole fraction of water vapour in flue gas\n",
    "P=Mf*p##Partial pressure of water vapour in kPa\n",
    "D=32.9##Dew point temperature from steam tables in degree centigrade\n",
    "\n",
    "#Output\n",
    "print \"(a)The complete volumetric composition of the dry flue gas is \\n Carbondioxide by volume = %3.2f percentage \\n Oxygen by volume = %3.2f percentage \\n Carbonmonoxide by volume = %3.2f percentage \\n Nitrogen by volume = %3.2f percentage \\n (b) The actual amount of air supplied per kg coal = %3.2f kg \\n (c) Mass of water vapour formed per kg coal = %3.2f kg \\n (d) The dew point temperature of the flue gas = %3.2f degree centigrade \"%(CO21,O21,CO1,N21,ma1,Mwv,D)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex: 4.12 Pg: 222"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The height of the gas plume is H = 1842.5 m \n"
     ]
    }
   ],
   "source": [
    "#Input data\n",
    "H=200##Height of the stack in m\n",
    "D=4##Diameter of the stack in m\n",
    "m=1000##Mass flow rate of gas in kg/s\n",
    "Ts=100##Stack exit gas temperature in degree centigrade\n",
    "Ta=5##Ambient air temperature in degree centigrade\n",
    "Vw=50##Wind velocity in Km/h\n",
    "Cp=1.005##Specific heat of the gas in kJ/kgK\n",
    "pi=3.142##Mathematical constant the value of pi\n",
    "\n",
    "#Calculations\n",
    "Vw1=(50*1000)/(60*60)##Wind velocity in m/s\n",
    "Qe=m*Cp*(Ts-Ta)##Heat emission from plume in kW\n",
    "Qe1=Qe/1000##Heat emission from the plume in MW\n",
    "p=(101.325)/(0.287*373)##Density of the gas in kg/m**3\n",
    "A=(pi*D**2)/4##Area of the stack in m**2\n",
    "Vs=m/(p*A)##Stack gas exict velocity in m/s\n",
    "H1=((2.62*(Qe1**(1/2))*1000)/Vw1)-((0.029*Vs*D)/Vw1)##The height of the gas plume in m\n",
    "\n",
    "#Output\n",
    "print \"The height of the gas plume is H = %3.1f m \"%(H1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex: 4.13 Pg: 222"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " (a) The maximum temperature of the cycle T3 = 1168 K \n",
      " (b)Thermal efficiency of the plant = 0.492 or 49.23 percentage\n",
      " (c) Specific fuel consumption = 0.641 kg/kWh \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "#Input data\n",
    "CV=20##Calorific value of the fuel in MJ/kg\n",
    "C=65##The amount of carbon present in the fuel according to gravimetric analysis in %\n",
    "H=25##The amount of hydrogen present in the fuel according to gravimetric analysis in %\n",
    "O=10##The amount of oxygen present in the fuel according to gravimetric analysis in %\n",
    "p1=1##Pressure at the inlet of the compressor in bar\n",
    "t1=27##Temperature at the inlet of the compressor in degree centigrade\n",
    "p2=4##The pressure which compressor compresses it isentropically in bar\n",
    "Re=78##The regenerator effectiveness in %\n",
    "CO2=6##The amount of carbondioxide according to the analysis of dry exhaust gas in %\n",
    "CO=1.5##The amount of carbonmonoxide according to the analysis of dry exhaust gas in %\n",
    "Cp=1.005##Specific heat capacity of the air in kJ/kgK\n",
    "i=1.44##Isentropic index for the air\n",
    "Cp1=1.15##Specific heat capacity of the air in kJ/kgK\n",
    "i1=1.33##Isentropic index for the combustion products\n",
    "Mc=12##Molecular weight of the carbon \n",
    "Mh=2##Molecular weight of the hydrogen\n",
    "Mo=32##Molecular weight of the oxygen\n",
    "Mho=18##Molecular weight of water\n",
    "T0=288##Datum temperature in K (Assumed)\n",
    "\n",
    "#Calculations\n",
    "h=(C/100)/(Mc)##Equating coefficients of the carbon from the equation \n",
    "e=(H/100)/Mh##Equating coefficients of the hydrogen from the equation \n",
    "y=(CO/100)/(CO2/100)##From dry exhaust gas analysis for solving\n",
    "a=h/(1+y)##The coefficient of the carbondioxide in the product side of the equation \n",
    "b=h-a##The coefficient of the carbonmonoxide in the product side of the equation \n",
    "z=b/(CO/100)##The sum of coefficients of the product side of the equation \n",
    "x=z-(b/2)+(e/2)##Mol of air supplied in kmol\n",
    "wa=x*28.96##Air supplied in kg/kg fuel\n",
    "wf=1##Assuming 1 kg of fuel supplied\n",
    "T2=(t1+273)*(p2/p1)**((i-1)/i)##Temperature at the outlet of the compressor in K\n",
    "T3=(((wa*Cp*(T2-T0))+(wf*CV*1000))/((wa+wf)*(Cp1)))+T0##Maximum temperature of the cycle in K\n",
    "T4=T3/((4)**((i1-1)/i1))##Temperature at point of the cycle in K\n",
    "T5=((Re/100)*(T4-T2))+T2##Temperature at point of the cycle in K\n",
    "Wc=wa*Cp*(T2-(t1+273))##Work done by the compressor in kW\n",
    "Wt=23.54*Cp1*(T3-T4)##Work done by the turbine in kW\n",
    "Q1=23.54*Cp1*(T3-T5)##Total work done by the system in kW\n",
    "nc=(Wt-Wc)/Q1##Efficiency of the cycle \n",
    "nc1=nc*100##Efficiency of the cycle in %\n",
    "spc=3600/(Wt-Wc)##Specific fuel consumption in kg/kWh\n",
    "\n",
    "#Output \n",
    "print \" (a) The maximum temperature of the cycle T3 = %3.0f K \\n (b)Thermal efficiency of the plant = %3.3f or %3.2f percentage\\n (c) Specific fuel consumption = %3.3f kg/kWh \"%(T3,nc,nc1,spc)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}