Air Standard Cycle Simulator
AIM: Plotting P-V diagram and efficiency calculation of the Otto Cycle.
GOVERNING EQUATIONS:
Otto cycle is a gas power cycle that is used in a spark-ignition internal combustion engine (modern petrol engines). It is an air standard cycle which approximates the processes in petrol or diesel engines.
An Otto cycle consists of four processes:
- Two isentropic (reversible adiabatic) processes
- Two isochoric (constant volume) processes
These processes can be easily understood if we understand p-V (Pressure-Volume) and T-s (Temperature-Entropy) diagrams of the Otto cycle.
In the above diagrams,
p → pressure V → Volume T → temperature s → Entropy Vc → Clearance Volume Vs → Stroke Volume
Processes in Otto Cycle:
Process 1-2: Isentropic compression
In this process, the piston moves from the bottom dead centre (BDC) to top dead centre (TDC) position. Air undergoes reversible adiabatic (isentropic) compression. We know that compression is a process in which volume decreases and pressure increases. Hence, in this process, the volume of air decreases from V1 to V2 and pressure increases from p1 to p2. Temperature increases from T1 to T2. As this an isentropic process, entropy remains constant (i.e., s1=s2).
Process 2-3: Constant Volume Heat Addition:
Process 2-3 is isochoric (constant volume) heat addition process. Here, piston remains at the top dead centre for a moment. Heat is added at constant volume (V2 = V3) from an external heat source. Temperature increases from T2 to T3, pressure increases from p2 to p3 and entropy increases from s2 to s3.
In this process,
Heat Supplied = mCv(T3 – T2)
where,
m → Mass
Cv → Specific heat at constant volume
Process 3-4: Isentropic expansion
In this process, air undergoes isentropic (reversible adiabatic) expansion. The piston is pushed from the top dead centre (TDC) to bottom dead centre (BDC) position. Here, pressure decreases from p3 to p4, volume rises from v3 to v4, the temperature falls from T3 to T4 and entropy remains constant (s3=s4).
Process 4-1: Constant Volume Heat Rejection
The piston rests at BDC for a moment and heat is rejected at constant volume (V4=V1). In this process, the pressure falls from p4 to p1, temperature decreases from T4 to T1 and entropy falls from s4 to s1.
In process 4-1,
Heat Rejected = mCv(T4 – T1)
Thermal efficiency (air-standard efficiency) of Otto Cycle,
1 to 2 and from 3 to 4 are isentropic, therefore
Volume swept by the piston, Vs = (π*(bore)2*stroke)/4
Clearance volume, Vc = Vs/(cr-1)
Volume swept as a function of theta:
A=(0.5)*(cr-1)
B=R+1-cosd(theta)
C=((R^2)-((sind(theta))^2))^0.5
V=(1+(A*(B-C)))*Vc
GIVEN:
bore=0.8 meters
stroke=0.2 meters
connecting rod length = 0.15 meters
compression ratio (cr) = 10
p1=101325
y=1.4
t1=450
t3=3050
OBJECTIVES OF THE PROJECT: The main objective of the project is to calculate all unknowns of each state by help of governing equations and given values. After that plotting P-V diagram and calculating efficiency of the cycle.
PROGRAM:
# Otto cycle simulator
import math
import numpy as np
import matplotlib.pyplot as plt
#Engine geometrical parameters
bore=0.8
stroke=0.2
con_rod=0.15
cr=10
def engine_kinematics(bore,stroke,con_rod,cr,theta1,theta2):
v_stroke=(math.pi*pow(bore,2)*stroke)/4
v_clear=v_stroke/(cr-1)
a=stroke/2;
R=con_rod/a
theta=np.linspace(theta1,theta2,180)
V=[]
for t in theta:
A=(0.5)*(cr-1)
B=R+1-math.cos(math.radians(t))
C=pow((R**2)-(math.sin(math.radians(t))**2),0.5)
V.append((1+(A*(B-C)))*v_clear)
return V
#known state variables
p1=101325
#gamma
y=1.4
t1=450
t3=3050
#calculation of volumes
v_stroke=(math.pi*pow(bore,2)*stroke)/4
v_clear=v_stroke/(cr-1)
#state 1
v1=v_stroke+v_clear
#state 2
v2=v_clear
p2=pow(v1/v2,y)*p1
t2=pow(v1/v2,y-1)*t1
#state 3
v3=v2
p3=p2*(t3/t2)
#state 4
v4=v1
p4=pow(v3/v4,y)*p3
t4=pow(v3/v4,y-1)*t3
#During Compression stroke
v_comp=engine_kinematics(bore,stroke,con_rod,cr,180,0)
c1=p1*pow(v1,y)
p_comp=[]
for v in v_comp:
p_comp.append(c1/(pow(v,y)))
#During Expansion stroke
v_exp=engine_kinematics(bore,stroke,con_rod,cr,0,180)
c2=p3*pow(v3,y)
p_exp=[]
for ve in v_exp:
p_exp.append(c2/(pow(ve,y)))
#Calculation efficiency
n=1-((t4-t1)/(t3-t2))
print('Efficiency of engine = ', n);
#plotting state point
plt.plot(v1,p1,'*')
plt.plot(v2,p2,'*')
plt.plot(v3,p3,'*')
plt.plot(v4,p4,'*')
plt.plot(v_comp,p_comp, "-b",linewidth=3,label="Compression Stroke")
plt.plot([v2,v3],[p2,p3], "-r",linewidth=3,label="Heat Addition")
plt.plot(v_exp,p_exp, "-g",linewidth=3,label="Expansion Stroke")
plt.plot([v1,v4],[p1,p4], "-y",linewidth=3,label="Heat Rejection")
plt.xlabel('Volume (m^3)')
plt.ylabel('Pressure (pa)')
plt.legend()
plt.title('OTTO CYCLE')
plt.grid()
plt.show()
1. All known engine geometry parameters and state variable were defined.- 2. The formula for volume swept and volume clearance was given.
- 3. With the help of Isentropic formulate for process 1-2 and 3-4, all state variable was calculated.
- 4. By this, we got all four-point of the p-v diagram but for tracing isentropic volume we need to define how the volume changes in the engine piston.
ERROR FACED: No Error Faced
OUTPUT:
The program outputs the efficiency of the Otto cycle and plots P-V diagram. In the P-V diagram we can see that for heat addition and heat removal process, the volume is constant and for the isentropic processes, the graph is following an isentropic path.


CONCLUSION:
Using PYTHON programming, the efficiency of the Otto cycle was calculated and the P-V diagram is plotted. This is very helpful in the case where there is any change in engine geometry, we can easily update that in the code and quickly see the changes in the P-V diagram.