Project

Air standard Cycle using Python programming

AIM-

Program to solve the otto cycle, plot P-V diagram and calculate efficiency of the cycle.

Theory-

The Otto cycle is the name for the cycle used in spark-ignition IC Engine such as gasoline/petrol. Its theoretical efficiency depends on the compression ratio cr of the engine and the specific heat ratio γ of the gas in the combustion chamber.

Thus, the efficiency increases with the compression ratio. However, the compression ratio of Otto cycle engines is limited by the need to prevent the uncontrolled combustion known as knocking. Modern engines have compression ratios in the range 8 to 11, resulting in ideal cycle efficiencies of 56% to 61%.

Processes involved in the cycle:

Intake Stroke(0-1)

Compression Stroke(1-2)

Ignition Phase(2-3)

Expansion Stroke(3-4)

Heat Rejection(4-1)

Exhaust Stroke(1-0)

Governing equations-

Compression ratio: Vs+Vc/Vc
Where Vs=swept volume=(pi/4)*d^2*L

Where d=bore

L=stroke

Vc=clearance volume

Thermal Efficiecy-

`eta=1-frac{1}{underset(c)(r)^gamma-1`

Assumptions are taken:

The initial pressure P1 and temperature T1 is assumed to be 101325 pascals and 500 kelvin.
The maximum temperature inside the engine cylinder. T3 is assumed to be 2300 kelvin.

Python Code-

import matplotlib.pyplot as plt
import math
import numpy as np

#function 
def engine(sa,ea):
	bore=0.1
	stroke=0.1
	con_rod=.15
	cr=12
	vs=math.pi/4*bore*bore*stroke
	vc=vs/(cr+1)
	r=con_rod/(bore/2)
	t=np.linspace(sa,ea,50,endpoint=True)
	vol=[]
	for a in t:
		
		t1=0.5*(cr-1)
		t2=r+1-(math.cos(a))
		t3=math.sqrt(r*r-pow(math.sin(a),2))
		term=1+t1*(t2-t3)
		v=vc*(term)
		vol.append(v)
	return(vol)
	 
#input
p1=101325
t1=500
gama=1.4
t3=2300

#geometric parameters
#clearence and swept volume
bore=0.1
stroke=0.1
con_rod=.15
cr=12
vs=math.pi/4*bore*bore*stroke
vc=vs/(cr+1)
v1=vs+vc

#point 2
v2=vc

#p1*v1^gama=p2*v2^gama=g
p2=p1*pow(v1,gama)/pow(v2,gama)
#p*v/t=const=nr
nr=p1*v1/t1
t2=p2*v2/nr
vol=engine(0,math.pi)
vol.append(v1)
pr=[]
for a in vol:
	p=p1*pow(v1,gama)/pow(a,gama)
	pr.append(p)

#point3
v3=v2
p3=t3*nr/v3
#point4

v4=v1
p4=p3*math.pow(v3,gama)/math.pow(v4,gama)
t4=nr/(p4*v4)
vol2=[]
vol3=engine(math.pi,0)
vol2.append(v1)
vol2=vol2+vol3
pr2=[]
for a in vol2:
	p=p3*pow(v3,gama)/pow(a,gama)
	pr2.append(p)
#plot
plt.plot([v1,v2,v3,v4],[p1,p2,p3,p4],'*')
plt.plot([v1,v4],[p1,p4])
plt.plot([v2,v3],[p2,p3])
plt.plot(vol,pr)
plt.plot(vol2,pr2)
plt.ylabel('Preasure[Pa]')
plt.xlabel('Volume[m^3]')
plt.title('P-V Diagram of otto cycle')
plt.show()

n=1-(t1/t2)
print(n)

Output-

Efficiency-

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.