Challenge

Week 2 Air standard Cycle

Solution: Air Standard Cycle

The OTTO cycle is solved using forward engine kinematics and PV diagram is plotted.

Algorithm:

# Otto Cycle Simulator using Forward Engine Kinematics

import math
import matplotlib.pyplot as plt

#Adding Engine Kinematics function
def engine_kinematics(bore, stroke, con_rod, cr, start_crank, end_crank):

    # Geometric & Volume Parameters
    a = stroke/2                           #crankpin radius
    R = con_rod/a                          #constant
    V_s = math.pi*(1/4)*pow(bore,2)*stroke   #Swept Volume
    V_c = v_s / (cr -1)                    #Clearance Volume

    sc = math.radians(start_crank)
    ec = math.radians(end_crank)

    num_values = 50
    dtheta = (ec-sc)/(num_values-1)
    V = []                                  #Volume Array

    for i in range(0,num_values):
      theta = sc + i*dtheta

      # Equation (split in 3 parts)
      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 and defining state variables at all 4 points. 
#State Point 1
# Input Parameters
p1 = 101325   #Pressure (Pa)
t1 = 500      #Temperature (K)

#Geometric Parameters (Square Engine)
bore = 0.1       #meters
stroke = 0.1     #meters
con_rod = 0.15   #connecting rod length (meters)
cr = 8          #compression ratio [8,10,12]

#Volume Computation
v_s = (math.pi/4)*pow(bore,2)*stroke   #Swept Volume
#print(v_s)
v_c = v_s / (cr -1)                    #Clearance Volume
#print(v_c)
v1 = v_c + v_s                        #Total Volume

#State point 2
gamma = 1.4
#For volume : After the compression process the volume in the combustion chamber is equal to the clearance volume
v2 = v_c            
# For pressure: use isentropic relation (p2*v2^gamma = p1*v1^gamma)
p2 = (p1*pow(v1,gamma))/pow(v2,gamma)
#For temperature: use ideal gas law (p2v2/t2 = p1v1/t1)
rhs = (p1*v1)/t1
t2 = (p2*v2)/rhs

#Compresion
V_compression = engine_kinematics(bore, stroke, con_rod, cr, 180, 0)
#P_compression*(V_compression^gamma) = constant
constant = p1*pow(v1,gamma)
P_compression = []

for v in V_compression:
  P_compression.append(constant/(pow(v,gamma)))
#print(P_compression)

#State point 3  - After constant volume combustion
t3 = 2300              #assumption (after the constant volume heat addition, temperature is that high)
v3 = v2                #constant volume. 
rhs2 = (p2*v2)/t2
p3 = (rhs2*t3)/v3      #pressure
#print(p3 > p2)        #to check pressure value 

#Expansion
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))
#print(P_expansion)

#State point 4
v4 = v1
p4 = (p3*pow(v3,gamma))/pow(v4,gamma)
rhs = (p3*v3)/t3
t4 = (p4*v4)/rhs

# Air standard Efficiency:
eta = (1-pow((1/cr), (gamma -1)))*100 
print('Air standard effeciency of otto cycle = ', eta)

# Plot the PV Diagram
plt.plot([v2,v3],[p2,p3],label = 'Ignition')
plt.plot(V_compression,P_compression,label = 'Power stroke')
plt.plot(V_expansion, P_expansion, label = 'Compression stroke')
plt.plot([v4, v1],[p4, p1], label = 'Exhaust')
plt.legend()
plt.xlabel('Volume [m^3]')
plt.ylabel('Pressure [Pa]')
plt.show()

Explaination:

Output:

A. Compression Ratio - 8

Air standard Efficiency of Otto Cycle = 56.47247183519378

B. Compression Ratio - 10

Air standard Efficiency of Otto Cycle = 60.189282944650266

C. Compression Ratio - 12

Air standard Efficiency of Otto Cycle = 62.98928275128466

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.