In [1]:

```
import math
#Input data
C = 88.6 #Composition of C in percent
H2 = 11.4 #Composition of H2 in percent
#Calculations
w1 = (C/100) #Weight per kg of fuel of C in kg
w2 = (H2/100) #Weight per kg of fuel of H2 in kg
O1 = (8./3) #Oxygen required per kg of constituent for C in kg
O2 = 8. #Oxygen required per kg of constituent for H2 in kg
O11 = (w1*O1) #Oxygen required per kg of fuel for C in kg
O22 = (w2*O2) #Oxygen required per kg of fuel for H2 in kg
T = (O11+O22) #Total Oxygen required per kg of fuel in kg
P1 = (w1+O11) #Composition of CO2 in kg
P2 = (w2+O22) #Composition of H2O in kg
w = (T*(100./23)) #Weight of air required in kg per kg of fuel
#Output
print 'The weight of air required for complete combustion of liquid fuel is %3.2f kg per kg of fuel \
\nThe composition of CO2 is %3.3f kg \
\nThe composition of H2O is %3.3f kg'%(w,P1,P2)
```

In [2]:

```
import math
#Input data
C = 12. #Molecular weight of carbon
H2 = 2. #Molecular weght of H2
O2 = 32. #Molecular weight of O2
#Calculations
C7H16 = (7*C+8*H2) #Molecular weight of C7H16
O2x = (11*O2) #Molecular weight of 22O2
wt = (O2x/C7H16)*(100/23.2) #Weight of air in kg per kg of fuel
#Now in actual experiment, we have
#1[C7H16] +x[O2] +...[N2] = a[CO2] +8[H2O] +a[O2] +...[N2]
#This is the new equation written in volumes. The volumes of CO2 and O2 being equal, with no CO present, and the usual assumption that all the hydrogen is burnt to H2O
#Now, if all the carbon is burnt, we must have 7 mols of CO2
x = (7+4+7) #Total number of mols from CO2,H2O and O2 terms respectively
W = ((x*O2)/100)*(100/23.2) #Weight of air in kg per kg of fuel
#Output
print 'The weight of air is %3.1f kg per kg of fuel which would just suffice for theoretically complete combustion \
\nThe ratio of air to fuel by weight as actually supplied is %3.1f kg of air per kg of fuel'%(wt,W)
```

In [3]:

```
import math
#Input data
H = 15. #Percentage of Hydrogen by volume
CO = 25. #Percentage of carbon monoxide by volume
CH4 = 4. #Percentage of methane by volume
CO2 = 4. #Percentage of carbon dioxide by volume
O2 = 2. #Percentage of oxygen by volume. In textbook it is given wrong as 25
N2 = 50. #Percentage of nitrogen by volume
#Calculations
O21 = (H/100)*(1./2) #Volume of oxygen required in m**3 by 15 percent of H2
O22 = (CO/100)*(1./2) #Volume of oxygen required in m**3 by 25 percent of CO
CO21 = (CO/100)*1 #Volume of CO2 produced in m**3 by 25 percent of CO
O23 = (CH4/100)*2 #Volume of oxygen required in m**3 by 4 percent of CH4
CO22 = (CH4/100)*1 #Volume of CO2 produced in m**3 by 4 percent of CH4
H201 = (CO/100)*2 #Volume of H2O produced in m**3 by 4 percent of CH4
TO2 = (O21+O22+O23-(O2/100)) #Total vol. of oxygen in m**3
wa = (TO2*(100./21)) #Theoretical volume of air required in m**3
vN2 = (wa*(79./100)) #Volume of N2 present in air in m**3
TvN2 = (vN2+(N2/100)) #Total volume of N2 after combustion of 1 m**3 of fuel in m**3
xCO2 = (CO21+CO22) #CO2 produced due to combustion of fuel in m**3
TCO2 = (xCO2+(CO2/100)) #Total volume of CO2 in the flue gas in m**3
#Output
print 'The air required for complete combustion of one m**3 of the fuel is %3.3f cu.m \
\nThe dry flue gas contains %3.3f cu.m volume of N2 and %3.2f cu.m volume of CO2'%(wa,TvN2,TCO2)
```

In [4]:

