Engine Kinematics - Air Standard Otto Cycle
Problem Statement:
In an Air Standard Otto Cycle, the compression ratio is 7 and compression begins at 35°c and 0.1Mpa. The maximum temperature of cycle is 1100°c. Bore and Stroke of engine cylinder are 69mm and 76.8mm. Length of connecting rod is 100mm. Consider Cv = 0.718 KJ/Kg k. Develope a Python Program for:
1. Thermal Efficiency of cycle
2. PV diagram.
Python Program:
# Program for Air Standard Otto cycle Efficiency Calculation #
import math
import matplotlib.pyplot as plt
# Input
bore = 0.069
stroke = 0.0768
l = 0.1 # Length of connecting rod
a = stroke/2 # Crank Radius
cr = 7 # Compression ratio
p1 = 100000 # Presure at which compression process begins
t1 = 308 # Temperature at which compression begins
t3 = 1373 # Temperature after combustion process ends
R = l/a # Any constant teken under consideration
gamma = 1.4
Cv = 0.718 # Specific heat at constant volume
# Swept Volume
v_s = (math.pi/4)*pow(bore,2)*stroke
# Clearance Volume
v_c = v_s / (cr - 1)
# Defining function for calculating volume of cylinder at any crank angle
def engine_kinematics(bore, stroke, l, cr, start_crank, end_crank):
# As crank angle may vary from 0 - 90 degrees, considering 50 intervals
n_theta = 50
# Starting crank angle
sc = math.radians(start_crank)
# Ending crank angle
ec = math.radians(end_crank)
# Volume of cylinder at any crank angle
V = []
for i in range(0, n_theta):
d_theta = (sc-ec)/(n_theta - 1)
theta = sc + (i * d_theta)
term1 = 0.5 * (cr - 1)
term2 = R + 1 - math.cos(theta)
term3 = pow(R,2) - pow((math.sin(theta)),2)
term3 = pow(term3,0.5)
V.append((1 + (term1 * (term2 - term3)))*v_c)
return V
# Calculating parameters at each state point
# Process 1-2 = Isentropic Compression
v1 = v_s + v_c
v2 = v_c
p2 = pow((v1/v2),gamma) * p1
t2 = pow((v1/v2),(gamma-1)) * t1
# Calling function to calculate variation of V & P with varying crank angle from 180 - 0 deg.
v_compression = engine_kinematics(bore, stroke, l, cr, 180, 0)
constant = p1 * pow(v1, gamma)
p_compression = []
for v in v_compression:
p_compression.append(constant/pow(v, gamma))
# Process 2-3 = Constant Volume heat addition
v3 = v2
p3 = (t3/t2) * p2
# Calling function to calculate variation of V & P with varying crank angle from 0 - 180 deg.
v_expansion = engine_kinematics(bore, stroke, l, cr, 0, 180)
constant = p3 * pow(v3, gamma)
p_expansion = []
for v in v_expansion:
p_expansion.append(constant/pow(v, gamma))
# Process 3-4 = Isentropic Expansion
v4 = v1 # as Process 4-1 = Constant Volume Heat Rejection
p4 = pow((v3/v4), gamma) * p3
t4 = pow((v3/v4), (gamma-1)) * t3
# Calcuation of thermal efficiency of otto cycle
q_in = Cv * (t3 - t2) # Heat Input
q_out = Cv * (t4 - t1) # Heat Output
w_net = q_in - q_out # Net work done
efficiency_otto = (w_net / q_in)*100
print(\"The Efficiency of Otto Cycle is \" + \"%.2f\" % efficiency_otto + \"%\")
plt.xlabel(\'Volume (m^3)\')
plt.ylabel(\'Pressure (Pa)\')
plt.plot([v2,v3],[p2,p3])
plt.plot([v4,v1],[p4,p1])
plt.plot(v_compression, p_compression)
plt.plot(v_expansion, p_expansion)
plt.savefig(\'Air_Standard_Cycle_PV_Plot.png\')
plt.show()
Program Explanation:
1. Input:
bore = 0.069m
stroke = 0.0768m
Length of connecting rod = l = 0.1m
Crank Radius = a = stroke/2 = 0.0384m
Compression Ratio = cr = 7
Pressure before compression = p1 = 0.1MPa
Temperature before compression = t1 = 35°c = 308K
Max. temperature after combustion = t3 = 1100°c = 1373K
R = Length of connecting rod / crank radius = 2.60
gamma = 1.4
Specific heat at constant volume = 0.718 KJ/Kg k
2. As per given dimensions of cylinder, swept and clearance volume can be calculated.
Swept Volume = v_s = (pi/4)*(bore^2)*(stroke)
Total Volume = swept volume + clearance volume
therefore,
Clearance Volume = v_c = v_s / (cr - 1)
3. As we need to calculate volume of cylinder at any crank angle, we define a function which
can be used in place in program to calculate volume at that poit and corresponding
pressure.
def engine_kinematics(bore, stroke, l, cr, start_crank, end_crank):
under above function we calculate V at any crank angle using following formula.
As Θ in above equation varies from 0° to 180°, 10 equal intervals are considered to
calculate V at those intervals. As required Θ in above quation are in radians, Θ in degree
is converted to radian using math.radians().
To reduce complexity of equation, it is devided into 3 terms
term1 = 0.5 * (rc - 1)
term2 = R + 1 - cos(Θ)
term3 = ((r^2) - (sin^2(Θ))^0.5
by considering volume at any crank angle as \"V\"
V = []
By using For loop, value of is appended by using term
(1+(term1 * (term2 - term3)))*v_c.
for storing value of V in array, \"return V\" is used after FOR LOOP..
4.
Above is P-V plot for Air Standard Otto Cycle.
Process 1 - 2: Isentropic Compression
using above equation p2 & t2 are calculated. At this point by calling function defined
earlier, v_compression and p_compression are calculated.
v_compression = engine_kinematics(bore, stroke, l, cr, 180, 0)
as while compression crank angle varies from 180° to 0°, start_crank is replaced by 180
and end_crank is replaced by 0.
By using For Loop, for each value of v_compression, p_compression is calculated.
Process 2 - 3: Constant Volume Heat Addition (Combustion)
For Constant Volume process;
p3 is calculated using above equation, as all other values are known.
Process 3 - 4: Isentropic Expansion
v4 = v1 since process 4-1 is constant volume process.
Similar to process 1-2, pressure and volume at after expansion process i.e. p4 & t4 are
calculated using same relations between p,v & t.
same as that of calculation of v_compression and p_compression, v_expansion and
p_expansion are calculated, similarly by calling function. Only change being crank angle.
Crank angle while expansion varies from 0° to 180°.
v_expansion = engine_kinematics(bore, stroke, l, cr, 0, 180)
5. After calculating values of pressure and volume at all state point, efficiency can be
calculated by using following equations;
Heat Added = q_in = Cv * (t3 - t2) KJ/Kg
Heat Rejected = q_out = Cv * (t4 - t1) KJ/Kg
Net work done = w_net = q_in - q_out
Thermal Efficeiency = efficiency_otto = w_net / q_in
The result is printed as output of program.
6. Using all calculated values of pressure and volume at each state point, P-V plot is plotted.
Plot is plotted for curves ([v2,v3],[p2,p3]) = Isochoric Heat addition
([v4,v1],[p4,p1]) = Isochoric Heat Rejection
([v_compression, p_compression]) = Isentropic Compression
([v_expansion, p_expansion]) = Isentropic Expansion
Obtainted P-V plot is saved by using savfig() and shown using show() under matplotlib
module.
Output:
Efficiency of Otto cycle for given condition is 54.08%.
Above is P-V plot for Air Standard Otto cycle.
1. Green Curve shows process 1-2 i.e. Isentropic Compression, where pressure
increases and volume decreases.
2. Blue Vertical line shows process 2-3 i.e. Constant Volume or Isochoric
Combustion.
3. Red curve indicates process 3-4 i.e. Isentropic Expansion, where pressure seems
to be dropping with increase in volume.
4. Yellow line indicates process 4-1 i.e. Constant Volume or Isochoric Heat
rejection through exhaust.