Week 2 Air standard Cycle
An Otto cycle is an idealized thermodynamic cycle that describes the functioning of a spark ignition engine.
The processes of Otto cycle are
- Process 1–2 is an adiabatic (isentropic) compression.
- Process 2–3 is a constant-volume heat transfer.
- Process 3–4 is an adiabatic (isentropic) expansion (power stroke).
- Process 4–1 completes the cycle by a constant-volume process in which heat is rejected.
the points are shown in the below figure
The below equation is used in the code to trace the volume changes with the help of bore diameter,stroke length ,connecting rod length,compression ratio,start_crankangle and end_crankangle.
Thermal efficiency of the engine is given by
where
- η = thermal efficiency
- r = compression ratio that is 'cr'
- K = the value of gamma that is 1.4 adiabatic process
Program Code
# OTTO cycle simulator
#importing libraries
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=50
dtheta=(ec-sc)/(numvalues-1)
vs=(math.pi/4)*pow(bore,2)*stroke
vc=vs/(cr-1)
V=[]
#loop to trace 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=2300
bore=.1
stroke=.1
conrod=.15
cr=12
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)
PV diagram
Thermal efficiency of the engine = 62.98%