Challenge

Week 2 Air standard Cycle

Aim:

The aim is to solve the otto cycle, and get pv diagram and thermal efficiency.

Procedure:

The different type of processes in Otto cycle:

1. Adiabatic compression (1-2)- air and fuel mixture is compressed isentropically inside the cylinder.

2. Constant volume heat addition (2-3)- combustion take place inside the cylinder due to external source.

3. Adiabatic expansion (3 - 4) - high pressure and high temperature gases expand isentropically inside the cylinder.

4. Constant volume heat rejection (4 - 1) gases come out from the cylinder and cycle is completed.

The code is executed,

import math

import matplotlib.pyplot as plt

def engine_kinematics (bore, stroke, connecting rod,c_r,start_crank_angle, end_crank_angle):

# Engine geometry properties

r = stroke / 2

n=connecting_rod/r

# Volume parameters

v_swept=(math.pi/4) * pow(bore,2) * stroke

v_clearance=v_swept/(c_r-1)

theta_startcrank=math.radians(start_crank_angle)

theta_endcrank=math.radians(end_crank_angle)

num_val = 100

dtheta = (theta_endcrank - theta_startcrank)/(num_val - 1)

v = []

for i in range(0,num_val):

	theta=theta_startcrank+i* dtheta

	term_1 = 0.5*(c_r - 1)

	term_2=n+1-math.cos(theta)

	term_3=(pow(n,2)-pow(math.sin(theta),2))

	term_3=pow(term_3,0.5) 

	V.append((1+term_1 * (term_2 - term_3)) * v_clearance )
	
	return V




import math

import matplotlib.pyplot as plt


p1 = 101325

t1 = 500

gamma = 1.4

t3 = 2300

#engine_kinematics parameters

bore = 0.1
stroke = 0.1

con_rod=0.15

cr = 12

# volume computation

v_s=(math.pi/4)* pow(bore,2)* stroke

v_c=v_s/(cr-1)

v1=v_c+v_s

# state point 2

v2=v_c

# p2v2^gamma=p1v1^gamma

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,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|rhs=p2v2/t2|p3=rhs* t3/v3

rhs=p2*v2/t2

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)

#rhs = p4v4/t4

t4=p4 * v4/rhs

# thermal efficiency

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

print (n_otto)

plt.plot([v2,v3],[p2,p3])
plt.plot([v4,v1], [p4,p1])
plt.plot(V_compression, P_compression, label='Adiabatic compression')
plt.plot( [v2,v3] , [p2,p3], label='Constant volume heat addition') 
plt.plot(V_expansion,P_expansion, label='Adiabatic expansion') 
plt.plot([v4,v1], [p4,p1] label='Constant volume heat rejection') 
plt.xlabel('volume') 
plt.ylabel('pressure') 
plt.legend() 
plt.show()

Result :

Thus the code is run successfully and the result has been submitted.

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.