```
import math
#Input data
C = 88.1 #Composition of C in percent
H2 = 10.7 #Composition of H2 in percent
O2 = 1.2 #Composition of O2 in percent
#Calculations
w1 = (C/100) #Weight per kg of fuel of C in kg
w2 = (H2/100) #Weight per kg of fuel of H2 in kg
w3 = (O2/100) #Weight per kg of fuel of O2 in kg
O1 = (8/3) #Oxygen required per kg of constituent for C in kg
O2 = 8 #Oxygen required per kg of constituent for H2 in kg
O11 = (w1*O1) #Oxygen required per kg of fuel for C in kg
O22 = (w2*O2) #Oxygen required per kg of fuel for H2 in kg
T = (O11+O22-w3) #Total Oxygen required per kg of fuel in kg
P1 = (w1+O11) #Composition of CO2 in kg
P2 = (w2+O22) #Composition of H2O in kg
w = (T*(100/23)) #Weight of air required in kg per kg of fuel
wN2 = (w*(77/100)) #Weight of N2 in 'w' kg of fuel in kg
T1 = (P1+P2+wN2) #Total weight of all products of combustion in kg
pCO2 = (P1/T1)*100 #Percentage composition of CO2 by weight
pH2O = (P2/T1)*100 #Percentage composition of H2O by weight
pN2 = (wN2/T1)*100 #Percentage composition of N2 by weight
#Output
print 'The weight of air required to burn one kg of the fuel is %3.1f kg \
\nThe composition of products of combustion by weight is %3.2f percent of CO2, %3.2f percent of H2O and %3.2f percent of N2'%(w,pCO2,pH2O,pN2)
```

In [5]:

```
import math
#Input data
C = 85. #Composition of C in percent
H2 = 15. #Composition of H2 in percent
CV = 10600. #Calorific value in kcal/kg
eO2 = 60. #Percentage of air in excess
bhp = 240. #Brake horse power in h.p
nth = 30. #Thermal efficiency in percent
O2 = 23. #Percentage of oxygen contained in air by weight
wC = 12. #Molecular weight of carbon
wH2 = 2. #Molecular weght of H2
wO2 = 32. #Molecular weight of O2
#Calculations
mma = (100./23)*(((C/100)*(wO2/wC))+((H2/100)*(wO2/(wH2*2)))) #Minimum air in kg per kg oil
aa = ((100+eO2)/100)*mma #Actual air supplied in kg per kg oil
q = ((bhp*(4500./427))/(nth/100)) #Heat supplied in kcal/min
mf = (q/CV) #Mass of fuel supplied in kg/min
ma = (aa*mf) #Mass of air supplied in kg/min
#Output
print 'The weight of air is %3.2f kg/min'%(ma)
```

In [6]:

```
import math
#Input data
#C + O2 -> CO2
# 12 + 32 -> 44
C = 12. #Molecular weight of carbon
O2 = 32. #Molecular weight of O2
CO2 = 44. #Molecular weight of CO2
N2 = 28. #Molecular weight of N2
#Calculations
wair = (O2/C)*(100./23) #Air required per kg of C in kg
wN2 = (O2/C)*(77./23) #N2 associated with the air in kg
pCO2 = (CO2/C)/CO2 #Parts by volume/k for CO2
pN2 = (wN2/N2) #Parts by volume/k for N2
Tv = (pCO2+pN2) #Total parts by volume
ppCO2 = (pCO2/Tv)*100 #Percentage volume of CO2
ppN2 = (pN2/Tv)*100 #Percentage volume of N2
#Output
print 'The volumetric analysis of the flue gas when pure carbon is burnt with \
a minimum quantity of air is given by CO2 -> %3.1f percent N2 -> %3.1f percent'%(ppCO2,ppN2)
```

In [7]:

