Project

AIR STANDARD CYCLE USING PYTHON

AIM

To write code to solve the Otto cycle and make plots on its pressure and velocity and find the thermal efficiency of the Otto cycle

AIR STANDARD CYCLE

The internal combustion engines are considered to be working on the principles of air standard cycle

The two most commonly used air standard cycles are otto cycle* and diesel cycle. There are four processes in the Otto cycle

  • Process 1-2: Isentropic compression
  • Process 2-3: Constant volume of heat addition
  • Process 3-4: Isentropic expansion
  • Process 4-1: Constant volume of heat rejection

PROGRAM TO SOLVE THE OTTO CYCLE

import math
import matplotlib.pyplot as plt 

#engine parameters

def engine_kinematics(bore,stroke,connecting_rod,cr,start_crank,end_crank):
	a = stroke/2
	R = connecting_rod/a

	num_values = 50
	s_c = math.radians(start_crank)
	e_c = math.radians(end_crank)
	V =[]

	dtheta = (e_c-s_c)/(num_values-1)
	for i in range(0, num_values):
		theta = s_c+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





	
bore = 0.1
stroke =0.1
connecting_rod = 0.15
cr = 8
gamma = 1.4

#state 1
p1 = 10
t1 = 300
t3 = 2000
v_s = (math.pi/4)*pow(bore,2)*stroke
v_c = v_s/(cr-1)
v1 = v_s+v_c
v2 = v_c

#calculating p2,t2
p2 = p1*(pow(v1,gamma)/pow(v2,gamma))
t2 = t1*(pow(v1,(gamma-1))/pow(v2,(gamma-1)))

V_compression=engine_kinematics(bore,stroke,connecting_rod,cr,180,0)
constant_c =p1*pow(v1,gamma)
P_compression=[]
for v in V_compression:
	P_compression.append(constant_c/pow(v,gamma))

#calculating state 3
v3=v2
p3 =p2*(t3/t2)
V_expansion=engine_kinematics(bore,stroke,connecting_rod,cr,0,180)
constant_e =p3*pow(v3,gamma)
P_expansion =[]
for v in V_expansion:
	P_expansion.append(constant_e/pow(v,gamma))
#calculating state 4
v4 = v1
p4 = p3*(pow(v3,gamma)/pow(v4,gamma))
t4 = t3*(pow(v3,(gamma-1))/pow(v4,(gamma-1)))
plt.plot([v2,v3],[p2,p3])
plt.plot([v4,v1],[p4,p1])
plt.plot(V_compression,P_compression)
plt.plot(V_expansion,P_expansion)
plt.show()
	
	
V=engine_kinematics(bore,stroke,connecting_rod,cr,180,0)
print(V)

#efficiency
otto_efficiency = 1-1/(pow(cr,(gamma-1)))
print(otto_efficiency)

EXPLANATION

  • There are four state points in the Otto cycle. We have to calculate the pressure, temperature, and volume of each state.
  • The engine parameters are given as

Bore diameter = 0.1

Stroke = 0.1

Compression ratio = 8

Connecting rod = 0.15

Gamma = 1.4

  • Initially the state1 values are assumed as P1 = 10 bar,T1 = 300 K,T3 = 2000K
  • Calculate the swept volume and clearance volume using the formulae
  • The volume of the state2 will be equal to the clearance volume.
  • As the 2-3 process is a constant volume process v2 = v3
  • Then calculate all the parameters in the state3
  • Using the parameters of the third state find the values of the fourth state
  • During the 1-2 and 3-4 processes, the plot should not be linear it should be a curve
  • So a function is created to calculate the values in the process
  • The function will be calculated based on the parameters like bore diameter, connecting rod, compression ratio, stroke, starting crank angle and ending crank angle
  • The function is used for calculating both the compression and expansion process
  • The thermal efficiency of the Otto cycle is calculated using the formula

PV DIAGRAM

\"\"

RESULT

Thus the program is written to solve the Otto cycle and PV diagram is created and the thermal efficiency of the Otto cycle was calculated.

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.