Project

Otto Cycle Graphical Illustration using python

Objective

To plot the Otto Cycle.

Description

The Otto cycle is a set of processes used by spark-ignition internal combustion engines (2-stroke or 4-stroke cycles). These engines ingest a mixture of fuel and air, compress it, cause it to react, thus effectively adding heat through converting chemical energy into thermal energy, expand the combustion products, and then eject the combustion products and replace them with a new charge of fuel and air. The different processes are:

  • Reversible adiabatic compression (the governing equation is P*Vϒ=Constant)
  • Constant Volume Heat Addition (the governing equation is P/T=Constant)
  • Reversible adiabatic compression (the governing equation is P*Vϒ=Constant)
  • Constant Volume Heat rejection (the governing equation is P/T=Constant)

Geometrical parameters considered:

Bore, d=0.09

Stroke, l=0.09

Conn_rod, CR=0.145

Compression ratio, Rc=9.2

Inputs considered for Cycle:

Initial Temperature in the cycle, T1=357°K

Initial Pressure in the cycle, P1=101325 Pa

Peak Temperature in the cycle, T3=1769°K

Gamma, ϒ=1.4

Equation used

Vswept=π/4*d2*l (1)

Vclearance= Vswept /( Rc -1) (2)

Crank pin radius, a=stroke/2 (3)

R=CR/a (4)

V/Vclearance =1+0.5*(Rc -1)*[R+1-cosθ – (R2-sin2θ)0.5] (5)

ηth=1-(1/Rc (y-1)) (6)

Procedure

  • P, V, T values are calculated at different states using the governing equations.
  • Volume is calculated during compression and expansion processes using eq.5.
  • Thermal efficiency is calculated using eq.6.

Code

# code for plotting otto cycle
import matplotlib.pyplot as plt
import math

def Engine_kinematics (bore, stroke, v_clearance, conn_rod, cr, start_ang, end_ang):
	# crank pin radius, a
	a=stroke/2
	R=conn_rod/a
	n=20
	#swept volume calculation
	v_swept=(math.pi/4)*pow(bore, 2)*stroke
	#clearance volume calculation
	v_clearance=v_swept/(cr-1)

	V=[]
	thetha=[]
	s_c=math.radians(start_ang)
	e_c=math.radians(end_ang)
	dtheta=(s_c-e_c)/(n-1)

	for i in range(0, n):
		thetha= s_c+(i*dtheta)
		term1= 0.5*(cr-1)
		term2=R+(1-math.cos(thetha))
		term3=pow(((pow(R, 2))-pow(math.sin(thetha), 2)), 0.5)
		V.append((1+term1*(term2-term3))*v_clearance)
	return V		
	

# inputs (temperature will be in kelvin, pressure in N/m^2, Volume in m^3)
t1=357
p1=101325
t3=1769
gamma=1.4

# geometrical parameter of Engine
bore=0.09
stroke=0.09
conn_rod=0.145
cr=9.2

#clearance volume and swept volume calculation
#swept volume calculation
v_swept=(math.pi/4)*pow(bore, 2)*stroke
#clearance volume calculation
v_clearance=v_swept/(cr-1)

#parammeter at state 1
v1=v_swept+v_clearance
t1=357
p1=101325

# parameters at state 2, here constant used will be p1v1^gamma
con1=p1*pow(v1,gamma)
v2=v_clearance
p2=con1/pow(v2,gamma)
t2=t1*pow(v1/v2, (gamma-1))
V_compression=[]
V_compression = Engine_kinematics (bore, stroke, v_clearance, conn_rod, cr, 180, 0)
P_compression=[]
for v in V_compression:
	P_compression.append(con1/pow(v, gamma))
#print(P_compression)

#print(V_compression,v1,v2)

# parameters at state 3, here constant will be p2/t2 
v3=v2
con2=p2/t2
p3=t3*con2
con2=p3*pow(v3, gamma)
V_expansion=[]
V_expansion = Engine_kinematics (bore, stroke, v_clearance, conn_rod, cr, 180,0)
P_expansion=[]
for v in V_expansion:
	P_expansion.append(con2/pow(v,gamma))

print(P_expansion)

# parameter at state 4, here constant will be p3v3^gamma
v4=v1
con3=p3*pow(v3, gamma)
p4=con3/pow(v4, gamma)
t4=t3*pow(v3/v4, (gamma-1))

# v4=Engine_kinematics (bore, stroke, v_clearance, conn_rod, cr, 0, 180)
plt.plot([v2,v3], [p2,p3])
plt.plot(V_compression, P_compression)
plt.plot(V_expansion, P_expansion)
plt.plot([v4,v1], [p4,p1])
plt.xlabel(\'Volume (m^3)\')
plt.ylabel(\'Pressure (N/m^2)\')
plt.show()

# calculating thermal efficiency of Otto Cycle
th=1-(1/pow(cr, (gamma-1)))
print(f\'Thermal efficiency is {th}\')

Plot

\"Otto_cycle\"

Conclusion

The thermal efficiency of the Otto Cycle is 58.9 %.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.