Project

Otto Cycle

import math
import matplotlib.pyplot as plt

def engine_kinematics( bore, stroke , con_rod , cr , start_crank , end_crank) :
	a = stroke/2
	R = con_rod/a
	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
p1 = 101325
t1 = 303
t3 = 2300

# Geometric Parameters

bore = 0.08
stroke = 0.11
con_rod = 0.15
cr = 12
gamma = 1.4

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

print( \"Efficiency =  \",eff ,sep=\"\" )

v_s = (math.pi/4)*pow(bore,2)*stroke
v_c = v_s/(cr - 1)


# State 1 
v1 = v_c+v_s
# State 2
v2 = v_c

p2 = p1*pow(v1,gamma)/pow(v2,gamma)

t2 = (p2*v2*t1)/(p1*v1)
V_comp = engine_kinematics(bore,stroke,con_rod,cr,180,0)
const = p1*pow(v1,gamma)

P_comp = []

for v in V_comp:
	P_comp.append(const/pow(v,gamma))
# State 3
v3=v2

p3 = (p2*v2*t3)/(t2*v3)

V_exp = engine_kinematics(bore,stroke,con_rod,cr,0,180)
const = p3*pow(v3,gamma)

P_exp = []

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

#State 4

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

t2 = (p4*v4*t3)/(p3*v3)





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

Report:

Step 1 :

Their are four processes of the otto cycle. They are:

1. Isentropic Compression
2. Constant Volume heat addition
3. Isentropic Expansion
4. Constant Volume heat rejection.

Step 2 :

For Air Standard efficiency otto cycle pressure and temperature at state 1 are to be given as p1=101325; t1=303;t3=2300and also input parameters and engine parameters are to be declared as bore = 0.08

stroke = 0.11

con_rod = 0.15

cr = 12

gamma = 1.4

efficiency of otto cycle is calculated as

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

print( \"Efficiency = \",eff ,sep=\"\" )

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

v_c = v_s/(cr - 1)

Step 3 :

Swept volume and clearance volume are to be calculated and they can be calculated by v_s=(pi/4)*bore^2*stroke; v_c=v_s/(r-1); . Volume at state 1 and state 2 are calculated by v1=v_s+v_c;v2=v_c;

Step 4 :

Pressure and Temperature at state 2 can be calculated by p2 = p1*cr^gamma; t2= (p2*v2*t1)/(p1*v1); and Volume of compression and pressure are calculated as

v2 = v_c

p2 = p1*pow(v1,gamma)/pow(v2,gamma)

t2 = (p2*v2*t1)/(p1*v1)

V_comp = engine_kinematics(bore,stroke,con_rod,cr,180,0)

const = p1*pow(v1,gamma)

P_comp = []

for v in V_comp:

P_comp.append(const/pow(v,gamma))Step 5: Similary at state 3 are to be calculated by

v3=v2

p3 = (p2*v2*t3)/(t2*v3)

V_exp = engine_kinematics(bore,stroke,con_rod,cr,0,180)

const = p3*pow(v3,gamma)

P_exp = []

for v in V_exp:

P_exp.append(const/pow(v,gamma))

the function engine_kinematics(bore,stroke,con_rod,cr,0,180) is calculated because in piston volume does not change linearly but as a function which is defined first in the program

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

a = stroke/2

R = con_rod/a

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

Step 6 :

State variables at 4 are to be calculated as

v4= v1

p4 = p3*pow(v3,gamma)/pow(v4,gamma)

t2 = (p4*v4*t3)/(p3*v3)

Step 7 :

Now plot graph PV diagram as

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\')

plt.ylabel(\'Pressure\')

plt.show()

\"Plot\"

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.