Project

Engine Otto cycle P-V diagram

Otto cycle Simulation:

The project deals with the evaluation of a P-V diagram for the engine otto cycle using Python for given input conditions.

Theory:

Thermodynamic Otto cycle is considered to be one of the most commonly used practical cycles. Currently, all IC engines used in your gasoline cars, trucks, motorcycles, constructions machines etc work on the principle of four strokes of the Otto cycle. The four strokes of the Otto cycle or four-stroke engine are suction of fuel, compression of fuel, combustion, and expansion of fuel and exhaust of burnt fuel. The general P-V diagram of an Otto cycle is shown below:

Fig1: General Otto cycle P-V diagram for a particular Compression ratio

The cycles are as follows:

1. Air-fuel intake process 1-2: During this process the inlet valve of the engine is open, the piston moves towards the bottom position inducting air-fuel mixture at constant pressure.

2. Isentropic compression process 2-3: During this process, the inlet and exhaust valves of the engine remain close and the air-fuel mixture, which has been inducted inside the cylinder, is compressed to the minimum volume.

3. Combustion of the mixture at constant volume 3-4: Here, the air-fuel mixture inducted inside the cylinder is combusted by the spark at constant volume; hence these engines are called spark ignition engines. This leads to an increase in temperature and pressure inside the cylinder.

4. Isentropic expansion 4-5: Due to extremely high pressure, the piston is pushed again towards the bottommost position of the cylinder. It is during this process that the actual work is produced from the engine.

5. Constant volume process 5-6: During this process, the exhaust valve opens and all the exhaust gases are ready to be released into the atmosphere. The pressure inside the cylinder falls drastically.

6. Exhaust process 6-1: During this process the exhaust valve is open and the piston moves upwards and removes all the exhaust gases inside the cylinder at constant pressure.

Input conditions:

Bore = 0.10 m

Stroke = 0.1 m

Connecting rod length = 0.15 m

Compression ratio: 8 ( Variable )

Initial pressure = 101325 (atm)

Initial temperature = 500 K

Combustion temperature = 2000 K

Specific heat ratio = 1.4 (Is varied for Thermal efficiency calculation)

The values of parameters at different state points of the Otto cycle are evaluated using ideal gas equation PV = RT. The thermal efficiency of the Otto cycle is also calculated.

The below code represents an evaluation of the P-V diagram for Otto-cycle and calculation of thermal efficiency for different Compression ratio and Specific heat ratio.

\"\"\"
Engine otto cycle P-V diagram and thermal efficiency calculation

\"\"\"
import math
import matplotlib.pyplot as plt
import numpy as np

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

	#input 
	a = stroke/2 #crank pin radius
	R = con_rod/a

	num_values = 50

	sc = math.radians(start_crank)
	ec = math.radians(end_crank) 

	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)

def state_volume1(bore, stroke, cr):
	v_s = math.pi*(1/4)*pow(bore,2)*stroke
	v_c = v_s/(cr - 1)
	v1 = v_s + v_c
	return(v_s, v_c, v1)

def state_volume2(v_c, p1, gamma, t1):
	v2 = v_c
	p2 = p1*pow(v1,gamma)/pow(v2,gamma)
	rhs = p1*v1/t1
	t2 = p2*v2/rhs
	return(v2, p2, rhs, t2)

def state_volume3(v2, rhs, t3):
	v3 = v2
	p3 = rhs*t3/v3
	return(v3, p3)

def state_volume4(v1, p3, v3, gamma, rhs):
	v4 = v1
	p4 = p3*pow(v3, gamma)/pow(v4, gamma)
	t4 = p4*v4/rhs
	return(v4, p4, t4)

# Geometry inputs
bore = 0.10
stroke = 0.1
con_rod = 0.15
cr = 8

# Parameter inputs
p1 = 101325
t1 = 500
t3 = 2000 #combustion temp
gamma = 1.4

# Swept volume, Clearance volume, state point 1
[v_s,v_c, v1] = state_volume1(bore, stroke, cr)

# State point 2
[v2, p2, rhs, t2] = state_volume2(v_c, p1, gamma, t1)

# Compresion stroke
V_compression = engine_kinematics(bore, stroke, con_rod, cr, v_c, 180, 0)
constant = p1*pow(v1, gamma)
P_compression = []
for v in V_compression:
	P_compression.append(constant/pow(v,gamma))

# state point 3 -> after const volume combustion process
[v3, p3] = state_volume3(v2, rhs, t3)

# Expansion stroke
V_expansion = engine_kinematics(bore, stroke, con_rod, cr, v_c, 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, p4, t4] = state_volume4(v1, p3, v3, gamma, rhs)

#Thermal efficiency

n = (1 - 1/pow(cr,(gamma - 1)))*100
print(\'Thermal efficieny is:\',n,\'%\')

# Plotting
plt.plot(V_compression, P_compression, label = \'Isentropic Compression\')
#plt.text(0.0002, 500000, \'Intake\', rotation = 150)
plt.plot([v2, v3],[p2, p3], label = \'Constant volume heat addition\')
plt.plot(V_expansion, P_expansion, label = \'Isentropic Expansion\')
plt.plot([v4,v1], [p4,p1], label = \'Constant volume heat rejection\')
plt.xlabel(\'Volume\', fontsize = 12)
plt.ylabel(\'Pressure\', fontsize = 12)
plt.title(\'P-V diagram for Otto cycle\')
plt.grid(linestyle = \':\')
plt.legend()
plt.show()


# Thermal efficiency vs compression ratio

cor = []
nt = []
kappa = [1.1, 1.2, 1.4]


for i in range(2,13):
	cor.append(i)

for i in range(len(kappa)):
	nt.append([])
	for j in range(len(cor)):
		nt[i].append((1 - 1/pow(cor[j],(kappa[i] - 1)))*100)

for i in range(len(nt)):
	plt.plot(cor,nt[i])

plt.xlabel(\'Compression ratio (CR)\')
plt.ylabel(\'Thermal Efficiency (%)\')
plt.title(\'Variation of Thermal efficiency with respect to Compression ratio\')
plt.show()

Results:

The below figure represents the P-V diagram obtained for the given input conditions particularly for Compression ratio (CR) = 8 and gamma = 1.4.

Fig 2: P-V diagram for Otto cycle for CR = 8.

The thermal efficiency of the system is calculated as follows:

`\\eta = 1 - 1/(CR^{\\gamma - 1}) \\times 100`

For the present input condition, the thermal efficiency is obtained as 56.4724%.

Thermal efficiency for different CR and Specific ratio:

The Thermal efficiency variation for varying CR and for three different specific ratios is shown below in the graph:

Fig 3: Variation of Thermal efficiency wrt CR and Gamma

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.