Project

Efficiency And P-V diagram For Air standard Otto cycle

To plot the P-V Diagram and to find the Efficiency for Air standard Otto Cycle By using python.

Air Standard Otto Cycle -:

Otto cycle is also called the constant volume cycle as the heat addition and heat rejection is done at a constant volume. Otto cycle is used in petrol and many other gas engines.

It consists of two reversible constant volume processes and two adiabatic processes.

Efficiency of Otto cycle is given as,

η = 1 - 1/r^(γ-1).

In order to plot the P-V diagram we need to find the parametres like Temperature, Pressure, Volume associated at the points in the processes.

For showing the correct plot we need kinematics of engine concept. And by using the formula,

(v/v_c )= 1+0.5(r-1)[R+1-cos(theta)-(R^2 - sin^2(theta))^0.5] ,

we will be able to show the P-V diagram at different crank angle positons.

\"\"\"
OTTO CYCLE SIMULATOR
\"\"\"
import math
import matplotlib.pyplot as plt

def engine_kinematics(bore_dia,stroke_length,con_rod,r,start_crank,end_crank):
	\"\"\"
       Engine kinematics
    \"\"\"

	# (v/v_c )= 1+0.5(r-1)[R+1-cos(theta)-(R^2 - sin^2(theta))^0.5]
	# Geometric parameters
	a = stroke_length/2 # crank-pin Radius
	R = con_rod/a

	# volume computation
	v_s = (math.pi/4)*pow(bore_dia,2)*stroke_length # Swept volume
	v_c = v_s/(r-1) # Clearance volume

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

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

	for i in range(0,num_values):
		theta = sc+i*d_theta
		term1 = 0.5*(r-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 = 10^5 # pressure at point 1 in pascal
t1 = 500 # temperature at point1 in kelvin
t3 = 2000 # temperature at point 3 in kelvin
gamma = 1.4 

# Geometric Parameters
bore_dia = 0.1 # Metres
stroke_length = 0.1 # in Metres
con_rod = 0.15 # in Metres
r = 8 # Compression Ratio

# Volume Computation
v_s = (math.pi/4)*pow(bore_dia,2)*stroke_length # Swept volume
v_c = v_s/(r-1) # Clearance volume
v1 = v_s+v_c 

# At process 1-2 (Adiabatic Compression Process)
# p2v2^gamma = p1v1^gamma 
v2 = v_c
p2 = p1*pow(v1,gamma)/pow(v2,gamma)

# p2v2/t2 = p1v1/t1 | rhs = p1v1/t1 | t2 = p2v2/rhs
rhs = p1*v1/t1
t2 = p2*v2/rhs
V_compression = engine_kinematics(bore_dia, stroke_length,con_rod,r,180,0)

constant = p1*pow(v1,gamma)

P_compression = []

for v in V_compression:
	P_compression.append(constant/pow(v,gamma))


# At process 2-3 (Constant Volume Heat addition)
v3 = v2 
# p3v3/t3 = p2v2/t2 | rhs = p2v2/t2 | p3 = rhs*t3/v3
rhs = p2*v2/t2
p3 = rhs*t3/v3

V_expansion = engine_kinematics(bore_dia, stroke_length,con_rod,r,0,180)

constant = p3*pow(v3,gamma)

P_expansion = []

for v in V_expansion:
	P_expansion.append(constant/pow(v,gamma))

# At process 3-4 (Adiabatic expansion)
# p4v4^gamma = p3v3^gamma 
# p4v4/t4 = p3v3/t3 | rhs = p3v3/t3 |t4 = p4v4/rhs

v4 = v1
p4 = p3*pow(v3,gamma)/pow(v4,gamma)
rhs = p3*v3/t3
t4 = p4*v4/rhs


# Efficiency of the otto cycle
eta = 1-(1/r)**(gamma-1)
print(eta)

# P-v diagram
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\')
plt.ylabel(\'Pressure\')
plt.show()


EFFICIENCY :- 56.5%

P-V Diagram :-

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.