Example1-pg 528¶

In [2]:
import math
#caluclate fuel ratio and excess air and emass air-fuel ratio
##initialisation of variables
pN2= 79. ##percent
VN2= 82.3 ##m^3
VCO2= 8. ##m^3
VCO= 0.9 ##m^3
M= 32. ##gms
M1= 28. ##gms
##CALCULATIONS
P= (pN2/(100-pN2))
z= VN2/P
x= VCO2+VCO
w= VCO2+(VCO/2)+(VCO2/10)
y= 2*w
r= y/x
TO= x+(y/4)
X= (z/TO)-1
AF= z*(M+P*M1)/(12*x+y)
##RESULTS
print'%s %.3f %s'%('fuel ratio=',r,'')
print'%s %.3f %s'%('excess air=',X,'')
print'%s %.2f %s'%('emass air-fuel ratio=',AF,'')

fuel ratio= 2.079
excess air= 0.618
emass air-fuel ratio= 23.98


Example2-pg 534¶

In [4]:
import math
#calculate heat interaction
##initialisation of variables
m1= 24. ##kg
M1= 32. ##kg
m2= 28. ##kg
M2= 28. ##kg
e= 0.5
T3= 1800. ##C
T0= 25. ##C
T1= 25. ##C
T2= 100. ##C
R= 8.314 ##Jmol K
cp= 4.57 ##J/mol K
cp1= 3.5 ##J/mol K
cp2= 3.5 ##J/mol K
hCO2= -393522. ##J
hCO= -110529. ##J
##CALCULATIONS
n1= m1/M1
n2= m2/M2
N= n1-0.5*e
N1= n2-e
N2= e
N3= N+N1+N2
y1= N/N3
Q= ((N*cp+N1*cp1+N2*cp2)*R*(T3-T0)-(n1*cp*(T1-T0)+n2*cp2*(T2-T1))+N*(hCO2-hCO))/60.
##RESULTS
print'%s %.f %s'%(' Heat interaction=',Q,'kW ')

 Heat interaction= -940 kW


Ex3-pg536¶

In [3]:
##initialisation of variables
hCO2= -393520. ##kJ/kg mol
hH2O= -285840. ##kJ/kg mol
hC7H16= -187820. ##kJ/kg mol
M= 100
hH2O1= -241830. ##kJkg mol
##CALCULATIONS
HHV= -(7*hCO2+8.*hH2O-hC7H16)/M
LLV= -(7*hCO2+8.*hH2O1-hC7H16)/M
#RESULTS
print'%s %.2f %s'% (' Higher heating vlue= ',HHV,' kJ/kg mol ')
print'%s %.2f %s'%  ('  Lower heating vlue= ',LLV,' kJ/kg mol ')
#round off error

 Higher heating vlue=  48535.40  kJ/kg mol
Lower heating vlue=  45014.60  kJ/kg mol


Example4-pg 537¶

In [1]:
import math
##initialisation of variables
T0= 25. ##C
T1= 220. ##C
hCO2= -393520 ##kJ/kg
hH2O= -241830 ##kJ/kg
hC3H8= -103850 ##kJ/kg= 1.4
R= 8.314 ##Jmol K
k= 1.4
k1= 1.29
##CALCULATIONS
T= T0+((15*(R*(k/(k-1)))*4.762*(T1-T0)-(3*hCO2+4*hH2O-hC3H8))/(R*((3+4)*(k1/(k1-1))+(10+56.43)*(k/(k-1)))))
##RESULTS
print'%s %.1f %s'%('adiabatic flame temperature=',T,'C ')

adiabatic flame temperature= 1142.4 C


Example6-pg 415¶

In [5]:
import math
#calculate enthalpy formation
##initialisation of variables
T= 25. ##C
hfT= -241820 ##kJ/kmol
R= 8.314 ##J/mol K
k= 1.4
cpH2O= 4.45
cpO2= 3.5
T1= 1000. ##C
##CALCULATIONS
S= (cpH2O-k*cpO2)
hfT1= hfT+S*(T1-T)
##RESULTS
print'%s %.f %s'%('enthalpy formation=',hfT1,'kJ/kmol ')
#there is error because of round off error

enthalpy formation= -242259 kJ/kmol


Example7-pg 545¶

In [9]:
import math
#calculate equlibrium constant at K and KT1
##initialisation of variables
R= 8.314 ##J/mol K
T= 25. ##C
gf= 16590. ##kJ/kmol
T1= 500. ##C
Cp= 4.157 ##J/mol K
hf= -46190 ##kJ/kmol
e=0.5
##CALCULATIONS
K=math.pow(math.e,gf/(R*(273.15+T)))
r= (1-((273.15+T)/(273.15+T1)))*((hf/(R*(273.15+T)))+(R/Cp))-2*math.log((273.15+T1)/(273.15+T))+0.6
KT1= K*math.pow(math.e,r)
##RESULTS
print'%s %.1f %s'%('equilibrium constant=',K,'bar^-1 ')
print'%s %.5f %s'%('equilibrium constant=',KT1,'bar^-1 ')

equilibrium constant= 806.5 bar^-1
equilibrium constant= 0.00797 bar^-1


Example8-pg 546¶

