In [1]:

```
#Variable declaration
# From the Table 14.1
del_hfHCL=92307; # Enthalpy of Heat in kJ/kmol
del_hfH2O=-241818; # Enthalpy of Heat kJ/kmol
#Calculation
del_Ho=4*del_hfHCL-2*del_hfH2O; # The standard heat of reaction from enthalpy equation
#Result
print "The standard heat of reaction for the process = ",del_Ho,"kJ (answer mentioned in the textbook is wrong)"
```

In [2]:

```
#Variable declaration
del_Ho=5640000; # Heat released during the process
# From the Table 14.1
del_hfO2=-393509; del_hfH2O=-285830; # Enthalpy of Heat in kJ/kmol
#Calculation
del_hfsucrose=12*del_hfO2+11*del_hfH2O+del_Ho; # The enthalpy formation of sucrose
#Result
print "The enthalpy formation of sucrose = ",del_hfsucrose,"kJ/kmol (answer mentioned in the textbook is wrong)"
```

In [3]:

```
#Variable declaration
# (a).Balancing of chemical equation
# The unbalanced equation for the process is C8H18 + O2 + N2 → CO2 + H2O + N2
x=8; # Carbon balance
y=9; # Hydrogen balance
z=12.5; # Oxygen balance in reverse order
n=z*3.76; # Nitrogen Balance
#Result for (a)
print "(a).Balancing of chemical equation"
print " C8H18 + z O2 + n N2 → x CO2 + y H2O + n1 N2 \n "
print " z =",z,"\n n =",n,"\n x =",x,"\n y =",y,"\n n1 =",5*n
#Calculation for (b)
# (b).The theoretical air-fuel ratio
a=1; # Mole of C8H18
AF1=(z+n)/a; #The theoretical air-fuel ratio on mole basis
ma=28.84; # Molecular mass of air
mc=114; # Molecular mass of C8H18
AF2=(AF1*ma)/(a*mc); # The theoretical air-fuel ratio on mass basis
#Result for (b)
print "\n(b).The theoretical air-fuel ratio","\nThe theoretical air-fuel ratio on mole basis = ",AF1,"kmol air / kmol C8H18"
print "The theoretical air-fuel ratio on mass basis = ",round(AF2,0),"kg air / kmol C8H18"
```

In [4]:

```
import numpy as np
#Variable declaration
# The combustion equation for C4H10 with 80% theoretical air is C4H10 +5.2(O2 + 3.76 N2) → a(1)CO + a(2)CO2 + 5H2O + 19.55N2
# The following matrix shows the balance of C and O
#Calculation
A = np.array([(1, 1),(1,2)])
B = np.array([4,5.4])
m = np.linalg.solve(A,B)
#Result
print "The equation for the combustion of butane with 80% theoretical air is "
print "\nC4H10 +5.2(O2 + 3.76 N2) →", m.item(0), "CO + ",m.item(1), "CO2 + 5H2O + 19.55N2"
```

In [5]:

```
#Variable declaration
p=101.325; # Atmospheric pressure in kPa
# The complete combustion equation for actane
# yC8H18+ x (O2+3.76N2) → n1 CO2+n2 H2O+n3 O2+n3 N2
x=12.5*1.5; y=1;
n1=8; n2=9; n3=6.28; n4=70.5;
#calculation
n=n1+n2+n3+n4; # Total number of moles of the products
AFm=(x+x*3.76)/y ;# Air fuel ratio
m=28.84;
M=116; # Molecular weight of octane
AF=AFm*m/M;
yco2=n1/n; yH2O=n2/n; yO2=n3/n; yN2=n4/n;
pH2O=p*yH2O; # Partial pressure of water vapour in the products
Tsat=45.21; # In oC
#Result
print "Air fuel ratio = ",round(AF,2),"kg air/kg octane"
print "Dew point temperature = ",Tsat,"oC"
print "\nIf the products are cooled below 25 oC then, the water vapour will condense."
print "Because the cooled temperature is less than dew point temperature of water vapour i.e., T < Tsat."
```

In [6]:

```
#Variable declaration
# The complete chemical equation is
#[0.14H2+0.03CH4+0.27CO+0.045CO2+0.01O2+0.505N2]+0.255(O2+3.75N2) →0.2H2O+0.345CO2+1.44N2
a=0.14; # Composition of H2 in air
b=0.03; # Composition of CH4 in air
c=0.27; # Composition of CO in air
d=0.045; # Composition of CO2 in air
e=0.01; # Composition of O2 in air
f=0.505; # Composition of N2 in air
g=(0.265-0.01); # O2 requirement from atmospheric air with 1% O2 already in fuel
h=3.76; # By nitrogen balance
i=1; # mole of the air
#Calculation
#Air fuel ratio on mol (volume) basis
AFvol=(g+(g*h))/i; # Air fuel ratio (theroretical)
AFv=1.1*AFvol; # Air fuel ratio on mol (volume) basis
#Air fuel ratio on mass basis
M1=2; # Molecular mass of H2
M2=16; # Molecular mass of CH4
M3=28; # Molecular mass of CO
M4=44; # Molecular mass of CO2
M5=32; # Molecular mass of O2
M=a*M1+b*M2+c*M3+d*M4+e*M5+f*M3; # Molecular mass of Fuel
Ma=28.84; # Molecular mass of air
AFm=AFv*Ma/(i*M); # Air fuel ratio on mass basis
#Results
print "Air fuel ratio on mol (volume) basis =",round(AFv,3),"kmol actual air/kmol fuel"
print "\nAir fuel ratio on mass basis = ",round(AFm,2),"kg air / kg fuel"
```

In [7]:

```
#Variable declaration
#From table 14.2 at 25 oC and 1 atm for C8H8
del_Ho=-2039.7; # LHV in MJ/kmol
# Combustion equation is C3H8+ 5O2 +18.8N2 → 3CO2 +4H2O +18.8N2
# From table 14.3
h333_C3H8=2751; # h333_h298 of C3H8 in kJ/kmol
h333_O2=147; # h333_h298 of O2 in kJ/kmol
h333_N2=145; # h333_h298 of N2 in kJ/kmol
h1333_CO2=52075; # h1333_h298 of CO2 in kJ/kmol
h1333_H2O=32644; # h1333_h298 of H2O in kJ/kmol
h1333_N2=32644; # h1333_h298 of N2 in kJ/kmol
M=44; # molecular mass of C3H8
#Calculation
Ha_H1=h333_C3H8+5*h333_C3H8+18.8*h333_N2; # The enthalpy differences
Hb_H2=3*h1333_CO2+4*h1333_H2O+18.8*h1333_N2; # The enthalpy differences
Q=(del_Ho+Hb_H2/1000-Ha_H1/1000)/M; # Heat transfer from combustion chamber
#Result
print "Heat transfer from combustion chamber =",round(abs (Q),2),"MJ/kg C3H8"
```

In [8]:

```
#Variable declaration
Ha_H1=6220; # From example 14.7 in kJ/kmol
del_Ho=-2039.7; # From example 14.7 LHV in MJ/kmol
#Calculation
Hb_H2=-del_Ho+Ha_H1; # For adiabatic combustion of C3H8
# Hb_H2=3*h1333_CO2+4*h1333_H2O+18.8*h1333_N2 By iteration process and making use of the values from Table A.3, A.13, A.15
# we can get the adiabatic flame temperature is
Tad=2300;# The adiabatic flame temperature in kelvin
#Result
print "The adiabatic flame temperature =",Tad,"K"
```

In [9]:

```
#Variable declaration
# (a).Entropy change per kmol of C
# From table 14.1 at 298 K and 1 atm
s_c=5.686; # Absolute entropies of C in kJ/kmol K
s_o2=205.142; # Absolute entropies of o2 in kJ/kmol K
s_co2=213.795; # Absolute entropies of CO2 in kJ/kmol K
#Calculation for (a)
del_s=s_co2-(s_c+s_o2); # The entropy change
#Result for (a)
print "(a).The entropy change = ",del_s,"kJ/K/kmol C"
#Variable declaration for(b)
# (b).Entropy change of universe
Tsurr=298; # Temperature of surroundings in kelvin
#Calculation for (b)
# From table 14.1
del_Ho=-393509; # del_hfco2 in kJ/kmol CO2
Q=abs (del_Ho);
del_Ssurr=Q/Tsurr; # Entropy change of surroundings
del_Suniv=del_s+del_Ssurr; #Entropy change of universe
#Result for (b)
print "\n(b).Entropy change of universe = ",del_Suniv,"kJ/K"
```

In [10]:

```
import math
from __future__ import division
#Variable declaration
# (a).The product CO2 is also at 298K
Pco=2/3; # Paratial pressure of CO in atm
Po2=1/3; # Paratial pressure of O2 in atm
Pco2=1; # Paratial pressure of CO2 in atm
T0=298; # Temperature of surroundings in kelvin
R_1=8.3143; # Universal gas constant of air in kJ/kmol K
#Calculation for (a)
# From table 14.1 at 298 K and 1 atm
s_co2=213.795-R_1*math.log (Pco2); # entropies in kJ/kmol K
s_co=197.653-(R_1*math.log (Pco)); # entropies in kJ/kmol K
s_o2=205.03-R_1*math.log (Po2); # entropies in kJ/kmol K
del_Scv=s_co2-s_co-1/2*s_o2; # Entropy change of comtrol volume
# From table 14.1
del_hfco2=-393509; del_hfco=-110525; # Enthalpy of Heat in kJ/kmol
Q= del_hfco2- del_hfco; # Heat transfer (to surroundings)
del_Ssurr=abs(Q)/T0; # Entropy change of surroundings
del_Sgen=del_Scv+del_Ssurr; #Entropy change of universe
#Result for (a)
print "(a).The product CO2 is also at 298 K","\nEntropy change of comtrol volume = ",round(del_Scv,2),"kJ/K"
print "Entropy change of surroundings = ",round(del_Ssurr,2),"kJ/K","\nEntropy change of universe = ",round(del_Sgen,3),"kJ/K"
#Calculation for (b)
# (b).The reaction is adiabatic
# Let the adiabatic flame temperature be T. Then since
Q=0;
C_p=44*0.8414;
# From table A.16
T=5057.5; #adiabatic flame temperature in kelvin
s_CO2=213.795+C_p*math.log (T/T0); # entropies in kJ/kmol K
del_Scv=s_CO2-s_co-1/2*s_o2; # Entropy change of comtrol volume
del_Ssurr=abs(Q)/T0; # Entropy change of surroundings
del_Sgen=del_Scv+del_Ssurr; #Entropy change of universe
#Result for (b)
print "\n(b).The reaction is adiabatic","\nEntropy change of comtrol volume = ",round(del_Scv,3),"kJ/K"
print "Entropy change of surroundings = ",round(del_Ssurr,3),"kJ/K","\nEntropy change of universe = ",round(del_Sgen,3),"kJ/K"
```

In [11]:

```
#Variable declaration
# The Combustion of H2 with Q2 from H2O
#H2(g)+1/2 O2 (g)→H2O(l)+285830 kJ/kmol H2
T0=298; # Temperature of surroundings in kelvin
# From table 14.1 at 298 K
del_hfH2O=-285830; # Enthalpy of Heat in kJ/kmol
s_298H2O=69.94; s_298H2=130.684; s_298O2=205.142; # entropies in kJ/kmol K
#Calculation
GP_GR=del_hfH2O-T0*(s_298H2O-s_298H2-1/2*s_298O2); # Formation of Gibbs function
GR=0;
GP=GP_GR-GR; # Standard Gibbs function of formation of liquid H2O
#Result
print "Standard Gibbs function of formation of liquid H2O = ",round(GP,0),"kJ/kmol"
```

In [12]:

```
#Variable declaration
# the combustion equation
# n1C3H8+n2O2+n3 N2 → n4 CO2+ n5 H2O+n6 O2+n7 N2
T0=298; # Temperature of surroundings in kelvin
# (a).Product species at 25 oC and 1 atm
d_gfC3H8=-24290; d_gfCO2=-394359; d_gfH2O=-228570; # in kJ/kmol
GR=d_gfC3H8;
#Calculation for (a)
GP=3*d_gfCO2+4*d_gfH2O;
Wmax=GR-GP; # Maximum possible work output
M=44;#Molecular weight
Wmax=Wmax/M;
#Result for (a)
print "(a).","\nMaximum possible work output = ",round(Wmax,3),"kJ/kg fuel (answer mentioned in the textbook is wrong)"
#Calculation for (b)
# (b).The actual partial pressures of products
n1=1; n2=20; n3=75.2;
n4=3; n5=4; n6=15; n7=75.2; # refer equation
SR=19233; SP=19147; # in kJ/K from table
HR=-104680; # in kJ/kmol fuel
d_h0fCO2=-393509; d_h0fH2O=-241818; # in kJ/kmol
HP=3*d_h0fCO2+4*d_h0fH2O;
Wmax=HR-HP-T0*(SR-SP); # Maximum possible work output
Wmax=Wmax/M;
#Result for (b)
print "\n(b).","\nMaximum possible work output = ",round(Wmax,3),"kJ/kg (round off error)"
```