```
import math
#Input data
C = 90. #Percentage composition of C
H2 = 3.3 #Percentage composition of H2
O2 = 3 #Percentage composition of O2
N2 = 0.8 #Percentage composition of N2
S = 0.9 #Percentage composition of S
Ash = 2. #Percentage composition of Ash
eO2 = 50. #Percentage of excess air
mC = 12. #Molecular weight of carbon
mS = 32. #Molecular weight of sulphur
mCO2 = 44. #Molecular weight of CO2
mO2 = 32. #Molecular weight of O2
mSO2 = 64. #Molecular weight of SO2
mN2 = 28. #Molecular weight of N2
#Calculations
w1 = (C/100) #Weight per kg of fuel of C in kg
w2 = (H2/100) #Weight per kg of fuel of H2 in kg
w3 = (S/100) #Weight per kg of fuel of S in kg
O1 = (8./3) #Oxygen required per kg of constituent for C in kg
O2 = 8. #Oxygen required per kg of constituent for H2 in kg
O3 = 1. #Oxygen requred per kg of constituent for S in kg
O11 = (w1*O1) #Oxygen required per kg of fuel for C in kg
O22 = (w2*O2) #Oxygen required per kg of fuel for H2 in kg
O33 = (w3*O3) #Oxygen required per kg of fuel for S in kg
T = (O11+O22+O33-(O2/100)) #Total Oxygen required per kg of fuel in kg
ma = (T*(100./23)) #Minimum air required in kg
aN2 = (ma*((100+eO2)/100)*(77/100)) #N2 in actual air supply in kg
TN2 = (aN2+(N2/100)) #Total N2 in kg
wt = (ma*(eO2/100)*(23./100)) #Weight of air due to excess O2 in kg
TSO2 = (w3*(mSO2/mS)) #Total SO2 in kg
TCO2 = (w1*(mCO2/mC)) #Total CO2 in kg
pCO2 = (TCO2/mCO2) #Parts by volume of CO2
pSO2 = (TSO2/mSO2) #Parts by volume of SO2
pO2 = (wt/mO2) #Parts by volume of O2
pN2 = (TN2/mN2) #Parts by volume of N2
Tv = (pCO2+pSO2+pN2+pO2) #Total parts by volume
ppCO2 = (pCO2/Tv)*100 #Percentage volume of CO2
ppSO2 = (pSO2/Tv)*100 #Percenatge volume of SO2
ppO2 = (pO2/Tv)*100 #Percentage volume of O2
ppN2 = (pN2/Tv)*100 #Percentage volume of N2
#Output
print 'Percentage combustion of the dry flue gases by volume is CO2 %3.2f percent SO2 %3.2f percent O2 %3.1f percent N2 %3.2f percent'%(ppCO2,ppSO2,ppO2,ppN2)
```

In [8]:

```
import math
#Input data
C = 85. #Composition of C in percent
H2 = 12.3 #Composition of H2 in percent
i = 2.7 #Incombustible residue composition in percent
ma = 25. #Mass of air supplied in kg of air per kg of fuel
pO2 = 23. #Percentage of oxygen in gemetric analysis of air
pN2 = 77. #Percentage of nitrogen in gemetric analysis of air
p = 1.03 #Total pressure of the exhaust gases in kg/cm**2
mC = 12. #Molecular weight of carbon
mO2 = 32. #Molecular weight of O2
mCO2 = 44. #Molecular weight of CO2
mH2 = 2. #Molecular weght of H2
mH2O = 18. #Molecular weight of H2O
mN2 = 28. #Molecular weight of N2
#Calculations
xCO2 = ((C/100)*(mCO2/mC)) #per kg of fuel, the products formed in kg
xH2O = ((H2/100)*((2*mH2O)/(2*mH2))) #per kg of fuel, the products formed in kg
xO2 = (((C/100)*(mO2/mC))+((H2/100)*(mO2/(2*mH2)))) #Oxygen used in kg
xN2 = (pN2/pO2)*xO2 #Associated nitrogen in kg
mma = (xO2+xN2) #Minimum air required in kg
ea = (ma-mma) #Excess air supplied in kg
XO2 = ((pO2/100)*ea) #Mass of O2 in excess air in kg
XN2 = ((pN2/100)*ea) #Mass of N2 in excess air in kg
wCO2 = xCO2/mCO2 #Parts by volume for CO2
wO2 = XO2/mO2 #Parts by volume for O2
wN2 = ((XN2+xN2)/mN2) #Parts by volume for N2
wH2O = (xH2O/mH2O) #Parts by volume for H2)
Tv = (wCO2+wO2+wN2+wH2O) #Total parts by volume
ppCO2 = (wCO2/Tv)*100 #Percentage volume of CO2
ppO2 = (wO2/Tv)*100 #Percentage volume of O2
ppN2 = (wN2/Tv)*100 #Percentage volume of N2
ppH2O = (wH2O/Tv)*100 #Percenatage volume of H2O
Tv1 = (wCO2+wO2+wN2) #Total parts by volume for dry products
pp1CO2 = (wCO2/Tv1)*100 #Percentage volume of CO2 for dry analysis
pp1O2 = (wO2/Tv1)*100 #Percentage volume of O2 for dry analysis
pp1N2 = (wN2/Tv1)*100 #Percentage volume of N2 for dry analysis
papH2O = (ppH2O/100)*p #Partial pressure of H2O in kg/cm**2
#Output
print 'The volumetric analysis for wet products gives in percent CO2 -> %3.1f O2 -> %3.1f N2 -> %3.1f H2O -> %3.1f \
\nThe volumetric analysis for dry products gives in percent CO2 -> %3.1f O2 -> %3.1f N2 -> %3.1f \
\nThe partial pressure of the vapour is %3.4f kg/cm**2'%(ppCO2,ppO2,ppN2,ppH2O,pp1CO2,pp1O2,pp1N2,papH2O)
```