In [10]:
import math
#what equilibrium constant at T1 and T2
##initialisation of variables
uCO2= -394374 ##J/mol
uCO= -137150 ##J/mol
uO2= 0.
R= 8.314 ##J/mol K
T= 25. ##C
cpCO2= 4.57 ##J/mol K
cpCO= 3.5 ##J/mol K
cpO2= 3.5 ##J/mol K
T1= 1500. ##C
hf= -393522 ##kJ/kmol
gf= -110529 ##kJ/kmol
T2= 2500. ##C
##CALCULATIONS
r= -(uCO2-uCO-0.5*uO2)/(R*(273.15+T))
s= (cpCO2-cpCO-0.5*cpO2)
r1= (1-((273.15+T)/(273.15+T1)))*((hf-gf)/(R*(273.15+T))-s)+s*math.log((273.15+T1)/(273.15+T))
KT1= math.pow(math.e,r+r1)
r2= (1-((273.15+T)/(273.15+T2)))*((hf-gf)/(R*(273.15+T))-s)+s*math.log((273.15+T2)/(273.15+T))
KT2= math.pow(math.e,r+r2)
##RESULTS
print'%s %.f %s'%('equilibrium constant at T1=',KT1,'C ')
print'%s %.3f %s'%('equilibrium constant at T2=',KT2,'C ')

equilibrium constant at T1= 3477 C
equilibrium constant at T2= 2.635 C


Example9-pg548¶

In [11]:
import math
#what is maximum work of given variable
##initialisation of variables
Wc= 12. ##kg
hf= -393520 ##kJ/kmol
gf= -394360 ##kJ/kmol
##CALCULATIONS
Wmax= -gf/Wc
##RESULTS
print'%s %.f %s'%('maximum work=',Wmax,'kJ/kg of carbon ')

maximum work= 32863 kJ/kg of carbon


Example10-pg549¶

In [12]:
import math
#calculate the outlet temperature and energy of formation and energy out let and energy of the products
##initialisation of variables
T= 25 ##C
R= 8.314 ##Jmol K
k= 1.27
k1= 1.34
hf= -393520 ##kJ/kmol
M= 28 ##gms
gf= -394360 ##kJ/kmol
M= 12 ##gms
##CALCULATIONS
T1= T+(-hf/((R)*((k/(k-1))+(0.2+4.5144)*(k1/(k1-1)))))
Bin= 0
dh= (k1*R/(k1-1))*(T1-T)
dh1= (k1*R/(k1-1))*math.log((273.15+T1)/(273.15+T))
H= dh-(273.15+T)*dh1
h= (k*R/(k-1))*(T1-T)+hf
h1= (k*R/(k-1))*math.log((273.15+T1)/(273.15+T))+((hf-gf)/(273.15+T))
h2= h-(273.15+T)*h1
Bout= (h2+(0.2+4.5144)*H)/M
##RESULTS
print'%s %.2f %s'%('outlet temperature=',T1,'C')
print'%s %.f %s'%('energy of formation=',Bin,'J')
print'%s %.f %s'%('energy at outlet=',H,'kJ/kmol')
print'%s %.f %s'%('energy of the products=',Bout,'k')

outlet temperature= 2057.82 C
energy of formation= 0 J
energy at outlet= 46519 kJ/kmol
energy of the products= -9961 k


Example11-pg553¶

In [13]:
import math
#calculate the change in energy and amount of air and gas and netchange in energy and percent change in energy
##initialisation of variables
b= 1475.30 ##kJ/kg
b0= 144.44 ##kJ/kg
h2= 3448.6 ##kJkg
h1= 860.5 ##kJ/kg
k= 1.27
k1= 1.34
R= 8.314 ##J/mol K
hf= -393520 ##kJ/kmol
hg= 72596 ##kJ/kmol
Mc= 12 ##kg
n= 1.2 ##moles
n1= 3.76 ##moles
M= 32. ##gms
M1= 28. ##gms
M2= 44. ##gms
n2= 0.2 ##moles
n3= 4.512 ##moles
B1= 25592. ##kJ/kmol C
B2= 394360. ##kJ/kmol C
e= 0.008065
##CALCULATIONS
B= b-b0
Q= h2-h1
CpCO2= k*R/(k-1)
CpO2= k1*R/(k1-1)
Qcoal= (hg+hf)/Mc
mcoal= Q/(-Qcoal)
ncoal= mcoal/Mc
r= (n*M+n1*M1)/Mc
r1= (M2+n2*M+n3*M1)/Mc
mair= r*mcoal
mgas= r1*mcoal
Bfuel= (B1-B2)*e
Bnet= Bfuel+B
p= B*100/(-Bfuel)
##RESULTS
print'%s %.2f %s'% ('change in energy=',B,'kJ/kg ')
print'%s %.3f %s'%('amount of air=',mair,'kg/kg ')
print'%s %.3f %s'%('amount of gas=',mgas,'kg/kg ')
print'%s %.3f %s'%('net change in energy=',Bnet,'kg/kg steam ')
print'%s %.2f %s'%('percent energy in original fuel=',p,'percent ')

change in energy= 1330.86 kJ/kg
amount of air= 1.159 kg/kg
amount of gas= 1.425 kg/kg
net change in energy= -1643.254 kg/kg steam
percent energy in original fuel= 44.75 percent