Week 2 Air standard Cycle
Objectives:
- To simulate otto cycle with Pressure-Volume Diagram
- To calculate the thermal efficiency of the engine
Otto Air Standard Cycle Theory:
The Otto cycle is an ideal cycle utilized in SI(spark-start) motors, named after Nikolaus Otto, who developed it in 1867. In an ideal Otto cycle, air-standard supposition is utilized. The ideal Otto cycle comprises of four reversible cycles:

- 1-2 Isentropic compression
- 2-3 Constant volume heat addition
- 3-4 Isentropic expansion
- 4-1 Constant volume heat rejection
The Otto cycle is a closed system and the working fluid is air as indicated by the air-standard presumption. Likewise, changes in active and potential energies are insignificant. No heat exchange is involved in the two adiabatic processes. The closed system energy balances for these two cycles are:
w12 = u2 - u1
w34 = u4 - u3
w12 is negative since work is done on the air during compression in the combustion chamber and w34 is positive since work is done on the air during expansion.
In the isochoric heat addition and heat rejection, no work is involved since no volume change happens. The closed system energy balances for these two cycles are:
q23 = u3 - u2
q41 = u1 - u4
q23 is positive since heat is added to the system and q41 is negative since heat is rejected form the system to the environment.
Solution Procedure:
Libraries used:
Math: Since trigonometric functions are used for calculation of various parameters, hence Math labrary is used.
Matplotlib.pyplot: The plotting library is used for plotting the Pressure Vs Volume diagram
Geometrical Parameters of the Engine:
The geometrical parameters of the engine are defined as below:
Bore = Inner diamater of the cylinder
Stroke = Vertical displacement of the piston
Con_rod = connecting rod length
a = Crank Radius
R = Con_rod/a
cr = compression ratio
gamma = ratio of specific heat capacities at constant pressure and volume
theta = crank angle
Intake conditions:
P1 = pressure at the end of intake stroke
T1 = intake temperature of air
Vs = Stroke volume
Vc = Clearance volume
T3 = temperature after heat addition
Functions used:
Since, the volume of the engine changes with respect to the crank angle (theta) by the relation:

hence the volume calculation during compressin and expansion strokes are a function of crank angle.
Since pressure during compression and expansion are related to volume by the relation:

Hence, pressure during compression and expansion is also indirectly related to crank angle.
Calculations:
Crank angle spacing: since volume and in turn pressure is calculted based on crank angle, hence crank angle spacing is calculated between a defined range of start crank and end crank.
crank spacing = (end crank - start crank)/(total spacing -1)
Process 1-2:
Adiabatic Compression


Process 2-3:
Isochoric Heat Addition


Process 3-4:
Adiabatic Expansion


Process 4-1:
Isochoric Heat Rejection


Engine Thermal Efficiency:

Results and Discussion:
Plot:
The Pressure Vs Volume diagram is plotted. The area under the plot varies as the compression ratio changes or basic engine gometry is changed. It will also vary if gamma will change.

Engine Thermal Efficiency:
Thermal Efficiency is a fucntion of compression ratio and gamma. It changes if any one or both the paramters change. The Thermal Efficiency for compression ratio as 12 and gamma as 1.4 is:

# Otto Cycle simulator
import math
import matplotlib.pyplot as plt
# inputs
# Bore of the piston(m)
bore = 0.1
# stroke of the piston (m)
stroke = 0.1
# connecting rod length (m)
con_rod = 0.15
# compression ratio
cr = 12
# ratio of specific heat
gamma = 1.4
# inlet conditions
# pressure at start of compression (Pa)
p1 = 101325
# stroke volume (m^3)
Vs = ((math.pi)/4)*pow(bore,2)*stroke
# temperature at start of compression (K)
t1 = 500
# clearance volume (m^3)
Vc = Vs/(cr - 1)
# tmperature after heat addition (K)
t3 = 2500
# volume at the start of compression
v1 = Vs + Vc
# volume calculation during compression stroke (m^3)
def compression_stroke(bore, stroke, con_rod, cr, start_crank, end_crank):
a = stroke/2
R = con_rod/a
sc = math.radians(start_crank)
ec = math.radians(end_crank)
# number of crank angles during compression
n_theta = 50
dtheta = (ec - sc)/(n_theta - 1)
# Volume during compression stroke
V_compression = []
for i in range (0, n_theta):
theta = sc + i*dtheta
term1 = 0.5*(cr-1)
term2 = (R + 1 - math.cos(theta))
term3 = pow(pow(R,2)-pow(math.sin(theta),2),0.5)
V_compression.append((1 + term1*(term2 - term3))*Vc)
return V_compression
# pressure at the end of compression
p2 = p1*(pow(Vs,gamma)/pow(Vc,gamma))
# temperature at the end of compression
t2 = (p2*Vc*t1)/(p1*Vs)
#Volume during compression
V_compression = compression_stroke(bore, stroke, con_rod, cr, 0, 180)
# volume at the end of compression
v2 = Vc
constant1 = p1*pow(Vs,gamma)
# Pressure ducring compression
P_compression = []
for v in V_compression:
P_c = constant1/(pow(v,gamma))
P_compression.append(P_c)
# pressure after heat addition
p3 = (p2*Vc*t3)/(t2*Vc)
# volume after heat additon
v3 = Vc
# volume during expansion
def expansion_stroke(bore, stroke, con_rod, cr, start_crank, end_crank):
a = stroke/2
R = con_rod/a
sc = math.radians(start_crank)
ec = math.radians(end_crank)
# number of crank angles during compression
n_theta = 50
dtheta = (ec - sc)/(n_theta - 1)
# Volume during compression stroke
V_expansion = []
for i in range (0, n_theta):
theta = sc + i*dtheta
term1 = 0.5*(cr-1)
term2 = (R + 1 - math.cos(theta))
term3 = pow(pow(R,2)-pow(math.sin(theta),2),0.5)
V_expansion.append((1 + term1*(term2 - term3))*Vc)
return V_expansion
# Volume during expansion
V_expansion = expansion_stroke(bore, stroke, con_rod, cr, 180, 0)
# pressure during expansion
P_expansion = []
constant2 = p3*pow(v3,gamma)
for v in V_expansion:
P_e = constant2/pow(v, gamma)
P_expansion.append(P_e)
# volume at the end of expansion
v4 = v1
# temperature at the end of expansion stroke
t4 = (t3*pow(v3,(gamma-1)))/pow(v4, (gamma-1))
# Pressure at the end of expansion
p4 = (p3*v3*t4)/(v4*t3)
# Thermal Efficiency of the Engine
thermal_efficiency = (1 - 1/pow(cr, gamma-1))*100
print(thermal_efficiency)
#print(V_compression)
plt.plot(V_compression, P_compression)
plt.plot([v2, v2], [p2, p3])
plt.plot(V_expansion, P_expansion, p1)
plt.plot([v4, v1], [p4, p1])
plt.xlabel('volume(m^3)')
plt.ylabel('Pressure(kPa)')
plt.show()