Project

OTTO CYCLE (using Python)

AIM:

To understand and to make an ‘OTTO CYCLE’ graph and analyze it.

OBJECTIVES:

  • To make a P-V graph of Otto cycle
  • To find the thermal efficiency of the process

INTRODUCTION:

An Otto cycle is an idealized thermodynamic cycle that describes the functioning of a typical spark ignition piston engine. It is the thermodynamic cycle most commonly found in automobile engines.

Processes:

The processes involved in the cycle are as follows:

  • Process 1–2 is an adiabatic (isentropic) compression of the charge as the piston moves from bottom dead center (BDC) to top dead center (TDC).
  • Process 2–3 is a constant-volume heat transfer to the working gas from an external source while the piston is at top dead center. This process is intended to represent the ignition of the fuel-air mixture and the subsequent rapid burning.
  • Process 3–4 is an adiabatic (isentropic) expansion (power stroke).
  • Process 4–1 completes the cycle by a constant-volume process in which heat is rejected from the air while the piston is at bottom dead center.

Formulas Used:

  • The following equation is for adiabatic processes

`PV^gamma` = constant

where `P` = pressure

`V` = volume

`gamma` = `C_p/C_v` where `C_p` = specific heat of gas at constant pressure

`C_v` = specific heat of gas at constant volume

  • This is the gas equation applicable for all ideal gases

`(PV)/T` = constant

  • `eta = 1 - 1/(CR^(gamma-1))`

where `eta` = thermal efficiency

  • `V/V_c =``1+1/2(CR-1)[R+1-cos(theta)-(sqrt (R^2-(sin(theta))^2))]`

where V = volume during compression or expansion

`V_c` = clearance volume

`theta` = crank angle

CR = compression ratio

R = `(CR)/a` ,where a = crank pin radius

PROCEDURE OF COMPLETION:

  • Here in this case, components of a 5.7L V8 Engine had been taken i.e. the bore length, the stroke, the connecting rod length, the compression ratio and etc.
  • Then all the calculations were made as per the formulae above and calculated.
  • A function named ‘engine_kinematics.py’ was used to calculate the volume during compression and expansion.
  • Then, the plotting of the graph alongwith the thermal efficiency was calculated.

The following code would execute the graph alongwith the thermal efficiency:

# PROGRAM TO FIND P-V CHARACTERISTICS OF OTTO CYCLE AND FIND THE THERMAL EFFICIENCY OF THE CYCLE

# IMPORTING NECESSARY MODULES
import math
import matplotlib.pyplot as plt
from engine_kinematics import eng_kin

# INITIALIZING VARIABLES
bore = 0.1016  # in m
stroke = 0.0884  # in m
cr = 6  # compression ratio
c_rod = 0.148  # connecting rod length (in m)
k = 1.4  # gamma

# Parameters at state 1
p1 = 100000  # (in pascals)
t1 = 300  # (in kelvin)

# Parameters at state 3
t3 = 2000  # (in kelvin)

# Calculation of swept volume and clearance volume
v_swept = (math.pi / 4) * pow(bore, 2) * stroke
v_clearance = v_swept / (cr - 1)
v1 = v_swept + v_clearance  # volume at state 1
v2 = v_clearance  # volume at state 2

# Calculation of pressure,volume and temperature at different states
# State 2:
# p1*v1^gamma = p2*v2^gamma
p2 = p1 * pow((v1 / v2), k)

# (p1*v1)/t1 = (p2*v2)/t2
t2 = (t1 * (p2 * v2)) / (p1 * v1)

# During compression
P_compression = []
constant = p1 * pow(v1, k)
V_compression = eng_kin(bore, stroke, c_rod, cr, math.pi, 0)
for v in V_compression:
    P_compression.append(constant / pow(v, k))

# State 3:
# (p2*v2)/t2 = (p3*v3)/t3
v3 = v2
p3 = (p2 * t3) / t2

# During expansion
P_expansion = []
constant = p3 * pow(v3, k)
V_expansion = eng_kin(bore, stroke, c_rod, cr, 0, math.pi)
for v0 in V_expansion:
    P_expansion.append(constant / pow(v0, k))

# State 4:
# p3*v3^gamma = p4*v4^gamma
v4 = v1
p4 = p3 * pow((v3 / v4), k)

# Calculating Thermal Efficiency
eff = 1 - (1 / pow(cr, (k - 1)))

# plotting
plt.plot(V_compression, P_compression)
plt.plot([v2, v3], [p2, p3])
plt.plot(V_expansion, P_expansion)
plt.plot([v4, v1], [p4, p1])
plt.title('OTTO CYCLE')
plt.xlabel('Volume(in m^3)')
plt.ylabel('Pressure(in Pa)')

# Labelling the figure
plt.text(v1, p1, 'State-1')
plt.text(v2, p2, 'State-2')
plt.text(v3, p3, 'State-3')
plt.text(v4, p4, 'State-4')
plt.text((v1 + v2) / 2, (p3 + p1 / 2), 'Thermal efficiency = ' + str(eff))
plt.grid()
plt.show()

The function 'engine_kinematics.py' is as follows:

# gives the compressive value and expansive volume of the otto engine

# importing modules
import math
import numpy as np


def eng_kin(bore, stroke, c_rod, cr, start_crank, end_crank):
    # initialization of parameters
    a = stroke / 2  # crank pin radius
    r = c_rod / a
    v = []

    v_swept = (math.pi / 4) * pow(bore, 2) * stroke
    v_clearance = v_swept / (cr - 1)

    theta = np.linspace(start_crank, end_crank, 180)

    term1 = 0.5 * (cr - 1)
    for angle in theta:
        term2 = r + 1 - math.cos(angle)
        term3 = math.sqrt(pow(r, 2) - pow(math.sin(angle), 2))
        v.append((1 + term1 * (term2 - term3)) * v_clearance)

    return v

OBSERVATIONS:

The Otto cycle alongwith its thermal efficiency is as follows:

CONCLUSION:

Otto cycle is one of the fundamental thermodynamic processes that occur in any internal combustion engine. Plotting the cycle in Python is an essential feature of the software which allows us to visualize our data with more precision and helps us to tweak it accordingly.

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.

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.