Week 2 Air standard Cycle
Air standard cycle using Python programming
AIM: Program to solve the otto cycle, plot P-V diagram and calculate efficiency of the cycle.
Theory:
The Otto cycle is the name for the cycle used in spark-ignition IC Engine such as gasoline/petrol. Its theoretical efficiency depends on the compression ratio cr of the engine and the specific heat ratio γ of the gas in the combustion chamber.
Thus, the efficiency increases with the compression ratio. However, the compression ratio of Otto cycle engines is limited by the need to prevent the uncontrolled combustion known as knocking. Modern engines have compression ratios in the range 8 to 11, resulting in ideal cycle efficiencies of 56% to 61%.
Processes involved in the cycle:
- Intake Stroke(0-1)
- Compression Stroke(1-2)
- Ignition Phase(2-3)
- Expansion Stroke(3-4)
- Heat Rejection(4-1)
- Exhaust Stroke(1-0)
Governing Equation:
θη=1−1rcγ−1= crank angle
R= connecting rod length
cr = compression ratio
Thermal Efficiency:
Assumptions are taken:
The initial pressure P1 and temperature T1 is assumed to be 101325 pascals and 500 kelvin.
The maximum temperature inside the engine cylinder. T3 is assumed to be 2300 kelvin.
Python Program for Function:
""" Engine Kinematics Function """
import math
import numpy as np
def engine(sa,ea):
bore=0.1
stroke=0.1
con_rod=.15
cr=12
vs=math.pi/4*bore*bore*stroke
vc=vs/(cr+1)
r=con_rod/(bore/2)
t=np.linspace(sa,ea,100,endpoint=True)
vol=[]
for a in t:
t1=0.5*(cr-1)
t2=r+1-(math.cos(a))
t3=math.sqrt(r*r-pow(math.sin(a),2))
term=1+t1*(t2-t3)
v=vc*(term)
vol.append(v)
return(vol)
Python Main Program:
""" Program to plot P-V diagram of otto Cycle and find efficiency """
# Author : Asad Salah
#importing Required modules
import matplotlib.pyplot as plt
import math
import numpy as np
#importing module engine
import engine
#inputs
p1=101325
t1=500
gama=1.4
t3=2300
#geometric parameters
#clearence and swept volume
bore=0.1
stroke=0.1
con_rod=.15
cr=12
vs=math.pi/4*bore*bore*stroke
vc=vs/(cr+1)
v1=vs+vc
#point 2
v2=vc
#p1*v1^gama=p2*v2^gama=g
p2=p1*pow(v1,gama)/pow(v2,gama)
#p*v/t=const=nr
nr=p1*v1/t1
t2=p2*v2/nr
vol=engine.engine(0,math.pi)
vol.append(v1)
pr=[]
for a in vol:
p=p1*pow(v1,gama)/pow(a,gama)
pr.append(p)
#point3
v3=v2
p3=t3*nr/v3
#point4
v4=v1
p4=p3*math.pow(v3,gama)/math.pow(v4,gama)
t4=nr/(p4*v4)
vol2=[]
vol3=engine.engine(math.pi,0)
vol2.append(v1)
vol2=vol2+vol3
pr2=[]
for a in vol2:
p=p3*pow(v3,gama)/pow(a,gama)
pr2.append(p)
#plotting
plt.plot([v1,v2,v3,v4],[p1,p2,p3,p4],'*')
plt.plot([v1,v4],[p1,p4])
plt.plot([v2,v3],[p2,p3])
plt.plot(vol,pr)
plt.plot(vol2,pr2)
plt.ylabel('Pressure[Pa]')
plt.xlabel('Volume[m^3]')
plt.title('P-V Diagram of otto cycle')
plt.show()
plt.savefig("P-V.png")
#calculating efficiency
n=(1-(t1/t2))*100
print ("Efficiency of the cycle=",n,"%")
Output:
The efficiency of the Cycle: