Challenge

Week 2 Air standard Cycle

Week 2 Air standard Cycle

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.

The Otto cycle is a description of what happens to a gas as it is subjected to changes of pressure, temperature, volume, addition of heat, and removal of heat. The gas that is subjected to those changes is called the system. The system, in this case, is defined to be the fluid (gas) within the cylinder. Conversely, by describing the changes that take place within the system it also describes the system's effect on the environment. The purpose of the Otto cycle is to study the production of net work from the system that can propel a vehicle and its occupants in the environment.

The Otto cycle is constructed from:

Top and bottom of the loop: a pair of quasi-parallel and isentropic processes (frictionless, adiabatic reversible).
Left and right sides of the loop: a pair of parallel isochoric processes (constant volume).

The isentropic process of compression or expansion implies that there will be no inefficiency (loss of mechanical energy), and there be no transfer of heat into or out of the system during that process. The cylinder and piston are assumed to be impermeable to heat during that time. Work is performed on the system during the lower isentropic compression process. Heat flows into the Otto cycle through the left pressurizing process and some of it flows back out through the right depressurizing process. The summation of the work added to the system plus the heat added minus the heat removed yields the net mechanical work generated by the system.

Coding:

import math

import matplotlib.pyplot as plt

def engine_kinematics(bore, stroke, con_rod, cr, start_crank, end_crank):

a = stroke/2

R = con_rod/a

V_s = math.pi*(1/4)*pow(bore, 2)*stroke

V_c = V_s/(cr - 1)

# angle

sc = math.radians(start_crank) # sc = start crank: crank angle 0 and piston at top dead center: converting the degrees into radians

ec = math.radians(end_crank) # crank angle 0 and piston at bottom dead center: converting the degrees into radians

num_values=50

dtheta = (ec - sc)/(num_values-1)

# to store volume array

V=[]

#to start crank angle array

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)

term3 = pow(term3, 0.5)

V.append((1 + term1 * (term2-term3))*V_c)

return V

# inputs

p1 = 101325

t1 = 500

t3 = 2300

gamma = 1.4

# geometric parameters

bore = 0.1

stroke = 0.1

con_rod = 0.15 # connecting rod

cr = 12 # compression ratio

# volume computation

v_s = (math.pi/4)*pow(bore, 2)*stroke # stroke volume

v_c = v_s/(cr-1) # clearance volume

# volume at state 1

v1 = v_c + v_s

# state point 2 - compression cycle

v2 = v_c

p2 = p1*pow(v1, gamma)/pow(v2, gamma)

# temperature at state point 2

rhs_two = p1*v1/t1

t2 = p2*v2/rhs_two

# for compression: engine_kinematics(bore, stroke, con_rod, cr, 0, 180) # for expansion stroke the crank angle goes from 0 to 180

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))

print(P_compression)

# volume of state 3

v3 = v2

rhs_three = p2*v2/t2

p3 = rhs_three*t3/v3

# print(p3 > p2)

# for compression: engine_kinematics(bore, stroke, con_rod, cr, 0, 180)

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)

t4 = p4*v4/rhs_two

# Air standard efficiency:

eta = (1-pow((1/cr), (gamma -1)))*100

print('Air standard efficiency of otto cycle = ', eta)

plt.plot([v2, v3],[p2, p3], label = 'Igition')

plt.plot(V_compression, P_compression, label = 'Power stroke: Adiabatic expansion')

plt.plot(V_expansion, P_expansion, label = 'Compression stroke: Adiabatic expansion')

plt.plot([v4, v1],[p4, p1], label = 'Exhaust')

plt.legend()

plt.xlabel('Volume [m^3]')

plt.ylabel('Pressure [Pa]')

plt.show()

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.