In [9]:

```
import math
#Input data
CO2 = 15. #Volumetric analysis composition in percent
CO = 2.2 #Volumetric analysis composition in percent
O2 = 1.6 #Volumetric analysis composition in percent
N2 = 81.2 #Volumetric analysis composition in percent
mO2 = 32. #Molecular weight of O2
mCO2 = 44. #Molecular weight of CO2
mCO = 28. #Molecular weight of CO2
mN2 = 28. #Molecular weight of N2
#Calculations
pCO2 = (CO2/100)*mCO2 #Proportional weight for CO2
pCO = (CO/100)*mCO #Proportional weight for CO
pO2 = (O2/100)*mO2 #Proportional weight for O2
pN2 = (N2/100)*mN2 #Proportional weight for N2
T = (pCO2+pCO+pO2+pN2) #Total proportional weight
ppCO2 = (pCO2/T)*100 #Weight per kg of exhaust gas for CO2
ppCO = (pCO/T)*100 #Weight per kg of exhaust gas for CO
ppO2 = (pO2/T)*100 #Weight per kg of exhaust gas for O2
ppN2 = (pN2/T)*100 #Weight per kg of exhaust gas for N2
print 'The analysis by weight is given by in percent CO2 -> %3.1f CO -> %3.1f O2 -> %3.1f N2 -> %3.1f'%(ppCO2,ppCO,ppO2,ppN2)
```

In [10]:

```
import math
# variables
CO2 = 10.9 #Volumetric analysis composition in percent
CO = 1. #Volumetric analysis composition in percent
O2 = 7.1 #Volumetric analysis composition in percent
N2 = 81. #Volumetric analysis composition in percent
mO2 = 32. #Molecular weight of O2
mCO2 = 44. #Molecular weight of CO2
mCO = 28. #Molecular weight of CO
mN2 = 28. #Molecular weight of N2
#Calculations
pCO2 = (CO2/100)*mCO2 #Proportional weight for CO2
pCO = (CO/100)*mCO #Proportional weight for CO
pO2 = (O2/100)*mO2 #Proportional weight for O2
pN2 = (N2/100)*mN2 #Proportional weight for N2
T = (pCO2+pCO+pO2+pN2) #Total proportional weight
ppCO2 = (pCO2/T)*100 #Weight per kg of exhaust gas for CO2
ppCO = (pCO/T)*100 #Weight per kg of exhaust gas for CO
ppO2 = (pO2/T)*100 #Weight per kg of exhaust gas for O2
ppN2 = (pN2/T)*100 #Weight per kg of exhaust gas for N2
print 'The gravimetric analysis is given by in percent CO2 -> %3.2f CO -> %3.2f O2 -> %3.2f N2 -> %3.2f'%(ppCO2,ppCO,ppO2,ppN2)
```

In [11]:

