from math import log
# Initialisation of Variables
r=8#..........................#Compression Ratio
ga=1.4#.......................#Degree of freedom for the gas
Cvinc=1.1#....................#Increase of specific heat at constant volume in percentage
#Calculations
eta=1-1/(r**(ga-1))#...........#efficiency of otto cycle
deta=(1-eta)*(ga-1)*log(r)*(Cvinc/100)#............#Change in efficiency
etach=-deta/eta#............................#Percentage change in efficiency of change in efficiency
print "The percentage change in the efficiency of otto cycle = %0.2f %%"%(etach*100)
from math import log
from __future__ import division
# Initialisation of Variables
r=7#..........................#Compression Ratio
ga=1.4#.......................#Degree of freedom for the gas
Cvinc=3#....................#Increase of specific heat at constant volume in percentage
#Calculations
eta=1-1/(r**(ga-1))#...........#efficiency of otto cycle
deta=(1-eta)*(ga-1)*log(r)*(Cvinc/100)#............#Change in efficiency
etach=-deta/eta#............................#Percentage change in efficiency of change in efficiency
print "The percentage change in the efficiency of otto cycle = %0.2f %%"%(etach*100)
from __future__ import division
from math import log
# Initialisation of Variables
r=18#..........................#Compression Ratio
co=5#..........................#Cut off percent of stroke
cv=0.71#.......................#Mean specific heat for cycle in kJ/kg K
R=0.285#.......................#Charecteristic gas constant in kJ/kh K
cvinc=2#.......................#Percentage increase in mean specific heat of the cycle
#Calculation
rho=(co/100)*(r-1)+1#
ga=1+(R/cv)#
eta=1-(1/(ga*(r**(ga-1))))*((rho**ga)-1)/(rho-1)#.....................#Efficiency of diesel cycle
etach=-((1-eta)/eta)*(ga-1)*(log(r)-(((rho**ga)*log(rho))/((rho**ga)-1))+(1/ga))*(cvinc/100)#...#Variation in the air standard efficiency
print "Percentage change = %0.2f efficiency"%(etach*100)
from math import sqrt,log
from __future__ import division
# Initialisation of Variables
r=7#......................#Compression ratio
C=44000#..................#Calorific value of fuel used in kJ/kg
afr=15#...................#Air fuel ratio
t1=338#....................#Temperature of the charge at the end of the stroke in Kelvin
p1=1#......................#Pressure of the charge at the end of the stroke in bar
n=1.33#....................#Index of compression
cv=0.71#......#Specific heat constant at constant volume in kJ/kgK
k=20*10**(-5)#
#Calculations
p2=p1*(r)**n#
t2=(t1*p2)/(p1*r)#
ha=C/(afr+1)#......................#Heat added per kg of charge in kJ
t3=((-2*cv)+sqrt((4*cv*cv)+(4*k*((2*cv*t2)+(k*t2*t2)+(2*ha)))))/(2*k)#
p3=(p2*t3)/t2#.............................#Max pressure for constant volume process in bar
P3=p2*((ha/cv)+t2)/t2#.....................#Max pressure for constant specific heat in bar
print "Max pressure in the cylinder = %0.2f bar "%(p3)
print "Max pressure for constant specific heat = %0.2f bar "%P3
from math import sqrt,log
from __future__ import division
# Initialisation of Variables
r=10#......................#Compression ratio
C=48000#..................#Calorific value of fuel used in kJ/kg
afr=15#...................#Air fuel ratio
t1=330#....................#Temperature of the charge at the end of the stroke in Kelvin
p1=1#......................#Pressure of the charge at the end of the stroke in bar
n=1.36#....................#Index of compression
cv=0.7117#......#Specific heat constant at constant volume in kJ/kgK
k=2.1*10**(-4)#
#Calculations
p2=p1*(r)**n#
t2=t1*((p2/p1)**((n-1)/n))#
ha=C/(afr+1)#......................#Heat added per kg of charge in kJ
t3=((-2*cv)+sqrt((4*cv*cv)+(4*k*((2*cv*t2)+(k*t2*t2)+(2*ha)))))/(2*k)#
p3=(p2*t3)/t2#.............................#Max pressure for constant volume process in bar
P3=p2*((ha/cv)+t2)/t2#.....................#Max pressure for constant specific heat in bar
print "Max pressure in the cylinder = %0.2f bar "%p3
print "Max pressure for constant specific heat = %0.2f bar "%P3
from math import sqrt,log
from __future__ import division
# Initialisation of Variables
r=15#......................#Compression ratio
C=43000#..................#Calorific value of fuel used in kJ/kg
afr=27#...................#Air fuel ratio
t2=870#....................#Temperature of the charge at the end of the stroke in Kelvin
cv=0.71#......#Specific heat constant at constant volume in kJ/kgK
R=0.287#.........................#Gas constant in kJ/kgK
k=20*10**(-5)#
#Calculations
cp=cv+R#............................#Specific heat at constant pressure
ha=C/(afr+1)#......................#Heat added per kg of charge in kJ
t3=((-2*cp)+sqrt((4*cp*cp)+(4*k*((2*cp*t2)+(k*t2*t2)+(2*ha)))))/(2*k)#
co=((t3/t2)-1)/(r-1)#.............#combustion occupies this amt of stroke
print "Percentage of the stroke when the combustion is completed is ",round(co*100,2)
from math import sqrt,log
from __future__ import division
# Initialisation of Variables
r=14#......................#Compression ratio
t1=87+273#....................#Temperature of the charge at the end of the stroke in Kelvin
p1=1#......................#Pressure of the charge at the end of the stroke in bar
hsupa=1700#............................#heat supplied per kg of air in kJ
cv=0.71#......#Specific heat constant at constant volume in kJ/kgK
k=20*10**(-5)#
ga=1.4#.....................#Degree of freedom
R=0.287#......................#Gas constant in kJ/kgK
#Calculations
p2=p1*(r)**ga#
t2=t1*(r**(ga-1))#
ha=hsupa/2#......................#Heat added per kg of charge in kJ
t3=((-2*cv)+sqrt((4*cv*cv)+(4*k*((2*cv*t2)+(k*t2*t2)+(2*ha)))))/(2*k)#
p3=(p2*t3)/t2#.............................#Max pressure for constant volume process in bar
P3=p2*((ha/cv)+t2)/t2#.....................#Max pressure for constant specific heat in bar
print "Max pressure in the cylinder = %0.2f bar "%p3
cp=cv+R#.................................#Heat capacity at constant pressure in kJ/kgK
t4=((-2*cp)+sqrt((4*cp*cp)+(4*k*((2*cp*t3)+(k*t3*t3)+(2*ha)))))/(2*k)#
co=((t4/t3)-1)/(r-1)#.............#combustion occupies this amt of stroke
print "Percentage of the stroke when the combustion is completed is ",round(co*100,2)
from math import sqrt,log
from __future__ import division
# Initialisation of Variables
r=8#...........................#Compression ratio
C=44000#............#Calorific value of fuel in kJ/kg
afr=13.8#.....................#Air fuel ratio
t1=343#.............................#Temperature of the mixture at the beginning of the compression in Kelvin
p1=1#........................#Pressure of the mixture at the beginning of the compression in bar
cv=0.716#.....................#Specific heat at constant volume in kJ/kgK
In=1.35#.......................#Index of compression
nc=6#..........................#No of carbon elements in the given fuel
nh=14#.........................#No of hydrogen elements in the given fuel
mc=12#...........................#Atomic mass of carbon in amu
mh=2#.............................#atomic mass of hydrogen molecule in amu
mo=32#...........................#Atomic mass of oxygen molecule in amu
#Calculations
#The chemical equation is C6H14 + xO2 ==> yCO2 + zH2O
#x is the no of oxygen molecules required for complete combustion
#y is the no of carbon dioxide molecules produced in complete combustion
#z is the no of Water molecules produced in complete combustion
y=nc#............................#As no of CO2 molecules is equal to no of C atoms in the fuel
z=nh/2#..........................#No of H2O molecules is equal to half the no of H atoms in the fuel
x=(z/2)+y#...........................#No of oxygen molecules required for combustionis half the no of water molecules plus the no of oxygen molecules
gafr=((x*32)*(100/23))/((mc*y)+(mh*z))#.................#Gravimetric air fuel ratio
ms=(gafr/afr)*100#......................#Actual mixture strength
#Since the mixture strength is greater than 100 %
#The mixture is rich in fuel. The combustion is therefore incompplete and hence CO will be formed
d=ms/100#......................#No of fuel molecules required for combustion
#The chemical equation is d(C6H14) + 9.5(O2) ==> a(CO2) + b(CO) + c(H2O)
c=(d*nh)/2#...............................#No of H2O molecules is equal to half the no of H atoms in the fuel
a=(x*2)-(d*nc)-c#........................#Equating atoms of the same element on both sides of equation
b=(d*nc)-a#
#By adding nitrogen on both sides, we are adding the same molecular weight on both sides.
#Air is 79 % nitrogen and 21 % oxygen
#Both N2 and O2 are diatomic molecules
n=x*(79/21)#.............................#No of nitrogen molecules
mbc=d+x+n#.............................#Moles before combustion
mac=a+b+c+n#.............................#Moles after expansion
me=(mac-mbc)/mbc#........................#Molecular expansion
t2=(t1*(r**(In-1)))#
t3=(t2+(C/((afr+1)*cv)))#..................#Maximum temperature ignoring molecular expansion in Kelvin
p3=p1*r*(t3/t1)#...........................#Maximum pressure ignoring molecular expansion in bar
t3me=t3#...............................#Maximum temperature considering molecular expansion in Kelvin
p3me=p3*(mac/mbc)#....................#Maximum pressure considering molecular expansion in bar
print "Maximum temperature ignoring molecular expansion = %0.2f Kelvin "%t3
print "Maximum pressure ignoring molecular expansion = %0.2f bar "%p3
print "Maximum temperature considering molecular expansion = %0.2f Kelvin "%t3me
print "Maximum pressure considering molecular expansion = %0.2f bar"%p3me
from math import sqrt,log
from __future__ import division
# Initialisation of Variables
r=7#....................#Compression Ratio
t2=715#.................#Temperature at the end of isentropic compression in Kelvin
t4=1610#................#Temperature at the end of expansion in Kelvin
#Calculations
vr2=65.8#..................#From steam table
u2=524.2#..................#From steam table
vr4=5.69#..................#From steam table
u4=1307.63#..................#From steam table
vr1=r*vr2#
t1=338#..................#From steam table
u1=241.38#..................#From steam table
vr3=vr4/r#
t3=2800#..................#From steam table
u3=2462.5#..................#From steam table
W=(u3-u2)-(u4-u1)#..................#Work done
Qa=(u3-u2)#..........................#Heat added
eta=W/Qa#...........................#Cycle efficiency
print "The cycle work = %0.2f kJ/kg "%W
print "The cycle efficiency = %0.2f %%"%(eta*100)