Challenge

PV Diagram for an Air standard Cycle

Objective:

To solve an Otto cycle, create a PV diagram and compute the thermal efficiency of the engine.

Problem Statement:

The Otto cycle is a set of processes used by spark-ignition internal combustion engines both 2-stroke or 4-stroke cycles. These engines

  1. ingest a mixture of fuel and air,
  2. compress it,
  3. cause it to react, thus effectively adding heat through converting chemical energy into thermal energy,
  4. expand the combustion products, and then
  5. eject the combustion products and replace them with a new charge of fuel and air.

The four processes of the cycle include:

  1. Isentropic (reversible adiabatic) compression
    2. Constant volume (Isochoric) heat addition
    3. Isentropic (reversible adiabatic) Expansion
    4. Constant volume heat rejection.

S.no

Process

Operation

Position of piston

Change in parameter

1.

1-2: Isentropic Compression

Compression of air.

BDC to TDC

V: Decreases from V1 To V2

T: Increases from T1 to T2

P: Increases from P1 to P2

S: Entropy remains constant (S1=S2)

2.

2-3: Constant Volume Heat Addition

Heat is added in the form of spark and combustion occurs.

At TDC for a moment

V: Remains constant (V2 = V3)

T: Increases from T2 to T3

P: Increases from P2 to P3

S: Increases from S2 to S3

3.

3-4: Isentropic Expansion

Expansion of air takes place due to heat addition.

TDC to BDC

V: Increases from V3 to V4

T: Decreases from T3 to T4

P: Decreases from P3 to P4

S: Entropy remains constant (S3=S4)

4.

4-1: Constant Volume Heat Rejection

Heat is rejected to a sink.

At BDC for a moment

V: Volume remains constant (V4 = V1)

T: Decreases from T4 to T1

P: Decreases from P4 to P1

S: Decreases from S4 to S1

Solution Procedure:

Isentropic processes are adiabatic reversible processes and the state variables obey the following equations:

Isochoric processes take place in a constant volume and pressure and temperature, obeying the gas law:

Parameters of the engine which define its performance include:

  1. Bore
  2. Stroke
  3. Compression Ratio
  4. Connecting Rod Length
  5. Swept Volume
  6. Clearance Volume

The volume of the chamber during the compression and expansion strokes is governed by the crank rotation and is related to the crank angle (U) and crank ratio(R) as follows:

Data Considered:

  • P1= 101325 Pascals
  • T1=500 K
  • g (gamma)= 1.4
  • T3=1800 K
  • Bore diameter=0.1 m
  • Stroke= 0.07 m
  • Connecting rod length=0.15 m
  • Compression ratio=4

Code:

"""
Title: Air Standard Cycle -Otto Cycle- Week 2 -Challenge 3

Submitted by M K Pragya

_____________________________________________________________________________________________________________________________________________________
"""

import math
import matplotlib.pyplot as plt


#defining the function for engine kinematics
def engine_kinematics(bore, stroke, con_rod, cr, start_crank, end_crank):

	# Geometric parameters
	a = stroke/2
	R = con_rod/a

	# Volume parameters
	V_s = math.pi*(1/4)*pow(bore,2)*stroke
	V_c = V_s/(cr-1)

	sc=math.radians(start_crank)        							  # Starting Crank angle
	ec=math.radians(end_crank)										  # Ending Crank angle

	num_values = 100

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

	V = []

	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 

#_____________________________________________________________________________________________________________________________________________
#for State 1

#inputs- Parameters of Engine Performance

p1=101325 																#pascal(Pa)
t1=500    																#Kelvin(K)
gamma=1.4																#gamma is a constant
t3=1800   																#kelvin(K)

#geometric parameters

bore=0.1            													#dimensions in metres
stroke=0.07         													#dimensions in metres
con_rod=0.15        													#length of connecting rod
cr= 4			    													#compression ratio

# Volume Computation

v_s=(math.pi/4)*pow(bore,2)*stroke										#swept volume
v_c=v_s/(cr-1)                          								#clearance volume
v1=v_c+v_s

#For State 2

v2=v_c

"""from simple isotropic relations 
		p2 * v2^gamma=p1 * v1^gamma """


p2=p1*pow(v1, gamma)/pow(v2, gamma)   									#pressure should increase after compression

#p2 * v2/t2= p1 * v1/t1	|| Let r = p1 * v1/t1 || p2 *v2/t2=r || t2=p2 * v2/r

r= p1*v1/t1
t2= p2*v2/r          					                             	#temperature should increase 
V_compression= engine_kinematics(bore, stroke, con_rod, cr, 180, 0) 	#Funtion call for the engine_kinematics

#P_compression * V_compression^gamma = constant

constant= p1*pow(v1, gamma)

P_compression = []														#An empty array to store the pressure values

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

#For State 3

v3=v2																	#As constant volume heat addition

#p3 * v3/t3=p2 * v2/t2 || r=p2 * v2/t2|| p3=r*t3/v3

r=p2*v2/t2
p3=r*t3/v3

V_expansion = engine_kinematics(bore, stroke, con_rod, cr, 0, 180)		#Funtion call for the engine_kinematics

#P_compression*V_compression^gamma = constant
constant= p3*pow(v3, gamma)

P_expansion = []														#An empty array to store the pressure values

for v in V_expansion:
	P_expansion.append(constant/pow(v, gamma))

#state point 4

v4=v1

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

#p4 * v4/t4=p3 * v3/t3  =r                      						#p*v/t will be constant as a closed cycle process
t4=p4*v4/r

#________________________________________________________________________________________________________________________________________________

#To calculate the efficiency of the otto cycle = (1 - 1/(cr^(gamma-1)) 

E = 1 - (1/(pow(cr,(gamma-1))))

print(" The efficiency of the Otto cycle is calculated to be",E)		# To print the efficiency for the given engine parameters

#To Plot the P-V Diagram for the given conditions of Otto Cycle

plt.plot([v2,v3],[p2,p3],,linewidth = 2,label="Constant Volume Combustion")                	#To plot for state 2-3
plt.plot(V_compression, P_compression,, linewidth = 2, label="Isentropic Compression")		#To plot for state 1-2
plt.plot(V_expansion, P_expansion,,linewidth = 2, label="Isentropic Expansion")				#To plot for state 3-4
plt.plot([v4,v1],[p4,p1],,linewidth = 2, label="Constant Volume Heat Rejection")				#To plot for State 4-1
plt.legend()																								#To print the legend

# Formatting the details for the drawn plots 

plt.title('PV diagram - Otto Cycle',color='red', fontname="Times New Roman",fontsize=25,fontweight='bold')	
plt.xlabel('Volume(V)',fontname="Times New Roman",fontsize=16, fontweight='bold')
plt.ylabel('Pressure(P)', fontname="Times New Roman",fontsize=16, fontweight='bold')
plt.show()

Result:

The efficiency of the considered Otto cycle is 0.4256

PV Diagram for the Otto cycle:

Discussion:

As the compression ratio increases, the efficiency increases, but so does T2. If T2 is too high, the mixture will ignite without a spark (at the wrong location in the cycle)

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.