```
import math
#Input data
CO2 = 10. #Volumetric analysis composition in percent
N2 = 80. #Volumetric analysis composition in percent
C = 80. #Carbon content of the fuel in percent
mO2 = 32. #Molecular weight of O2
mCO2 = 44. #Molecular weight of CO2
mN2 = 28. #Molecular weight of N2
mC = 12. #Molecular weight of carbon
#Calculations
O2 = 100-(N2+CO2) #Volumetric analysis composition in percent
pCO2 = (CO2/100)*mCO2 #Proportional weight for CO2
pO2 = (O2/100)*mO2 #Proportional weight for O2
pN2 = (N2/100)*mN2 #Proportional weight for N2
T = (pCO2+pO2+pN2) #Total proportional weight
ppCO2 = (pCO2/T) #Weight per kg of exhaust gas for CO2
ppO2 = (pO2/T) #Weight per kg of exhaust gas for O2
ppN2 = (pN2/T) #Weight per kg of exhaust gas for N2
wC = (ppCO2*(mC/mCO2)) #Weight of carbon per kg of exhaust gases in kg
WC = ((C/100)/wC) #Weight of exhaust gases per kg of fuel burned in kg
wa = (WC-(ppCO2+ppO2+ppN2)) #Weight of air supplied per kg fuel in kg
#Output
print 'Weight of air supplied per kg of fuel is %i kg'%(wa)
```

In [12]:

```
import math
#Input data
CO2 = 12. #Volumetric analysis composition in percent
CO = 4. #Volumetric analysis composition in percent
N2 = 84. #Volumetric analysis composition in percent
mO2 = 32. #Molecular weight of O2
mCO2 = 44. #Molecular weight of CO2
mCO = 28. #Molecular weight of CO
mN2 = 28. #Molecular weight of N2
mC = 12. #Molecular weight of carbon
mH2 = 2. #Molecular weight of H2
#Calculations
pCO2 = (CO2/100)*mCO2 #Proportional weight for CO2
pCO = (CO/100)*mCO #Proportional weight for CO
pN2 = (N2/100)*mN2 #Proportional weight for N2
T = (pCO2+pCO+pN2) #Total proportional weight
ppCO2 = (pCO2/T) #Weight per kg of exhaust gas for CO2
ppCO = (pCO/T) #Weight per kg of exhaust gas for CO
ppN2 = (pN2/T) #Weight per kg of exhaust gas for N2
wC = ((ppCO2*(mC/mCO2))+(ppCO*(mC/mCO))) #Weight of carbon per kg of flue gases
pC = ((6*mC)/(6*mC+7*mH2)) #Percentage by weight of carbon in C6H14
we = (pC/wC) #Weight of exhaust gases per kg of fuel in kg
wa = (we-(ppCO2+ppCO+ppN2)) #Weight of air supplied per kg of fuel in kg
tw = ((100./23)*(((mO2/mC)*pC)+((mO2/(2*mH2))*0.163))) #Theoretical amount of air required for complete combustion of C6H14 in kg
exc = (wa-tw) #Excess air supplied per kg of fuel in kg
#Output
print 'Excess air supplied per kg of fuel is %3.1f kgdeficient)'%(exc)
```

In [13]:

