Week 2 Air standard Cycle
AIM:
To solve an otto cycle and make plots (P-V diagram) for it.
To output the thermal efficiency of the engine.
LANGUAGE: Python
Editor: Sublime Text
SUMMARY:
Concepts & Definition
Formulas used
Code and explanation
Remarks
Conclusion
Concepts & Definition
The air-standard cycle is an idealized heat engine cycle which is mainly founded on the following approximations:
The working fluid throughout the cycle is only air;
the air acts as an ideal gas;
combustion processes are replaced by well-defined heat addition processes; and
the exhaust process is replaced by a heat rejection process that returns the air of the cycle to intake conditions.
Since air is assumed to be an ideal, or perfect, gas, constant values of specific heat at constant volume and pressure are frequently assumed.
The thermal efficiency is a dimensionless performance measure of a device that uses thermal energy, such as an internal combustion engine, a steam turbine or a steam engine, a boiler, furnace, or a refrigerator for example.
For a heat engine, thermal efficiency is the fraction of the energy added by heat (primary energy) that is converted to net work output (secondary energy).

Formula used:
Code and explanation
Main program
"""
Otto cycle simulator
"""
import math
import matplotlib.pyplot as plt
def engine_kinematics(bore, stroke, con_rod, cr, start_crank, end_crank):
"""
Engine kinematics
"""
#Geometric parameters
a=stroke/2
R=con_rod/a
#Volume Parameters
v_swept = math.pi*(1/4)*pow(bore,2)*stroke
v_clearance = v_swept /(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(math.sin(theta),2)
term4 = pow(term3, 0.5)
V.append((1 + term1*(term2-term4))*v_clearance)
return V
# inputs
p1=101325
t1=500
gamma=1.4
t3=2300
#Geometric parameters
bore=0.1
stroke=0.1
con_rod=0.15
cr=12
#Calculation of the swept volume and the clearance volume
v_swept=(math.pi/4)*pow(bore,2)*stroke
v_clearance=v_swept/(cr-1)
v1=v_swept + v_clearance
v2=v_clearance
#State variable at state point 2
#p2v2^gamma=p1v1^gamma
#p2=p1*(v1/v2)^gamma= p1*cr^gramma
p2=p1*pow(cr,gamma)
#p1v1/t1=p2v2/t2 | t2=p2*v2*t1/(p1*v1)
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
#%p3v3/t3=p2v2/t2 | rhs=p2v2/t2 | p3=rhs*t3/v3
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 variables at state point 4
v4=v1
#p3*v3^gamma=p4v4^gamma | p4 = p3*(v3/v4)^gamma
p4 = p3*pow(v3,gamma)/pow(v4,gamma)
#p4v4/t4 = rhs
t4 = p4*v4/rhs
#Thermal efficiency calculation
#Th_eff=1-1/(cr.^gamma-1)
Thermal_efficiency=1-1/(pow(cr,(gamma-1)))
print(Thermal_efficiency)
#PLOTING
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.show()
Output:

Plot obtained:

Remarks:
Air standard cycle is not actual, it is used as reference for the study of actual engines
Conclusion
To sum up, air standard is an ideal cycle which is used by engineers as a standard to serve as a yard-stick and to compare the thermal efficiency of actual internal combustion engine cycles. It may be noted that actual engine can never give thermal efficiency as high as the air-standard efficiency when operating on the same cycle as air engine. Actual indicated thermal efficiency of a well designed and well constructed internal combustion engine, when properly operated, should be at least two-third of air-standard efficiency.