Week 2 Air standard Cycle
AIR STANDARD CYCLE USING PYTHON
OBJECTIVE:
- To study the engine kinematics of a 4 stroke engine by plotting a P-V diagram
- To determine the thermal efficiency of air standard cycle for the given engine.
PROBLEM STATEMENT:
P-V diagram will be plotted, and the thermal efficiency of the Otto Cycle will be calculated for an engine with the given geometric parameters:
- Bore diameter=0.1016 m
- Stroke Length= 0.1016m
- Length of the connecting rod=0.154
- Compression ratio=10.2
THEORY:
The volume of the piston cylinder can be determined as a function of crank angle from the compression ratio, the stroke, bore and connecting rod length. The geometric parameters of the piston cylinder are represented as:
b = bore
s = stroke
l = connecting rod length
a = crank radius (= ½ s)
theta = crank angle
TDC = top dead center
BDC = bottom dead center

Fig1: Slider Crank

Fig 2: P-V Diagram Illustration
Green line: Referred to as the intake phase, the piston is drawn down to the bottom to allow the volume in the chamber to increase so it can "intake" a fuel-air mixture. In terms of thermodynamics, this is referred to as an isobaric process.
Process 1 to 2: During this phase the piston will be drawn up, so it can compress the fuel-air mixture that entered the chamber. The compression causes the mixture to increase slightly in pressure and temperature—however, no heat is exchanged. In terms of thermodynamics, this is referred to as an adiabatic process. When the cycle reaches point 2, that is when the fuel is met by the spark plug to be ignited.
Process 2 to 3: This is where combustion occurs due to the ignition of fuel by the spark plug. The combustion of the gas is complete at point 3, which results in a highly pressurized chamber that has a lot of heat (thermal energy). In terms of thermodynamics, this is referred to as an isochoric process.
Process 3 to 4: The thermal energy in the chamber as a result of combustion is used to do work on the piston—which pushes the piston down—increasing the volume of the chamber. This is also known as the power stoke because it is when the thermal energy is turned into motion to power the machine or vehicle.
Purple line (Process 4 to 1 and exhaust phase): From process 4 to 1, all waste heat is expelled from the engine chamber. As the heat leaves the gas, the molecules lose kinetic energy causing the decrease in pressure. Then the exhaust phase occurs when the remaining mixture in the chamber is compressed by the piston to be "exhausted" out, without changing the pressure.
GOVERNING EQUATIONS:
1. V/Vc= 1+0.5*(Rc-1)[r+1-cos(theta)-(R^2-sin^2(theta))^0.5]
Where:
V= Total volume in m3
Vc= Volume at compression in m3
Rc=Compression Ratio
Theta= crack angle in radians
2. Vs=1/4* pi*(bore^2)*L
Where:
Vs= Stroke Volume in m3
bore= bore dia in m
L=Stroke length
3. Stages of Otto Cycle(Refer to Figure 1):
a. State Point 1:
V1= Vc+Vs
Where:
V1= Volume at state 1
Vs= swept volume
Vc= volume at compression
b. Compression stroke:
p1 *(V1^gamma)= constant
c. State Point 2:
V2=Vc
p2*(V2^gamma)=p1*(V1^gamma)
(p2*V2)/t2=(p1*V1)/t1
d. Stage Point 3
V3=V2
(p3*V3)/t3=(p2*v2)/t2
e. Expansion stroke:
p3 *(V3^gamma)= constant
f. Stage Point 4:
V4=V1
p4*(V4^gamma)=p3*(V3^gamma)
(p4*v4)/t4=(p3*v3)/t3
4. Thermal efficiency of Otto Cycle:
nth=1-(t4-t1)/(t3-t2)
ASSUMPTIONS FOR THIS STUDY:
- Gas and air mixture are modeled as air and an ideal gas, which continuously circulates in a closed cycle. Thus, there are no intake and exhaust processes.
- All the processes making up the cycle are internally reversible.
- The combustion process is replaced by a heat-addition process from an external source.
- The exhaust process is replaced by a heat-rejection process and the gas returns to its initial state.
- Gamma=1.4
- Air compression ratio=10.2
- Initial crank angle at compression=180 degrees
- Initial crank angle at expansion=0 degrees
Python Program:
#Engine Kinematics
import math
import matplotlib.pyplot as plt
import numpy as np
#Geometric parameters
#Diameter of the bore(m2)
bore=0.1016
#Stroke length(m)
stroke=0.1016
#Length of the connecting rod
con_rod=0.154
#Compression ratio
cr=10.2
#Crank radius(m)
a=stroke/2
R=con_rod/a
#Volume parameters
#Swept radius
v_s=math.pi*(1/4)*pow(bore,2)*stroke
#Volume at compression
v_c=v_s/(cr-1)
#Function to calculate the crank angle of the cylinder at various crank angles
def engine_kinematics(bore, stroke, con_rod, cr, start_crank, end_crank):
#crank angle parameters
sc=math.radians(start_crank)
ec=math.radians(end_crank)
num_values=100
v=[]
theta=np.linspace(sc,ec,num_values)
for t in theta:
term1= 0.5*(cr-1)
term2=R+1-math.cos(t)
term3= pow(R,2)- pow(math.sin(t),2)
term3= pow(term3,0.5)
v.append((1+term1*(term2-term3))*v_c)
return v
#input
p1=101325
t1=500
gamma=1.4
t3=2300
#state point 1
v1=v_c+v_s
#Compression stroke
#constant for compression
constant1=p1*pow(v1,gamma)
p_compression=[]
v_compression=engine_kinematics(bore, stroke, con_rod, cr, 180, 0)
for value in v_compression:
p_compression.append(constant1/pow(value,gamma))
#state point 2
v2= v_c
#p2v2^gamma=p2v1^gamma
p2=p1*pow(v1, gamma)/pow(v2, gamma)
#p2v2/t2=p1v1/t1
t2=(p2*v2)/(p1*v1/t1)
#state point 3
v3=v2
#p3v3/t3=p2v2/t2
p3=(p2*v2/t2)/(v3/t3)
#Expansion stroke
#constant for expansion stroke
constant2=p3*pow(v3,gamma)
p_expansion=[]
v_expansion=engine_kinematics(bore, stroke, con_rod, cr, 0,180)
for value in v_expansion:
p_expansion.append(constant2/pow(value,gamma))
#state point4
v4=v1
#p4v4^gamma=p3v3^gamma
p4=p3*pow(v3, gamma)/pow(v4, gamma)
#p4v4/t4=p3v3/t3
t4=(p4*v4)/(p3*v3/t3)
#Plotting the p-v graph
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(m3)')
plt.ylabel('Pressure(N/m3)')
plt.show()
#Calculating thermal efficiency of otto cycle
nth=1-(t4-t1)/(t3-t2)
print(f"Thermal efficiency of the otto cycle cycle for this engine ={nth}")
RESULTS:


CONCLUSION:
The thermal efficiency of the given engine was found to be at 60.5%.
REFERENCES:
- https://www.engr.colostate.edu/~allan/thermo/page2/page2f.html
- https://energyeducation.ca/encyclopedia/Otto_cycle