Challenge

Week 2 Air standard Cycle

AIM: To plot P-V diagram of otto cycle and to calculate the thermal efficiency of engine using Python.

Objectives of the Project:

  1. To write a program to visualize or create a P-V diagram of the otto cycle.
  2. To calculate the thermal efficiency of the engine of otto cycle.

Introduction:

Air standard cycles are reference cycles which give an approximation to the performance of an internal combustion engines.

The Otto cycle is an air-standard cycle which approximates the processes in petrol or diesel engines. It is based on constant volume heat addition (combustion) and heat rejection processes, and isentropic compression and expansion. The diagram is shown in Figure, where it is superimposed on an actual p–V diagram for a diesel engine.

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 constructed from:

Process 1-2: Isentropic Compression Process.

Process 2-3: Constant Volume Heat Addition Process.

Process 3-4: Isentropic Expansion Process.

Process 4-1: Constant Volume Heat Rejection Process.

The below graph shows the behavior of P-V and T-S diagram for otto cycle.

A typical Flow process of 4 stroke I.C. Engine piston cycle:

The processes are described by:

  • Process 0–1 where a mass of air is drawn into piston/cylinder arrangement at constant pressure.
  • Process 1–2 is an adiabatic (isentropic) compression of the charge as the piston moves from bottom dead centre (BDC) to top dead centre (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 centre. 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 centre.

Engine Geometric Parameters:

Bore (d)= Engine cylinder diameter.

TDC=Top dead centre.

BDC=Bottom dead centre.

Stroke (l)=Distance between TDC and BDC.

Vs=Swept Volume.

Vc=Clearance Volume.

Vt=Total Volume of cylinder (Vs+Vc).

cr=Compression Ratio (Defined as the ratio of the volume at bottom dead center and the volume at top dead center).

V=Volume inside cylinder when piston is at an angle Θ.

a=Crank radius (Stroke length/2)

R=Ratio of length of connecting rod to crank radius.

FORMULAE:

`V_s=π/4×d^2×l`

`V_c=V_s/((cr-1))`

`V_t=V_s+V_c`

Now, for engine piston kinematics, change of volume inside the combustion chamber is given by,

`V/V_c =1+1/2 (cr-1)[R+1-cos⁡θ-(R^2-sin^2 θ)^(1/2) ]`

Thermal Efficiency of an otto cycle engine:

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

Body of the Content:

  • PYTHON is used to display the code of the program
# A Program to plot the graph for otto cycle

# Importing Math library

import math
import matplotlib.pyplot as plt

# Defining the function name i.e. 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)
	ec=math.radians(end_crank)

	num_values=50

	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

# Inputs of Engine Parameters

gamma=1.4
t3=2300

# State Variables at state point 1

p1=101325
t1=500


# Engine Geometric parameters
bore=0.1
stroke=0.1
con_rod=0.15
cr=12

# Calculating the swept volume and clerance volume

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

# State Variables at state point 2

v2=v_c

# p2v2^gamma=p1v1^gamma
# p2=p1(v1/v2)^gamma

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

#p2v2/t2=p1v1/t1 | rhs=p1v1/t1 | p2v2/t2=rhs |t2=p2v2/rhs

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

# State Variables at state point 3

v3=v2

# p3v3/t3=p2v2/t2 | rhs=p2v2/t2 |p3=rhs*t3/v3

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

# State Variables at state point 4

v4=v1

# p4v4^gamma=p3v3^gamma

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

#p4v4/t4=rhs

t4=p4*v4/rhs

# To find Thermal Efficiency of the Engine

Thermal_Efficiency=1-(1/pow(cr,gamma-1))
print(Thermal_Efficiency)

# Plotting of graph

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

Explanation of the above Programing code to plot P-V graph and also to determine the thermal efficiency of engine.

  • Import math and import matplotlib command is used to import math functions and to plot graph respectively.
  • Then,defining a function name called as engine_kinematics which is used to define engine parameter variables such as bore, stroke, con_rod, cr, start_crank and end_crank to achieve a set of solution for every different value of crank angle.
  • Now, geometric parameters and volume parameters are defined with the help of deined formulas.
  • The value of crank angle ‘theta’ is computed for 50 values between start and end crank angle which are obtained in radians based on equation.
  • An empty array of volume is created in order to store all the values of it.
  • To obtain a curve, the equation of V i.e. volume inside cylinder when piston is at an angle Θ is determined under for loop.For loop is used and V.append command helps us to store the calculated values of V and kept in an array called V=[ ].
  • Return V command is used to return all the calculated values of V back to it as an output.
  • Then, the value of inputs of engine parameter such as gamma,t3 are defined. After that, state variables such as p1,t1 are defined at state point 1.
  • Then, the engine geometric parameters are entered which include bore diameter, stroke length, connecting rod length and the compression ratio of the engine.
  • The swept volume and clearance volume is calculated by using some useful thermodynamic relation and formulae which are stated in the programming window.
  • The state variables such as v1,p2,p2,t2,v3,p3,v4,p4 and t4 are calculated using thermodynamic laws and formulae where 1,2,3,&4 represent a state point .
  • Now, the function is called in the code and V_compression, P_compression,V_expansion, P_expansion are calculated w.r.t. the values of crank angle Θ.
  • Thereafter, the thermal efficiency of engine is calculated by using the formula as stated in above coding.
  • Finally, with the help of plt.plot command all state variables at state point 1,2,3&4 are plotted along with the curves and thus the P-V cycle for otto cycle is obtained.

Results:

  • Obtained values from command window:
  • Plot of P-V diagram for otto cycle:

Conclusion:

  • The thermal efficiency of otto cycle is calculated as 62.98%.As thermal efficiency mainly depends upon the compression ratio, we conclude that higher compression ratio results in higher thermal efficiency or vice-versa.
  • Also, the P-V diagram for otto cycle for all four processes have been plotted successfully.
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.