Project

AIR STANDARD OTTO CYCLE

OBJECTIVE:

The main objective of this challenge is to claculate the unknown pressure and temperature values and plot the graph for otto cycle by using those values

  1. P-V diagram for otto cycle
  2. Efficiency of Otto cycle

OTTO CYCLE:

Otto cycle comprises of four process

Process 1-2 -> Isentropic compression

Process 2-3 -> Constant heat addition

Process 3-4 -> Isentropic expansion

Process 4-1 -> Constant heat rejection

GIVEN INPUT DATA:

p1 = 101325 pa

bore = 0.1m

stroke = 0.1m

con_rod = 0.15m

cr =12

gamma = Isentropic index = 1.4

t1 =500

v_s = π/4 * bore^2*stroke

v_c = v_s / (cr-1)

t3 = 2300

CODE FOR PLOTTING P-V DIAGRAM FOR OTTO CYCLE:

# building your otto cycle simulator
import matplotlib.pyplot as plt
import math
#state 1
p1 = 101325
T1 = 500
r = 12
gamma = 1.4
bore = 0.1
stroke = 0.1
con_rod = 0.15
V_s = (math.pi/4)*pow(bore,2)*stroke
V_c = V_s/(r-1)
V1 = V_s+V_c
#state 2
V2 = V_c
p2 = p1*pow(r,gamma)
rhs = p1*V1/T1
T2 = p2*V2/rhs
#state 3
V3 = V2
T3 = 2300
p3 = rhs*T3/V3
#state 4
V4 = V1
p4 = p3/pow(r,gamma)
T4 = p4*V4/rhs
volume = [V1,V2,V3,V4,V1]
pressure = [p1,p2,p3,p4,p1]
plt.figure()
plt.plot(volume,pressure)
plt.xlabel(\'volume\')
plt.ylabel(\'presuure\')
plt.show()
efficiency = (1-1/pow(r,gamma-1))*100
print(efficiency)

COMMANDS USED IN THE ABOVE CODE:

matplotlib -> matplotlib is an amazing visualization library in python for 2D plots of arrays.This command is used to plot graphs using the code
append() -> This function adds an element to a list so to assign elements to empty array we use this command
plt.figure() -> This function is used to display the multiple graphs at a time side by side to compare results
plt.plot() -> This function is used to draw graphs according to their assigned values
plt.label() -> This function is used to label the axis to differentiate the values on the curves
plt.show() -> This function is used to display the results graphs on the screen as output
plt.savefig() -> This function is used to save the output images in particular folder
plt.lim() -> This function is used to set the limits of rotation of arm and manipulator
math -> This library is uesd when we use the trigonometric functions

pow() -> This function is used to calculate the power of any number

print() -> This function is used to print the ouput of the code

OUTPUT:

IDEAL OTTO CYCLE

62.98928275128466
[Finished in 2.3s]

CODE FOR P-V DIAGRAM FOR OTTO CYCLE FOR VARIABLE VALUES OF CRANK ANGLE:

# engine kinematics
import matplotlib.pyplot as plt
import math

bore = 0.1
stroke = 0.1
con_rod = 0.15
cr =12
gamma = 1.4

def engine_kinematics(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 = 50
	v =[]
	dtheta = (ec-sc)/(num_values-1)
	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


#state 1
p1 = 101325
T1 = 500
v_s = (math.pi/4)*pow(bore,2)*stroke
v_c = v_s/(cr-1)
v1 = v_s+v_c
#state 2
v2 = v_c
p2 = p1*pow(cr,gamma)
rhs = p1*v1/T1
T2 = p2*v2/rhs

v_compression= engine_kinematics(180,0)
constant = p1*pow(v1,gamma)
p_compression = []
for v in v_compression:
	p_compression.append(constant/pow(v,gamma))

#state 3
v3 = v2
T3 = 2300
p3 = rhs*T3/v3
v_expansion= engine_kinematics(0,180)
constant = p3*pow(v3,gamma)
p_expansion = []
for v in v_expansion:
	p_expansion.append(constant/pow(v,gamma))
#state 4
v4 = v1
p4 = p3/pow(cr,gamma)
T4 = p4*v4/rhs

volume = [v1,v2,v3,v4,v1]
pressure = [p1,p2,p3,p4,p1]
plt.figure()
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(\'presuure\')
plt.show()
efficiency = (1-1/pow(cr,gamma-1))*100
print(efficiency)

COMMANDS USED IN THE ABOVE CODE:

matplotlib -> matplotlib is an amazing visualization library in python for 2D plots of arrays.This command is used to plot graphs using the code
append() -> This function adds an element to a list so to assign elements to empty array we use this command
plt.figure() -> This function is used to display the multiple graphs at a time side by side to compare results
plt.plot() -> This function is used to draw graphs according to their assigned values
plt.label() -> This function is used to label the axis to differentiate the values on the curves
plt.show() -> This function is used to display the results graphs on the screen as output
plt.savefig() -> This function is used to save the output images in particular folder
plt.lim() -> This function is used to set the limits of rotation of arm and manipulator
math -> This library is uesd when we use the trigonometric functions

pow() -> This function is used to calculate the power of any number

def -> This is function that calls for all the values assigned in the function

return -> This function is used to return the values by ending the execution of function call

OUTPUT:

ACTUAL OTTO CYCLE

62.98928275128466
[Finished in 2.3s]

CONCLUSION:

  • Calculation of all unknown values at 4 states is completed
  • Plotting of P-V diagram for otto cycle is completed
  • calculation of thermal efficiency is also completed
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.