```
import math
#Input data
C = 84. #Gravimetric analysis composition in percent
H2 = 12. #Gravimetric analysis composition in percent
S = 1.5 #Gravimetric analysis composition in percent
O2 = 1.5 #Gravimetric analysis composition in percent
ma = 20. #Mass of air in kg
pC = 4. #Percent of carbon in the fuel which is burnt to form CO
mO2 = 32. #Molecular weight of O2
mCO2 = 44. #Molecular weight of CO2
mCO = 28. #Molecular weight of CO
mN2 = 28. #Molecular weight of N2
mC = 12. #Molecular weight of carbon
mH2 = 2. #Molecular weight of H2
mS = 32. #Molecular weight of S
mSO2 = 64. #Molecular weight of SO2
#Calculations
mm = ((100./23)*((C/100)*(mO2/mC)+(H2/100)*(mO2/(2*mH2))+(S/100)*(mO2/mS)-(O2/100))) #Minimum air in kg/kg of fuel
#When 20 kg of air is supplied
xCO2 = ((C/100)*(mCO2/mC)) #Mass of CO2 in kg
xSO2 = ((S/100)*(mSO2/mS)) #Mass of SO2 in kg
xO2 = ((23/100)*(ma-mm)) #Mass of O2 in kg
xN2 = ((77/100)*ma) #Mass of N2 in kg
nCO2 = (xCO2/mCO2) #Parts by volume of CO2
nSO2 = (xSO2/mSO2) #Parts by volume of SO2
nO2 = (xO2/mO2) #Parts by volume of O2
nN2 = (xN2/mN2) #Parts by volume of N2
T = (nCO2+nSO2+nO2+nN2) #Total parts by volume
pCO2 = (nCO2/T)*100 #Percentage volume of CO2
pSO2 = (nSO2/T)*100 #Percentage volume of SO2
pO2 = (nO2/T)*100 #Percentage volume of O2
pN2 = (nN2/T)*100 #Percentage volume of N2
#4% of available carbon is burnt to CO then per kg of fuel
yCO2 = ((C/100)/(1+(pC/100)))*(mCO2/mC) #Mass of CO2 in kg
yCO = (((C/100)-((C/100)/(1+(pC/100))))*(mCO/mC)) #Mass of CO in kg
yO2 = ((C/100)*(mO2/mC)) #Mass of O2 in kg
eO2 = (yO2-(((C/100)/(1+(pC/100)))*(mO2/mC)+(((C/100)-((C/100)/(1+(pC/100))))*(mO2/(2*mC)))))
nnCO2 = (yCO2/mCO2) #Parts by volume of CO2
nnCO = (yCO/mCO) #Parts by volume of CO
nnSO2 = (xSO2/mSO2) #Parts by volume of SO2
nnO2 = ((xO2+eO2)/mO2) #Parts by volume of O2
nnN2 = (xN2/mN2) #Parts by volume of N2
TT = (nnCO2+nnCO+nnSO2+nnO2+nnN2) #Total parts by volume
ppCO2 = (nnCO2/TT)*100 #Percentage volume of CO2
#Output
print 'Minimum weight of air required for complete combustion of 1 kg of the fuel is %3.1f kg/kg of fuel \
\nPercentage composition by volume when %i kg of air is supplied in percent) CO2 -> %3.1f SO2 -> %3.1f O2 -> %3.1f N2 -> %3.1f \
\nThe percentage volume of CO2 when %i percent of the carbon in the fuel is burnt to form CO is %3.1f percent'%(mm,ma,pCO2,pSO2,pO2,pN2,pC,ppCO2)
```

In [14]:

```
import math
#Input data
C = 85. #Composition by weight in percent
H2 = 14. #Composition by weight in percent
x = 50. #Percentage of excess air
Ta = [70.+273,500+273] #Temperature of air entering and leaving in K
Cp = 0.24 #Mean specific heat of air in kJ/kg.K
qC = 8080. #Heat liberated in kcal/kg
qH2 = 34250. #Heat liberated in kcal/kg
a = 23. #Air contains 23% by weight of O2
mO2 = 32. #Molecular weight of O2
mCO2 = 44. #Molecular weight of CO2
mCO = 28. #Molecular weight of CO
mN2 = 28. #Molecular weight of N2
mC = 12. #Molecular weight of carbon
mH2 = 2. #Molecular weight of H2
#Calculations
mm = ((100/a)*((C/100)*(mO2/mC)+(H2/100)*(mO2/(2*mH2)))) #Minimum air required in kg/kg of fuel
Q1 = ((C/100)*qC+(H2/100)*qH2) #Heat in kcal/kg fuel
ea = ((x/100)*mm) #Excess air supplied in kg/kg fuel
Q2 = ((mm/2)*Cp*(Ta[1]-Ta[0])) #Heat in kcal/kg fuel
#Output
print 'a) Minimum quantity of air necessary for the complete combustion of 1 kg of fuel is %3.2f kg/kg of fuel \
\nb) Heat released per kg of fuel when the carbon is burnt to CO2 and hydrogen is burnt to H2O is %3.0f kcal/kg fuel \
\nc) Heat carried away by the excess air is %3.0f kcal/kg fuel'%(mm,Q1,Q2)
```

In [15]:

