Project

Air Standard Cycle With Python

Aim

Plot Pressure-Volume(PV) Diagram of Air Standard Cycle and Calculation of thermal efficiency Using Python

Objectives

  1. Plot Pressure-Volume (PV) Diagram of Air Standard Cycle
  2. Calculate Thermal Efficiency of Air Standard Cycle

Theory

The Otto-Cycle is an air standard cycle of the Spark Ignition (SI) Engine. In most Spark Ignition (SI) engine, the piston executes four complete strokes within the cylinder and the crankshaft completes two revolutions for each thermodynamic cycle. The processes involved are described below with PV-diagram.

  1. Process 0-1: Intake stroke

The inlet valve is open, the piston moves to the right, admitting fuel-air mixture into

the cylinder at constant pressure

  1. Process 1-2: Compression stroke

Both the valves are closed, the piston compresses the combustible mixture to minimum volume

  1. Process 2-3: Combustion stroke

The mixture is then ignited by means of a spark, combustion takes place, and there is an increase in temperature and pressure

  1. Process 3-4: Expansion stroke

The products of combustion do work on the piston which moves to the right, and the pressure and temperature of the gas decrease.

  1. Process 4-1: Blow-down stroke

The exhaust valves open and the pressure drops to the initial pressure

  1. Process 1-0: Exhaust stroke

With the exhaust valve opens, and the piston moves inward to expel the combustion products from the cylinder at constant pressure.

Governing Equations & Graphs

  • Adiabatic Process

`PV^γ=constant`

P – pressure

V-volume

γ - the ratio of specific heat

  • Ideal Gas Equation

`PV=nRT`

P -Pressure

V - Volume

n – No. of moles

R – Universal Gas constant

T – Temperature

  • Constant Volume Process

`P/T=constant`

P – Pressure

T – Temperature

  • Thermal efficiency

`η=1-1/(r^γ-1)`

γ - the ratio of specific heat

η – thermal efficiency

Ideal PV-Diagram for Otto-Cycle

Python Program

'''
Air standard Cycle With Python Program
by SLOMO THOMAS
'''
import math as m
import matplotlib.pyplot as plt
import scipy as sp
import numpy as np

def engine_kinematics(bore,stroke,con_rod,cr,start_angle,end_angle):
	"""
	Engine Kinematics
	"""
	# Engine Parameters
	a = stroke/2
	R = con_rod/a

	# Volume Computation
	v_s = (m.pi/4)*pow(bore,2)*stroke
	v_c = v_s/(cr-1)

	sc = m.radians(start_angle)
	ec = m.radians(end_angle)

	num_values = 50
	dtheta = (sc-ec)/(num_values-1)
	v = []
	for i in range(0,num_values):
		theta = sc+i*dtheta
		term1 = 0.5*(cr-1)
		term2 = R+1-m.cos(theta)
		term3 = pow(R,2)- pow(m.sin(theta),2)
		term3 = pow(term3,0.5)
		v.append((1+term1*(term2-term3))*v_c)

	return v

# Inputs
p1 = 101325
t1 = 500
gamma = 1.4
t3 = 2300

# engine parameters
bore = 0.1
stroke = 0.1
con_rod = 0.15
cr = 6

# Volume Computation
v_s = (m.pi/4)*pow(bore,2)*stroke
v_c = v_s/(cr-1)
v1 = v_s + v_c

# stage 2
v2 = v_c

p2 = p1*pow(v1,gamma)/pow(v2,gamma)
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))

# stage 3
v3 = v2
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))

# stage 4
v4 = v1

p4 = p3*pow(v3,gamma)/pow(v4,gamma)

t4 = p4*v4/rhs

#plotting
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.xlabel('Volume')
plt.ylabel('Pressure')
plt.show()

# Thermal efficiency
thermal_efficiency = 1 - (pow(cr,(1-gamma)))
print(thermal_efficiency)

Explanation of the code

  1. First of all, we need to identify the state variables of each point the Otto-cycle and how the volume and pressure changes from each state.
  2. The initial pressure, volume, temperature of atmospheric air is p1, v1and t1.
  3. During Suction Stroke, the inlet valve opens and the air intake occurs, and the state variable changes from p1v1 to p2v2. After the intake process the inlet valve closes, Compression Stroke takes place, during this stroke the charge (air-fuel mixture) compressed, the state variables change from p2v2 to p3v3. After the compression process Power Stroke takes place the state variables change from p3v3 to p4v4. then Exhaust Stroke, the exhaust valve opens and the burned gas is expelled. The state variables change from p4v4 to p1v1.
  4. Then the state variables are calculated using thermodynamic relations of each process,
  5. Since the state change from p2v2 to p3v3 is not linear we have to create the curve that relates to the process. In order to achieve that, the code has a function call with function name “engine_kinematics” this function call is done for creating the curve of adiabatic compression and adiabatic expansion process which they are not a straight line. With function call and thermodynamic relation, the v_compression and v_expansion are calculated.
  6. After calculating the values of the state variable use matplotlib (__) to plot the PV diagram of the Otto-Cycle. plt.show() command is used to display the plot
  7. Add labels for axis and give a title to the PV-diagram by using plt.xlabel (‘__’), plt.ylabel (‘__’) and

Results

  • Pressure-Volume (PV) Diagram Obtained
  • Thermal Efficiency in console

CONCLUSION

  1. P-V Diagram is plotted
  2. Thermal Efficiency = 51.12%

REFERENCE

[1] Engineering Thermodynamics – PK Nag

[2] Thermodynamics – Cengel Boles

[3] Wikipedia – Otto-cycle

[4 ]Google Images

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.