Air standard cycle using python
Air standard Cycle using python
INTRODUCTION:
Air standard cycles are quite important as they help us to understand the theoretical limits of a particular cycle ,which can be used to get an idea about the performance of IC engine.
An otto cycle consist of following processes:
1.Isentropic Compression process(1-2)
2.Constant Volume heat addition(2-3)
3.Isentropic Expansion process (3-4)
4.Constant Volume heat rejection(4-1)
In a otto cycle compression ratio is a crucial parameter.
Formulas used :
Swept Volume= pi/4*bore^2*stroke
Clearance volume= Swept volume/cr-1
Pressure*volume^gamma=constant
pressure*volume/temperature= constant
efficiency=(1-(1/cr)^(gamma-1))*10
program to solve an otto cycle and make plots for it.
# OTTO cycle simulator
import math
import matplotlib.pyplot as plot
def enginekine(bore,stroke,conrod,cr,start_crankangle,end_crankangle):
#input engine parameters
a=stroke/2
R=conrod/a
#defining angles
sc=math.radians(start_crankangle)
ec=math.radians(end_crankangle)
numvalues=100
dtheta=(ec-sc)/(numvalues-1)
vs=(math.pi/4)*pow(bore,2)*stroke
vc=vs/(cr-1)
V=[]
#tracing the volume curve
for i in range(0,numvalues):
theta=sc+i*dtheta
term1=0.5*(cr-1)
term2= R+1-math.cos(theta)
term3=pow(pow(R,2)-pow(math.sin(theta),2),0.5)
V.append((1+term1*(term2-term3))*vc)
return V
#point 1
p1=101325
t1=500
gamma=1.4
t3=2500
bore=0.1
stroke=0.1
conrod=0.15
cr=10
vs=(math.pi/4)*pow(bore,2)*stroke
vc=vs/(cr-1)
v1=vc+vs
#point 2
v2=vc
p2=p1*pow(v1/v2,gamma)
#p2v2/t2=p1v1/t1 rearranging
t2=p2*v2*t1/(p1*v1)
Vcompress=enginekine(bore,stroke,conrod,cr,180,0)
constant=p1*pow(v1,gamma)
pcomress=[]
#point 3
for v in Vcompress:
pcomress.append(constant/pow(v,gamma))
v3=v2
#p3v3/t3=p2v2/t2
p3=p2*v2*t3/(v3*t2)
Vexpand=enginekine(bore,stroke,conrod,cr,0,180)
constant=p3*pow(v3,gamma)
pexpand=[]
#point 4
for v in Vexpand:
pexpand.append(constant/pow(v,gamma))
v4=v1
p4=p3*pow(v3/v4,gamma)
t4=p4*v4*t3/(p3*v3)
#plotting the pv diagram
plot.plot([v2,v3],[p2,p3])
plot.plot(Vcompress,pcomress)
plot.plot(Vexpand,pexpand)
plot.plot([v4,v1],[p4,p1])
plot.show()
#Thermal efficiency
n = 1-(pow(cr,(1-gamma)))
print(n)
STEPWISE EXPLANATION OF CODE:
Step 1: importing libraries
Step 2:Defining thermodyanamic properties.
Step 3:Defining engine geometroc parameters.
Step 4:Pressure & Temperature at state 1.
Step 5:calculating swept volume and clearance volume.
Step 6:calculating themodynamic propert at state 1.
Step 7:Calling the function to determine various points between state1 & 2
Step 8:calculating properties at state 2.
Step 9: Properties at third state 3.
Step 10:Calling the function to determine various points between state3 & 4.
Step 11:Properties at state 4.
Step 12:Plotting the points and lines.
Step 13:calculating thermal efficiency.
then writing a fuction as shown below fuction and then using it in main program and calcute and plot the pv diagram.
RESULT:
Hence efficiency of otto cycle is 60.18%