```
import math
#Input data
CO = 17. #Percentage composition by volume
H2 = 53.4 #Percentage composition by volume
CH2 = 28.8 #Percentage composition by volume
O2 = 0.8 #Percentage composition by volume
ea = 30. #Percentage of excess air
v = 1. #Volume in m**3
#Calculations
ta = ((100./21)*((CO/100)/2+(H2/100)/2+(CH2/100)*2-(O2/100))) #Theoretical air in m**3/m**3 of gas
aa = ((1+(ea/100))*ta) #Actual air in m**3/m**3 of gas
Vg = (v+aa) #Volume of gas air mixture in m**3/m**3 of gas
#Output
print 'Total quantity of air required is %3.2f m**3/m**3 of gas \
\nThe volume of gas air mixture is %3.2f m**3/m**3 of gas'%(ta,Vg)
```

In [16]:

```
import math
#Input data
CH4 = 20. #Percentage volumetric analysis
C2H4 = 2. #Percentage volumetric analysis
H2 = 50. #Percentage volumetric analysis
CO = 16. #Percentage volumetric analysis
CO2 = 4. #Percentage volumetric analysis
O2 = 1.5 #Percentage volumetric analysis
N2 = 6.5 #Percentage volumetric analysis
v = 6.8 #Volume of air supplied in m**3 per m**3 of coal gas
#Calculations
mmO2 = ((2*CH4)+(3*C2H4)+(H2/2)+(CO/2))-O2 #Minimum moles of O2
mCO2 = (CH4+(2*C2H4)+CO+CO2) #Moles of CO2
mH2O = ((2*CH4)+(2*C2H4)+H2) #Moles of H2O
mN2 = (N2+(79./21)*mmO2) #Moles of N2
ma = ((100./21)*(mmO2/100)) #Minimum air in m**3/m**3 of gas
ea = (v-ma) #Excess air in m**3/m**3 of gas
tm = (mCO2+mN2+ea)*2 #Total moles of dry products per 100 moles of gas
pCO2 = (mCO2/tm)*100 #Percentage of CO2 by volume in dry flue gases
#Output
print 'Minimum volume of air necessary for the complete combustion of 1 m**3 of coal gas is %3.2f m**3/m**3 of gas \
\nPercentage volume of CO2 in dry flue gases is %3.2f percent'%(ma,pCO2)
```

In [17]:

```
import math
#Input data
C = 86. #Percentage of carbon
H2 = 14. #Percentage of Hydrogen
ea = 20. #Percentage of excess air
O2 = 23. #Weight of oxygen in air in percent
mO2 = 32. #Molecular weight of O2
mCO2 = 44. #Molecular weight of CO2
mCO = 28. #Molecular weight of CO
mN2 = 28. #Molecular weight of N2
mC = 12. #Molecular weight of carbon
mH2 = 2. #Molecular weight of H2
mH2O = 18. #Molecular weight of H2O
#Calculations
ma = ((100/O2)*((C/100)*(mO2/mC)+(H2/100)*(mO2/(2*mH2)))) #Minimum weight of air required in kg/kg petrol
#Products of combustion by weight per kg- petrol
XCO2 = (C/100)*(mCO2/mC) #CO2 in kg
XH2O = (H2/100)*(mH2O/mH2) #H2O in kg
XO2 = (XCO2+XH2O-1)*(ea/100) #O2 in kg
XN2 = (ma*(1+(ea/100))*((100-O2)/100)) #N2 in kg
XT = (XCO2+XH2O+XO2+XN2) #Total weight in kg
#Percentage analysis by weight
xCO2 = (XCO2/XT)*100 #CO2
xH2O = (XH2O/XT)*100 #H2O
xO2 = (XO2/XT)*100 #O2
xN2 = (XN2/XT)*100 #N2
#Percentage by weight to molecular weight
xxCO2 = (xCO2/mCO2) #CO2
xxH2O = (xH2O/mH2O) #H2O
xxO2 = (xO2/mO2) #O2
xxN2 = (xN2/mN2) #N2
xxt = (xxCO2+xxH2O+xxO2+xxN2) #Total percentage by weight to molecular weight
#Percentage by volume
pCO2 = (xxCO2/xxt)*100 #CO2
pH2O = (xxH2O/xxt)*100 #H2O
pO2 = (xxO2/xxt)*100 #O2
pN2 = (xxN2/xxt)*100 #N2
#Output
print 'Volumetric composition of the products of combustion in percent) CO2 -> %3.1f H2O -> %3.1f O2 -> %3.2f N2 -> %3.2f'%(pCO2,pH2O,pO2,pN2)
```

