import math
#Input data
r = 8. #Compression ratio
n = 1.41 #Adiabatic index of the medium
cv = 0.17 #Mean Specific heat at consmath.tant volume in kcal/kg/degree C
x = 2. #Percentage with which spcific heat at consmath.tant volume increases
R = 29.3 #Characteristic gas consmath.tant in mkg/kg/degree C
J = 427. #Mechanical equivalent of heat in kg.m/kcal
#Calculations
e = (1-(1/r**(n-1))) #Air standard efficiency neglecting the variation in specific heat
debye = ((x/100)*((1-e)/e)*(R/(J*cv))*math.log(r))*100 #Ratio of de and e in percent
#Output
print 'The change in air standard efficiency of the cycle is %3.3f percent'%(debye)
import math
from scipy.integrate import quad
#Input data
#Cv = 0.125+0.000005T where Cv is Specific heat at consmath.tant volume and T is the temperature in K
R = 28.9 #Characteristic gas consmath.tant in mkg/kg/degree C
T = [100+273,50+273] #Temperature in K
J = 427 #Mechanical equivalent of heat in kg.m/kcal
#Calculations
def f(x):
return 0.125+(0.00005*x)
I = J*quad(f,303,373)[0]
#Output
print 'The work done is %i m.kg/kg of gas'%(I)
import math
#Input data
af = 25. #Air fuel ratio
cv = [0.17,0.00004] #Cv = 0.17+0.00004T where Cv is Specific heat at constant volume and T is the temperature in K
r = 14. #Compression ratio
p1 = 1. #Pressure at the beginning of compression in kg/cm**2
T1 = 153.+273 #Temperature at the beginning of compression in K
CV = 10000. #Heating value of fuel in kcal/kg
n = 1.35 #Adiabatic constant
R = 29. #Characteristic gas constant in mkg/kg.K
J = 427. #Mechanical equivalent of heat in kg.m/kcal
#Calculations
T2 = (T1*r**(n-1)) #Temperature at the end of compression in K
a = (cv[1]/2) #For solving T3
b = cv[0]+(R/J) #For solving T3
c = (-T2*cv[0])-((cv[1]/2)*T2**2)-((R/J)*T2)-(CV/(af+1)) #Foe solving T3
T3 = (-b+math.sqrt(b**2-(4*a*c)))/(2*a) #Soving for T3 in K
pc = (((T3/T2)-1)/(r-1))*100 #Percentage cut off
#Output
print 'The percentage of stroke at which the constant pressure combustion stops is %i percent'%(pc)
import math
#Input data
af = 25. #Air fuel ratio
CV = 10000. #Calorific value in kcal/kg
cv = [0.17,0.00004] #Cv = 0.17+0.00004T where Cv is Specific heat at constant volume and T is the temperature in K
r = 14. #Compression ratio
T2 = 800.+273 #Temperature at the end of compression in K
R = 29. #Characteristic gas constant in mkg/kg/degree C
J = 427. #Mechanical equivalent of heat in kg.m/kcal
#Calculations
CVm = (CV/(af+1)) #Calorific value of mixture in kcal/kg
cpv = (R/J) #Difference in mean specific heats in kcal/kg mol.K
a = (cv[1]/2) #For solving T3
b = cpv+cv[0] #For solving T3
c = (-T2*(cpv+cv[0]))-((cv[1]/2)*T2**2)-CVm #Foe solving T3
T3 = (-b+math.sqrt(b**2-(4*a*c)))/(2*a) #Soving for T3 in K
s = ((T3/T2)/(r-1))*100 #Percentage of the stroke
#Output
print 'The percentage of the stroke at which the combustion will be complete is %3.2f percent'%(s)
import math
from scipy.integrate import quad
#Input data
T = [500,2000] #Change in temperature in K
x = [11.515,-172,1530] #Cp = 11.515-172/math.sqrt(T)+1530/T in kcal/kg mole.K
mO2 = 32 #Molecular weight of oxygen
#Calculations
def f(T):
return (x[0]+(x[1]/math.sqrt(T))+(x[2]/T))
I = -quad(f,T[1],T[0])[0] #Integration
dh = (I/mO2) #Change in enthalpy in kcal/kg
#Output
print 'The change in enthalpy is %3.1f kcal/kg'%(dh)
import math
#Input data
r = 14. #Compression ratio
s = 5. #Fuel injection stops at 5% stroke after inner head centre
pm = 50. #Maximum pressure in kg/cm**2
p4 = 1. #Pressure at the end of suction stroke in kg/cm**2
T4 = 90.+273 #Temperature at the end of suction stroke in K
R = 29.3 #Characteristic gas constant in mkg/kg/degree C
cv = [0.171,0.00003] #Cv = 0.171+0.00003T where Cv is Specific heat at constant volume and T is the temperature in K
J = 427. #Mechanical equivalent of heat in kg.m/kcal
#Calculations
a = (R/J)+cv[0] #a value in kcal/kg.mole.K
g = (a+cv[1]*T4)/(cv[0]+cv[1]*T4) #Adiabatic index of compression
z = 1.3 #Rounding off 'z' value to one decimal.
T5 = (T4*r**(z-1)) #Temperature in K
p5 = (p4*r**g) #Pressure in kg/cm**2
T1 = T5*(pm/p5) #Tmperature in K
T2 = (T1*(1+(s/100)*(r-1))) #Temperature in K
T3 = (T2*((1+(s/100)*(r-1))/r)**(g-1)) #Temperature in K
p3 = (p4*(T3/T4)) #Pressure in kg/cm**2
def f1(T):
return cv[0]+(cv[1]*T)
I1 = quad(f1,T5,T1)[0]
def f2(T):
return (a+(cv[1]*T))
I2 = quad(f2,T1,T2)[0] #I2 answer is given wrong in the textbook
qs = (I1+I2) #Heat supplied per kg of air in kcal/kg
def f3(T):
return a+(cv[1]*T)
qre = quad(f3,T4,T3)[0] #Heat required per kg of air in kcal/kg
nth = ((qs-qre)/qs)*100 #Thermal efficiency in percent
#Output
print 'The tempertautes and pressures at salient points of the cycle are : T1 = %3.0f K \
\np1 = %3.1f kg/cm**2 \
\nT2 = %3.0f K \
\np2 = %3.1f kg/cm**2 \
\nT3 = %3.0f K \
\np3 = %3.1f kg/cm**2 \
\nT4 = %3.0f K \
\np4 = %3.1f kg/cm**2 \
\nT5 = %3.0f K \
\np5 = %3.1f kg/cm**2 \
\nHeat supplied per kg of air is %3.1f kcal/kg \
\nThe thermal efficiency of the cycle is %3.1f percent'%(T1,pm,T2,pm,T3,p3,T4,p4,T5,p5,qs,nth)
#Textbook answers are given wrong
import math
from scipy.integrate import quad
#Input data
r = 14. #Compression ratio
c = 5. #Cut off takes place at 5% of the stroke
p1 = 1. #Pressure at the beginning of compression in kg/cm**2. In texbook, it is given wrong as 10
T1 = 90.+273 #Temperature at the beginning of compression in K
p3 = 50. #Maximum pressure in kg/cm**2
R = 29.3 #Characteristic gas constant in mkg/kg/degree C
cv = [0.171,0.00003] #Cv = 0.171+0.00003T where Cv is Specific heat at constant volume and T is the temperature in K
g1 = 1.4 #Ratio of specific heats
J = 427. #Mechanical equivalent of heat in kg.m/kcal
#Calculations
T2x = (T1*r**(g1-1)) #Temperature in K
def f1(T):
return cv[0]+(cv[1]*T)
I1 = quad(f1,T1,T2x)[0]
Cv = (1/(T2x-T1))*I1 #Mean value of Cv in kJ/kg.K
Cp = (Cv+(R/J)) #Mean value of Cp in kJ/kg.K
g = 1.35 #(Cp/Cv) value and rounded off to 2 decimal places for calculation purpose. Ratio of specific heats
T2 = (T1*r**(g-1)) #Temperature in K
I2 = quad(f1,T1,T2)[0]
CV = (1/(T2-T1))*I2 #Maen value of Cv in kJ/kg.K
CP = (Cv+(R/J)) #Mean value of Cp in kJ/kg.K
g2 = 1.36 #(Cp/Cv) value and rounded off to 2 decimal places for calculation purpose.Ratio of specific heats
T2a = (T1*r**(g2-1)) #Temperature in K
p2 = (p1*r*(T2a/T1)) #Pressure in kg/cm**2
T3 = (T2a*(p3/p2)) #Temperature in K
T4 = (((r-1)*(c/100))+1)*T3 #Temperature in K
g3 = 1.3 #Assuming gamma as 1.3 for process 4-5
T5 = (T4/(r/(((r-1)*(c/100))+1))**(g3-1)) #Temperature in K
cV = cv[0]+(cv[1]/2)*(T5+T4) #Mean value of Cv in kJ/kg.K
cP = cV+(R/J) #Mean value of Cp in kJ/kg.K
g4 = (cP/cV) #Ratio of specific heats
T5a = (T4/(r/(((r-1)*(c/100))+1))**(g4-1))
I3 = quad(f1,T2a,T3)[0]
def f2(T):
return cv[0]+(R/J)+(cv[1]*T)
I4 = quad(f2,T3,T4)[0] #Textbook answer is wrong
q = I3+I4 #Heat supplied per kg of working substance in kcal/kg
#Output
print 'a) Temperatures at all the points of the cycle are: \
\nT1 = %i K T2 = %3.0f K T3 = %3.0f K T4 = %3.0f K T5 = %i K \
\nb) heat supplied per kg of the working substance is %3.1f kcal/kg'%(T1,T2a,T3,T4,T5a,q)
#Textbook answer is wrong
import math
#Input data
r = 20. #Compression ratio
c = 5. #Cut off at 5%
dc = 1. #Specific heat at constant volume increases by 1%
Cv = 0.171 #pecific heat at constant volume in kJ/kg.K
R = 29.3 #Characteristic gas constant in mkg/kg/degree C
k = 1.95 #k can be obtained from relation de/e = -dcv/cv*(1-e/e)*(g-1)*((1/g)+ln(r)-(k**g*lnk)/(k**g-1))
J = 427. #Mechanical equivalent of heat in kg.m/kcal
#Calculations
g = (R/(J*Cv))+1 #Ratio of specific heats
e = (1-((1/g)*(1/r**(g-1))*((k**g-1)/(k-1)))) #Air standard efficiency of the cycle
dee = ((-(dc/100)*((1-e)/e)*(g-1)*((1/g)+math.log(r)-((k**g*math.log(k))/(k**g-1))))*100) #Change in efficiency due to 1% change in cv
#Output
print 'Percentage change in air standard efficiency is %3.3f percent This indicates that there is a decrease in efficiency'%(dee)