Project

Otto Cycle Simulator

The air-standard-Otto cycle is the idealized cycle for the spark-ignition internal-combustion engines.

Here P-V diagram is drawn by written a program on Python.

The Otto cycle 1-2-3-4 consists of following four processes:

Process 1: Reversible adiabatic compression of air.

2: Heat addition at constant volume.

3: Reversible adiabatic expansion of air.

4: Heat rejection at constant volume.

Given parameter are :

Bore Diameter, Compression Ratio, Crank pin Radius, Stroke ,Gamma,Temperature(T1) Peak Temperature T3 = 2300 K Gamma = 1.4

Different Parameter are Calculated using Equation Pressure(kPa), Volume(m^3), and Temperature(K) at 1:

T1 = 500 K V1 = Swept Volume + Clearance Volume Using Relation

PV^gamma = Constant ------------------------------------------ Equation 1

P*V/T = Constant -------------------------------------------------- Equation 2

P1 is calculated

Then P, V, T are calculated at 2 point

V2 = Clearance Volume then using Equation 1

P2 can be calculated And T2 can be calculated by using Equation 2

Then P, V, T are calculated at 3 points V2= V3 ( Constant Volume Process)- Isochoric

T3 is Given P3 can be calculated using Equation 2

Then P, V, T are calculated at 4 points V4 =V1 ( Constant Volume Process)-Isochoric

Using Equation 1 P4 can be calculated

T4 can be calculated using Equation 2

Thermal Efficiency can be calculated using Formula:

`etath = 1-(1/r^(gamma -1))`

# Otto Cycle Simulator

import matplotlib.pyplot as plt 
import math

#inputs

p1 = 101.325
t1 = 500
gamma = 1.4
t3 = 2300

# Geometry parameter

bore = 0.1
stroke = 0.1
con_rod = 0.15
cr = 5.5

# Calculation of Thermal Efficiency in percentage

Efficiency = 1 - (1/pow(cr,gamma-1))
print(' Thermal Efficiency of Otto Cycle : ' , Efficiency*100 , '%' )




def engine_Kinematics(bore,stroke,con_rod,cr,start_crank,end_crank):
	# Engine Kinematics

	

	# Geometric parameters
	a = stroke/2
	R = con_rod/a
	v_s = math.pi*(1/4)*pow(bore,2)*stroke
	v_c = v_s/(cr-1)

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

	num_values = 50

	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(pow(math.sin(theta),2),0.5)
		term3 = pow(term3,0.5)
		v.append((1 + term1 *(term2 -term3))*v_c)
		
	return v

	
# 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 | p2v2/t2 = rhs | 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

# p2v2/t2 = p3v3/t3 | rhs = p2v2/t2 | p3v3/t3 = rhs

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

# p3v3^gamma = p4v4^gamma

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


# p4v4/t4 = rhs

t4 =p4*v4/rhs



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 (m^3)')
plt.ylabel('Pressure (kPa)')
plt.title(' P-V Diagram for Otto Cycle')
plt.xlim(0,0.001)
plt.ylim(0,3000)
plt.show()


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.