Challenge

Week 2 Air standard Cycle

AIM :-To create a program using python to calculate and print the thermal efficiency of otto cycle engine and to plot the p-v diagram of the same.

FORMULA:- 1) Thermal efficiency (`eta`) = 1-(r_c)^(1-`gamma`)

where, r_c= compression ratio

2) pv^(`gamma`) = constant

where, p and v are the pressure and volume of isentropic process

3)total volume = v_c +v_s

where, v_c =clearance volume

v_s = stroke volume

PRINCIPLE:- A typical otto cycle consist of four process,

1) isentropic compression

2) heat addition at constant volume

3) isentropic expansion

4) heat rejection at constant volume

import math
import matplotlib.pyplot as plt
def engine_kinamatics(d,l,c_l,r_c,start_crank,end_crank):
	#crank pin radius
	a=l/2
	R=c_l/a
	v_s=math.pi/4 *pow(d,2)*l
	v_c=v_s/(r_c-1)
	sc=math.radians(start_crank)
	ec=math.radians(end_crank)
	n=50
	dtheta=(ec-sc)/(n-1)
	v=[]
	for i in range(0,n):
		theta=sc+i*dtheta
		t1=0.5*(r_c-1)
		t2=R+1-math.cos(theta)
		t3=pow(pow(R,2)-pow(math.sin(theta),2),0.5)
		v.append((1+t1*(t2-t3))*v_c)

	return v


#inputs
t1=500
p1=101325
r_c=12
gamma =1.4
t3=2300

#geometric_dimensions
d=0.1
l=0.1
c_l=0.15
r_c=12

v_s=math.pi/4 *pow(d,2)*l
v_c=v_s/(r_c-1)
v1=v_c+v_s

#state point 2
v2=v_c
p2=p1*pow(r_c,gamma)
t2=t1*pow(r_c,(gamma-1))
v_compression=engine_kinamatics(d,l,c_l,r_c,180,0)
constant=p1*pow(v1,gamma)
p_compression=[]
	
for v in v_compression:
	p_compression.append(constant/pow(v,gamma))

#state point 3
v3=v2
rhs=(p2*v2)/t2
p3=rhs*(t3/v3)
v_expansion=engine_kinamatics(d,l,c_l,r_c,0,180)
constant=p3*pow(v3,gamma)
p_expansion=[]
for v in v_expansion:
 	p_expansion.append(constant/pow(v,gamma))

#state point 4
v4=v1
p4=p3/pow(r_c,gamma)
t4=(p4*v4)/rhs

#thermal efficiency
E=1-pow(r_c,(1-gamma))
print(E)
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.plot()
plt.show()   

RESULT:

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.