In [18]:

```
import math
#Input data
bhp = 20. #Brake horse in h.p
N = 320. #Speed in r.p.m
C = 84. #Percentage of carbon
H2 = 16. #Percentage of hydrogen
CV = 10800. #Calorific value in kcal/kg
bth = 30. #Brake thermal efficiency in percent
mO2 = 32. #Molecular weight of O2
mCO2 = 44. #Molecular weight of CO2
mCO = 28. #Molecular weight of CO
mN2 = 28. #Molecular weight of N2
mC = 12. #Molecular weight of carbon
mH2 = 2. #Molecular weight of H2
mH2O = 18. #Molecular weight of H2O
#Calculations
W = (bhp*4500)/427 #Work done in kcal
Wc = (W*2)/N #Work done per cycle in kcal
qs = (Wc/(bth/100)) #Heat supplied per cycle in kcal
wf = (qs/CV) #Weight of fuel used per cycle in kg
tO2 = ((C/100)*(mO2/mC)+(H2/100)*(mO2/(2*mH2))) #Total O2/kg fuel in kg
mw = (tO2/(23./100)) #Minimum weight of air required in kg/kg fuel
aw = (mw*2) #Actual weight of air supplied in kg/kg fuel
wac = (aw*wf) #Wt. of air supplied/ cycle in kg. In textbook, it is given wrong as 0.1245 kg
#Output
print 'a) the weight of fuel used per cycle is %3.6f kg \
\nb) the actual weight of air taken in per cycle is %3.4f kg'%(wf,wac)
```

In [21]:

```
import math
#Input data
CO2 = 8.85 #Percentage composition by volume
CO = 1.2 #Percentage composition by volume
O2 = 6.8 #Percentage composition by volume
N2 = 83.15 #Percentage composition by volume
C = 84. #Percentage composition by weight
H2 = 14. #Percentage composition by weight
aO2 = 2. #Percentage composition by weight
mO2 = 32. #Molecular weight of O2
mCO2 = 44. #Molecular weight of CO2
mCO = 28. #Molecular weight of CO
mN2 = 28. #Molecular weight of N2
mC = 12. #Molecular weight of carbon
mH2 = 2. #Molecular weight of H2
mH2O = 18. #Molecular weight of H2O
#Calculations
#O2 required per kg of fuel
xC = ((C/100)*(mO2/mC)) #C
xH2 = ((H2/100)*(mO2/(2*mH2))) #H2
xO2 = -(aO2/100) #O2
ttO2 = (xC+xH2-xO2) #Theoretical total oxygen required in kg/kg fuel
twa = (ttO2/(23./100)) #Theoretical weight of air in kg/kg fuel
#Conversion of volumetric analysis of the flue gas into a weight analysis
#Percenatge by volume * mol. wt
xxCO2 = (CO2*mCO2) #CO2
xxCO = (CO*mCO) #CO
xxO2 = (O2*mO2) #O2
xxN2 = (N2*mN2) #N2
xxt = (xxCO2+xxCO+xxO2+xxN2) #Total
#Percentage by weight
yCO2 = (xxCO2/xxt)*100 #CO2
yCO = (xxCO/xxt)*100 #CO
yO2 = (xxO2/xxt)*100 #O2
yN2 = (xxN2/xxt)*100 #N2
wcd = ((yCO2/100)*(mC/mCO2))+((yCO/100)*(mC/mCO)) #Weight of carbon/ kg of dry flue gas in kg
wdf = ((C/100)/wcd) #Wt. of dry flue gas/kg fuel in kg
wxf = (wdf*(yO2/100)) #Weight of excess O2/kg fuel in kg
weO2 = (wxf/(23./100)) #Weight of excess air in kg/kg fuel
was = (twa+weO2) #Weight of air supplied/kg fuel in kg
#Output
print 'Weight of air supplied per kg fuel burnt is %3.2f kg'%(was)
```