Project

Air Standard Cycle

Objective: The objective of this report is to create a python based Otto Cycle simulator which can create the PV diagram and give the thermal efficiency of the engine as output

Theory: Otto cycle is the set of processes used by the spark ignition engines in which a mixture of fuel and air is inducted into the cylinder and compressed; post this the mixture is ignited by a spark plug and combustion takes place due to which the volume expands within the cylinder owing to the formation of products from the chemical reaction. After this stage the combustion products are expelled from the cylinder and again the intake cycle of the fuel and air starts over.

Program:

The program includes a engine kinematics function which calculates the volume of the cylinder for different positions of the piston or (crank rotation from BDC to TDC and vice versa). the formula used for swept volume as a fuction of crank angle is given below:

The volume returned by the function is used by the main program for calculating the volume for expansion and compression cycle at different crank positions

#  Otto Cycle

import math
import matplotlib.pyplot as plt

def engine_kinematics(bore, stroke, con_rod, cr, start_crank, end_crank):

	#Geometric parameters
	a=stroke/2
	R=con_rod/a

	#Volume Paramters
	V_s = (math.pi/4)*pow(bore,2)*stroke
	V_c = V_s/(cr-1)

	sc = math.radians(start_crank)
	ec = math.radians(end_crank)

	num_values=100


	dtheta=(ec-sc)/(num_values-1)
	V=[]

	for i in range(0,num_values):
	
		theta=sc+i*dtheta
		

		term1 = 0.5*(cr-1)
		term2 = R + 1 - math.cos(theta)
		term3 = pow(R,2)-pow(math.sin(theta),2)
		term3=pow(term3,0.5)
		V.append((1 + term1 * (term2 - term3))* V_c)
		

	return V

#inputs
p1=101325 #Pressure at point 1 in Pa
t1=500	  #Temperature at point 1 in k
gamma=1.4 #gamma = 1.4
t3=2300   #Temperature at point 3 = 2300k

#Geometric paramaters
bore=0.1 # bore of the engine in m^3
stroke=0.1 #stroke length in m
con_rod=0.15 # Length of the connecting rod in m
cr=8 # compression ration= 8

#volmetric computation
v_s=(math.pi/4)*pow(bore,2)*stroke
v_c=v_s/(cr-1)
v1=v_c+v_s

#static point 2
v2=v_c

#p2v2^gamma=p1v1^gamma
p2=p1*pow(v1,gamma)/pow(v2,gamma)

#p2v2/t2=p1v/t1 | t2=p2v2t1/p1v1
t2 = p2*v2/(p1*v1/t1)
V_comp = engine_kinematics(bore, stroke, con_rod, cr, 180, 0)
constant=p1*pow(v1,gamma)
#P_comp*V_comp =constant

P_comp=[]

for v in V_comp:
	P_comp.append(constant/pow(v,gamma))


#static point  3
v3=v2

#p3v3/t3=p2v2/t2
p3=p2*v2*t3/(t2*v3)

V_exp = engine_kinematics(bore, stroke, con_rod, cr, 0, 180)
constant=p3*pow(v3,gamma)
#P_comp*V_comp =constant

P_exp=[]

for v in V_exp:
	P_exp.append(constant/pow(v,gamma))


#static point 4
v4=v1
p4=p3*pow(v3,gamma)/pow(v4,gamma)
t4=p4*v4*t2/(p2*v2)

plt.plot([v2,v3],[p2,p3])
plt.plot(V_comp,P_comp)
plt.plot(V_exp,P_exp)
plt.plot([v4,v1],[p4,p1])
plt.xlabel('Volume (m^3)')
plt.ylabel('Pressure (Pa)')
plt.show()

#Calculating the thermal efficiency of the engine
Eth= (1-((t4-t1)/(t3-t2)))*100
print('The Thermal Efficiency of the Air Standard Cycle is:', Eth, '%')

Results:

Fig: P-V Diagram

Inference: During the compression stroke the piston moves from BDC to TDC, i.e., (1 to 2 ) the air is compressed and adiabetic compression takes place, from the position 2 to 3, isochoric heat addition takes place. During the expansion stroke (3 to 4), the piston moves from TDC to BDC and adiabetic expansion takes place, followed by isochroric heat rejection (process 4 to 1)

Output: The output of the program i.e.,the thermal efficiency of the Otto cycle

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.