#calculate the Molecule
#Initialization of variables
per=85.
#calculations
a=per/12.
b=100-per
ad=1.13*a
bd=1.13*b+1
#results
print '%s %d %s %d' %("Molecule is C",ad,"H",bd)
#calculate the Oxygen and Nitrogen content
#Initialization of variables
per=0.071
#calculations
O2=8.74
N2=per/2 + 3.76*O2
#results
print '%s %.2f %s %.2f' %("Oxygen =",O2,"and Nitrogen =",N2)
#calculate the air fuel ratio
#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 '%s %.1f %s' %("Air fuel ratio =",AF,"lbm air/lbm fuel")
#calculate the air fuel ratio
#Initialization of variables
N2=78.1
M=29
ba=2.12
x4=0.3
x5=3.7
x6=14.7
#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 '%s %.1f %s' %("Air fuel ratio =",AF,"lbm air/lbm fuel")
#calculate the air fuel ratio
#Initialization of variables
N2=78.1
M=29
ba=2.12
x4=0.3
x5=3.7
x6=14.7
#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 '%s %.1f %s' %("Air fuel ratio =",AF,"lbm air/lbm fuel")
#calculate the air fuel ratio
#Initialization of variables
N2=78.1
M=29
ba=2.12
co2=8.7
co=8.9
x4=0.3
x5=3.7
x6=14.7
#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 '%s %.1f %s' %("Air fuel ratio =",AF,"lbm air/lbm fuel")
#calculate the air fuel ratio
#Initialization of variables
x1=8.7
x2=8.9
x3=0.3
N=78.1
z=113
M=29
#calculations
co2=(x1+x2+x3)*100/(N+x1+x2+x3)
a=2.325
AF=103*M/(a*z)
#results
print '%s %.2f' %("Air fuel ratio = ",AF)
#calculate the Higher heating value
#Initialization of variables
dH=-2369859 #Btu
r=1.986
dn=5.5
T=536.7 #R
#calculations
dQ=dH+dn*r*T
#results
print '%s %d %s' %("Higher heating value =",dQ," Btu")
#calculate the Lower heating value
#Initialization of variables
y=13
x=12
M2=18
M=170
p=0.4593
vfg=694.9
J=778.2
m=9*18
u1=-2363996 #Btu
#calculations
z=y*M2/M
hfg=1050.4 #Btu/lbm
ufg= hfg- p*vfg*144/J
dU=ufg*m
Lhv=u1+dU
#results
print '%s %d %s' %("Lower heating value =",Lhv,"Btu/lbm")
#calculate the Heat of the reaction
#Initialization of variables
n1=8
n2=9
n3=1
n4=12.5
U11=3852
U12=115
U21=3009
U22=101
U31=24773
U32=640
U41=2539
U42=83
H=-2203389
#calculations
dU1=n1*(U11-U12)+n2*(U21-U22)
dU2=n3*(U31-U32)+n4*(U41-U42)
Q=H+dU1-dU2
#results
print '%s %d %s' %("Heat of reaction =",Q,"Btu")
#calculate the final temperature
#Initialization of variables
n1=8
n2=9
n3=47
h1=118
h2=104
h3=82.5
Q=2203279 #Btu
#calculations
U11=n1*h1+n2*h2+n3*h3
U12=U11+Q
T2=5271 #R
#results
print '%s %d %s' %("Upon interpolating, T2 =",T2," R")
#calculate the percentage of dissociation
#Initialization of variables
import numpy
from numpy import roots
kp=5.
#calculations
p1=[24.,0,3,-2]
vec=numpy.roots(p1)
x=numpy.real(vec[2]*100.)
p2=[249.,0,3,-2]
vec2=numpy.roots(p2)
y=numpy.real(vec2[2]*100.)
#results
print '%s %.1f %s' %("percentage of dissociation =",x," percent")
print '%s %.d %s' %("\n If pressure =10 . degree of dissociation =",y,"percent")
#calculate the Extent of reaction
#Initialization of variables
import numpy
from numpy import roots
p=[24.,48,7,-4]
vec=numpy.roots(p)
x=numpy.real(vec[2] *100)
#results
print '%s %d %s' %("Extent of reaction=",100-x,"percent")