#Initialization of variables
per=85
#calculations
a=per/12
b=100-per
ad=1.13*a
bd=1.13*b
#results
print "Molecule is C%d H%d"%(ad,bd+1)
#Initialization of variables
per=0.071 #mass fraction of nitrogen
#calculations
O2=8.74
N2=per/2 + 3.76*O2
Nin=32.85
CO2=7.333
H2o=3
So2=0.0312
#results
print "Oxygen = %.2f and Nitrogen = %.2f"%(O2,N2)
print "\nEquation is C%.3f H%d + %.2f O2 + %.2f N2 = %.3f CO2 + %d H2O + %.5f SO2 + %.2f N2"%(CO2,2*H2o,O2,Nin,CO2,H2o,So2,N2)
#Initialization of variables
M=29
m1=8.74
m2=32.85
fuel=100 #lbm
#calculations
mass=M*(m1+m2)
AF=mass/fuel
a2=9.75
b2=12.19
AF2=mass/(fuel+a2+b2)
#results
print "Air fuel ratio = %.2f lbm air/lbm fuel"%(AF)
print "\nIn dry air, Air-fuel ratio = %.1f lbm air/lbm fuel as fired"%(AF2)
#Initialization of variables
m1=322.3 #Mass of Co2
m2=2 #Mass of SO2
m3=926 #Mass of N2
basis=121.94 #Basis taken
#calculations
m=m1+m2+m3
ratio=m/basis
dh=5777 #Btu/mol
h1=dh*7.364
h2=14037
h3=130501
H=h1+h2+h3
hrat=H/basis
#results
print "Mass of dry flue gases = %.2f lbm dry flue gas/lbm fuel ash and moisture free"%(m/100)
print "\n Mass of dry flue gases = %.2f lbm dry flue gas/lbm fuel as fired "%(ratio)
print "\n Energy carried away = %.1f btu/mol coal as fired which is same as = %.1f Btu/lbm mol coal "%(H, hrat)
print "The answers are a bit different due to rounding off errors in textbook"
#Initialization of variables
p=14.7 #psia
ps=0.363 #psia
n2=7.52 #moles
n1=1 #moles
#calculations
x= (n1+n2)*ps/p /(1-ps/p)
n=n1+n2+x
y1=n1/n
y2=n1/(n1+n2)
#results
print "Final orsat composition is %d CO2 + %.2f H20 + %.2f N2"%(n1, x, n2)
print "\n Percentage of co2 on a wet basis = %.1f percent"%(y1*100)
print "\n percentage of co2 on a dry basis = %.2f percent"%(y2*100)
#Initialization of variables
N2=78.1
M=29
co2=8.7
co=8.9
x4=0.3
x5=3.7
x6=14.7
#calculations
O2=N2/3.76
Z=(co2+co+x4)/8
AF=(O2+N2)*M/(Z*113)
#results
print "Air fuel ratio = %.1f lbm air/lbm fuel"%(AF)
#Initialization of variables
basis=100 #lbm
x1=0.6
ash=12 #lbm
N2=79.7
M=29
#calculations
x=ash/x1
C=(1-x1)*x
O2=N2/3.76
a= (14.6+0.2)/(5.83-0.66)
AF=(O2+N2)*M/(a*100)
#results
print "Air fuel ratio = %.1f lbm air/lbm fuel as fired"%(AF)
#Initialization of variables
N2=78.1 #Moles of Nitrogen
M=29 #Molar mass of Air
ba=2.12 #Basis
x4=0.3 #Moles of Ch4
x5=3.7 #Moles of H2
x6=14.7 #moles of H2o
#calculations
O2=N2/3.76
O2=N2/3.76
Z=(x4*4+x5*2+x6*2)/17
AF=(O2+N2)*M/(Z*113)
#results
print "Air fuel ratio = %.1f lbm air/lbm fuel"%(AF)
#Initialization of variables
N2=78.1 #Moles of Nitrogen
M=29 #Molar mass of Air
ba=2.12 #Basis
x4=0.3 #Moles of Ch4
x5=3.7 #Moles of H2
x6=14.7 #moles of H2o
#calculations
O2=N2/3.76
c=14.7
b= x4*4 + x5*2 + x6*2
a=b/ba
AF=(O2+N2)*M/(a*12 + b)
#results
print "Air fuel ratio = %.1f lbm air/lbm fuel"%(AF)
#Initialization of variables
co2=8.7 #Moles of CO2
co=8.9 #Moles of CO
N2=78.1 #Moles of Nitrogen
M=29 #Molar mass of Air
ba=2.12 #Basis
x4=0.3 #Moles of Ch4
x5=3.7 #Moles of H2
x6=14.7 #moles of H2o
#calculations
O2=N2/3.76
c=14.7
Z=2.238
X=(Z*17-x4*4-x5*2)/2
a=co2+co/2+x4+x6/2
b=3.764*a
AF=(O2+N2)*M/(Z*113)
#results
print "Air fuel ratio = %.1f lbm air/lbm fuel"%(AF)
#Initialization of variables
x1=8.7 #Moles of Co2
x2=8.9 #Moles of CO
x3=0.3 #Moles of O2
N=78.1 #Moles of N2
z=113 #Af factor
M=29 #Molar mass of air
#calculations
co2=(x1+x2+x3)*100/(N+x1+x2+x3)
a=2.325
AF=103*M/(a*z)
#results
print "Air fuel ratio = %.2f"%(AF)
#Initialization of variables
co=1.2 #Moles of CO
co2=10.8 #Moles of CO2
#calculations
H2=co/2
ch4=0.3
N2=88-H2-ch4
#results
print "Nitrogen = %.1f percent"%(N2)
print "\nEquation is a(96 CH4 + 3 H2+ 1 CO) + %.1f/3.76 O2 + %.1f N2 = %.1f CO2 + %.1f CO + %.1f H2 + %.1f CH4 + %.1f N2"%(N2,N2,co2,co,H2,ch4,N2)
#Initialization of variables
dH=-2369859 #Btu
r=1.986 #Gas constant
dn=5.5 #Change in number of moles
T=536.7 #R
#calculations
dQ=dH+dn*r*T
#results
print "Higher heating value = %d Btu"%(dQ)
#Initialization of variables
M2=18 #Molar mass of water
M=170 #Molar mass of octane
p=0.4593 #Pressure of octane #psia
print "from steam tables,"
vfg=694.9
J=778.2
m=9*18 #Mass of water
u1=-2363996 #Btu
#calculations
hfg=1050.4 #Btu/lbm
ufg= hfg- p*vfg*144/J
dU=ufg*m
Lhv=u1+dU
#results
print "Lower heating value = %d Btu/lbm"%(Lhv)
print "The answers are a bit different due to rounding off error in textbook."
#Initialization of variables
n1=8 #Moles of CO2
n2=9 #Moles of H2O
n3=1 #Moles of Octane
n4=12.5 #Moles of Oxygen
print "From Table B-10,"
U11=3852 #Internal energy at 1000 R of CO2
U12=115 #Internal energy at 537 R of CO2
U21=3009 #Internal energy at 1000 R of H2O
U22=101 #Internal energy at 537 R of H2O
U31=24773 #Internal energy at 1000 R of Octane
U32=640 #Internal energy at 537 R of Octane
U41=2539 #Internal energy at 1000 R of Oxygen
U42=83 #Internal energy at 537 R of Oxygen
H=-2203389 #heat Btu
#calculations
dU1=n1*(U11-U12)+n2*(U21-U22)
dU2=n3*(U31-U32)+n4*(U41-U42)
Q=H+dU1-dU2
#results
print "Heat of reaction = %d Btu"%(Q)
print "The answers are a bit different due to rounding off error in textbook."
#Initialization of variables
n1=8 #Moles of CO2
n2=9 #Moles of H2O
n3=47 #Moles of N2
print "from table B-10,"
h1=118 #Enthalpy of CO2
h2=104 #Enthalpy of H2O
h3=82.5 #Enthalpy of N2
Q=2203279 #Btu
#calculations
U11=n1*h1+n2*h2+n3*h3
U12=U11+Q
T2=5271 #R
#results
print "Upon interpolating, T2 = %d R"%(T2)
#Initialization of variables
n1=0.95
n2=0.05
n3=0.025
P=147 #psia
pa=14.7 #psia
#calculations
n=n1+n2+n3
p1=n1/n *P/pa
p2=n2/n *P/pa
p3=n3/n *P/pa
Kp1= p1/(p2*p3**0.5)
Kp2= p1**2 /(p2**2 *p3)
#results
print "In case 1, Equilibrium constant = %.1f "%(Kp1)
print "\nIn case 2, Equilibrium constant = %.1f "%(Kp2)
from sympy.abc import x,y
from sympy import solve,N
#Initialization of variables
kp=5
#calculations
vec=solve(24*x**3 + 3*x-2,x)
x=N(vec[2],6)
vec2=solve(249*y**3 +3*y-2,y)
y=N(vec2[2],6)
#results
print "percentage of dissociation = %.1f percent"%(x*100)
print "\n If pressure =10 . Degree of dissociation = %d percent"%(y*100)
from sympy.abc import x,y
from sympy import solve,N
#Initialization of variables
vec=solve(24*x**3 +48*x**2 + 7*x -4,x)
x=N(vec[1],6) *100
#results
print "Extent of reaction= %d percent"%(100-x)