Challenge

Week 2 Air standard Cycle

OBJECTIVE:

Plot PV diagram for otto cycle and calculate thermal efficieny for engine.

CODING:

import math
import matplotlib.pyplot as plt


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

	#input parameter

	crank_radius=stroke/2	#crank radius
	R=con_rod/crank_radius		#constant
	
	sc=math.radians(start_crank)
	ec=math.radians(end_crank)
	num_value=100
	dtheta=(ec-sc)/(num_value-1)
	v=[]

	for i in range(0,num_value):
		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))*v_c)
	return(v)
	


#inputs
p1=181325	#pressure (pascal)
t1=500	#temperature (kelvin)
gamma=1.4
t3=2300

#geometrical parameter
bore=0.1	#bore dia(m)
stroke=0.1	#stroke length(m)
con_rod=0.15	# connecting rod(m)
cr=12	#compression ratio

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

#state point 2
v2=v_c

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

#p1v1/t1=p2v2/t2	|p1v1/t1=p2v2/t2=rhs
rhs=p1*v1/t1
t2=p2*v2/rhs
v_compression=engine_kinematics(bore,stroke,con_rod,cr,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

#p3v3/t3=p2v2/t2	|p3v3/t3=p2v2/t2=rhs
p3=rhs*t3/v3

v_expansion=engine_kinematics(bore,stroke,con_rod,cr,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

#p4v4^gamma=p3v3^gamma
p4=p3*pow(v3,gamma)/pow(v4,gamma)

#p3v3/t3=p4v4/t4	|p3v3/t3=p4v4/t4=rhs
t4=p4*v4/rhs



v=engine_kinematics(bore,stroke,con_rod,cr,180,0)
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.title('PV PLOT')
plt.savefig('1')
plt.show()


#Efficiency of otto cycle
#Formula: 1-(1/cr^(gamma-1))

efficiency=(1-(1/pow(cr,(gamma-1))))*100
print(efficiency)

RESULT:

PV plot for otto cycle:

In above plot approx value of pressure and volume at point 1=(v1,p1) =(0.0009,181325).

Process from point 1 to 2 is isentropic.At this process volume and pressure at different point calculate by below formula.

Approx value of pressure and volume at point 2 from graph=(v2,p2) =(0.0001,0.6 x e^7).

Process from point 2 to 3 is constant volume.

Approx value of pressure and volume at point 3 from graph=(v3,p3) =(0.0001,1 x e^7).

Process from point 3 to 4 is isentropic.

Approx value of pressure and volume at point 4 from graph=(v4,p4) =(0.0009,0.19 x e^7).

Process from point 4 to 1 is constant volume.

Efficiency of engine = 1- (1/(cr^(gamma-1)) = 62.98%

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.